Skip to content

coffeelint

coffeelint documentation

coffeelint - GitHub

Configuration in Mega-Linter

Variable Description Default value
COFFEE_COFFEELINT_ARGUMENTS User custom arguments to add in linter CLI call
Ex: -s --foo "bar"
COFFEE_COFFEELINT_FILTER_REGEX_INCLUDE Custom regex including filter
Ex: (src\|lib)
Include every file
COFFEE_COFFEELINT_FILTER_REGEX_EXCLUDE Custom regex excluding filter
Ex: (test\|examples)
Exclude no file
COFFEE_COFFEELINT_CLI_LINT_MODE Override default CLI lint mode
- file: Calls the linter for each file
- list_of_files: Call the linter with the list of files as argument
- project: Call the linter from the root of the project
{linter.cli_lint_mode}
COFFEE_COFFEELINT_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".py", ""]
[".coffee"]
COFFEE_COFFEELINT_FILE_NAMES_REGEX File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files
Ex: ["Dockerfile(-.+)?", "Jenkinsfile"]
Include every file
COFFEE_COFFEELINT_PRE_COMMANDS List of bash commands to run before the linter None
COFFEE_COFFEELINT_POST_COMMANDS List of bash commands to run after the linter None
COFFEE_COFFEELINT_CONFIG_FILE coffeelint configuration file name
Use LINTER_DEFAULT to let the linter find it
.coffee-lint.json
COFFEE_COFFEELINT_RULES_PATH Path where to find linter configuration file Workspace folder, then Mega-Linter default rules
COFFEE_COFFEELINT_DISABLE_ERRORS Run linter but consider errors as warnings false
COFFEE_COFFEELINT_DISABLE_ERRORS_IF_LESS_THAN Maximum number of errors allowed 0

IDE Integration

Use coffeelint in your favorite IDE to catch errors before Mega-Linter !

IDE Extension Name Install
Atom linter-coffeelint Visit Web Site
IDEA coffeelint

Mega-Linter Flavours

This linter is available in the following flavours

Flavor Description Embedded linters Info
all Default Mega-Linter Flavor 93 Docker Image Size (tag) Docker Pulls
javascript Optimized for JAVASCRIPT or TYPESCRIPT based projects 48 Docker Image Size (tag) Docker Pulls

Behind the scenes

How are identified applicable files

  • File extensions: .coffee

How the linting is performed

  • coffeelint is called one time by identified file

Example calls

coffeelint myfile.coffee
coffeelint -f .coffee-lint.json myfile.coffee

Help content

Usage: coffeelint [options] source [...]

Options:
  -f, --file          Specify a custom configuration file.
      --rules         Specify a custom rule or directory of rules.
      --makeconfig    Prints a default config file                     [boolean]
      --trimconfig    Compares your config with the default and prints a minimal
                      configuration                                    [boolean]
      --noconfig      Ignores any config file.                         [boolean]
  -h, --help          Show help                                        [boolean]
  -v, --version       Show version number                              [boolean]
  -r                  (not used, but left for backward compatibility)  [boolean]
      --reporter      built in reporter (default, csv, jslint, checkstyle, raw),
                      or module, or path to reporter file.
      --csv           [deprecated] use --reporter csv                  [boolean]
      --jslint        [deprecated] use --reporter jslint               [boolean]
      --nocolor       [deprecated] use --color=never                   [boolean]
      --checkstyle    [deprecated] use --reporter checkstyle           [boolean]
      --color=<when>  When to colorize the output. <when> can be one of always,
                      never , or auto.
  -s, --stdin         Lint the source from stdin                       [boolean]
  -q, --quiet         Only print errors.                               [boolean]
      --literate      Used with --stdin to process as Literate CoffeeScript
                                                                       [boolean]
  -c, --cache         Cache linting results                            [boolean]
      --ext           Specify an additional file extension, separated by comma.

Installation on mega-linter Docker image

Example success log

Results of coffeelint linter (version 4.1.2)
See documentation on https://nvuillam.github.io/mega-linter/descriptors/coffee_coffeelint/
-----------------------------------------------

[SUCCESS] .automation/test/coffeescript/coffeescript_good_1.coffee
      ⚡ .automation/test/coffeescript/coffeescript_good_1.coffee
         ⚡ #65-65: Line contains inconsistent indentation. (indentation) Expected 2 got 3.

    ⚡ Warning! » 0 errors and 1 warning in 1 file

Example error log

Results of coffeelint linter (version 4.1.2)
See documentation on https://nvuillam.github.io/mega-linter/descriptors/coffee_coffeelint/
-----------------------------------------------

[ERROR] .automation/test/coffeescript/coffeescript_bad_1.coffee
      ✗ .automation/test/coffeescript/coffeescript_bad_1.coffee
         ✗ #39: [stdin]:39:29: error: unmatched )
    module.exports = (robot) -> )
                                ^. (coffeescript_error)

    ✗ Lint! » 1 error and 0 warnings in 1 file