ESLint

The pluggable linting utility for JavaScript and JSX.

Version

The version specified in your package.json or 3.19.0

Runtime

Node.js Versions

Supported Languages

JavaScript

Official Documentation

http://eslint.org/

YAML Configuration

eslint:

  • input:

    Patterns to include in execution and reports.

  • ignore:

    Patterns to exclude from execution and reports.

  • auto-fix:

    true/false

    Specifying true implies --fix option.

  • config-file:

    Alias of --config option.

  • machine:

    • cpu:

      Amount of CPU. The default machine has 0.5 CPU with 1920 MiB RAM.

  • options:

    Below is the list of options that are supported:

    Basic configuration:
      -c, --config path::String    Use configuration from this file or shareable config
      --no-eslintrc                Disable use of configuration from .eslintrc
      --env [String]               Specify environments
      --ext [String]               Specify JavaScript file extensions - default: .js
      --global [String]            Define global variables
      --parser String              Specify the parser to be used
      --parser-options Object      Specify parser options
    
    Specifying rules and plugins:
      --rulesdir [path::String]    Use additional rules from this directory
      --rule Object                Specify rules
    
    Ignoring files:
      --ignore-path path::String   Specify path of ignore file
      --no-ignore                  Disable use of ignore files and patterns
      --ignore-pattern [String]    Pattern of files to ignore (in addition to those in .eslintignore)
    
    Handling warnings:
      --quiet                      Report errors only - default: false
      --max-warnings Int           Number of warnings to trigger nonzero exit code - default: -1
    
    Miscellaneous:
      --no-inline-config           Prevent comments from changing config or rules
  • experimental:

    • incremental:

      true/false

      Note: The incremental analysis is disabled if any kinds of configuration files are changed. The files recognized as configuration files are as follows:

      • Configuration files:
        • Files specified in config-file field
        • Files specified to -c, --config options
        • If none of the above configuration files are found:
          • **/.eslintrc.js, **/.eslintrc.yaml, **/.eslintrc.yml, **/.eslintrc.json, **/.eslintrc, **/package.json
      • Rule files:

        • Files under directories specified to --rulesdir option
      • Ignore files:

        • Files specified to --ignore-path option
        • If none of the above ignore files are found:
          • .eslintignore at the repository root

      Note: The incremental analysis is disabled if external dependencies are required. See Resolving Dependencies about how the dependencies are resolved.

YAML Examples

  • With default options:

    inspecode:
      eslint: default
  • With enabling auto-fixing and default options:

    inspecode:
      eslint: auto-fix
  • With custom machine:

    inspecode:
      eslint:
        machine:
          cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
  • With custom options:

    inspecode:
      eslint:
        options:
          - --quiet
          - --no-ignore
  • With a configuration file:

    inspecode:
      eslint:
        config-file: ./my-eslint.json

    The above configuration is equivalent to:

    inspecode:
      eslint:
        options:
          --config: ./my-eslint.json

Configuration File Detection

If no configuration files are specified via config-file or options field, Inspecode lets ESLint to find configuration files in your repository.

See http://eslint.org/docs/user-guide/configuring about how ESLint looks for configuration files.

Resolving Dependencies

Although ESLint can work with various plugins, Inspecode does not have any ESLint plugins installed by default. But Inspecode searches your repository for package.json files enabling ESLint and runs npm install at each directory where package.json is placed in order to install ESLint itself and its plugins at runtime, so you can use any ESLint plugins.

As of now, Inspecode can install:

  • packages available to the public on npm
  • packages provided from your private repositories which:
    • belong to the same GitHub organization or Bitbucket team as the repository on which ESLint runs
    • have been already registered to Inspecode
    • can be accessed via http://<hostname>/<path>, https://<hostname>/<path>, ssh://git@<hostname>/<path> or git@<hostname>:<path>

Multiple Projects In Single Repository

If there are multiple Node.js projects (package.json files) in single repository, Inspecode detects projects enabling ESLint and then runs eslint locally installed for each project to work with ESLint plugins. That is why you can see The version specified in your package.json in Version section.

In addition, Inspecode also runs eslint globally installed by default on the entire repository with excluding directories of the projects enabling ESLint, so that any JavaScript code, which is not a part of Node.js projects, can also be checked by ESLint.

Note: As of now, Inspecode uses the same configuration when running eslint every time regardless of where it runs on in a job. So if this does not suit you and you want to run eslint with different configuration on each Node.js project, use default built-in configuration and place ESLint configuration files, such as .eslintrc, at locations where ESLint can recognize automatically.

results matching ""

    No results matching ""