Skip to main content

ESLint

Supported VersionLanguageWebsite
5.0.0+ (default: 7.31.0)JavaScripthttps://eslint.org

ESLint is a static analysis tool for JavaScript and its flavors (e.g. TypeScript, JSX, or Vue). It can find problems, style violations, or security issues, etc. in your code, and have so many plugins.

Getting Started#

To start using ESLint, enable it in your repository settings. After enabled, Sider will automatically analyze your JavaScript files with our default version and default configuration (if you do not have yours).

But, if you want to customize more ESLint with some plugins or shareable configurations, install ESLint into your project:

$ npm install eslint --save-dev

Next, you need to configure ESLint for your project. We recommend eslint --init that helps you configure it.

$ npm exec -- eslint --init

See the ESLint documentation to learn more.

Default Configuration for ESLint#

Sider provides our recommended ruleset for ESLint. This configuration is used when you have no ESLint configurations or sider.yml in your repository. For more details, please visit Recommended Ruleset.

Configuration#

You can use the following options of sider.yml to make analysis fitter for your project. For example:

linter:  eslint:    target: frontend/app    config: .config/.eslintrc.js    ext: [.js, .jsx, .es6]    ignore-path: .my_eslintignore    ignore-pattern: "/src/vendor/*"    no-ignore: true    global:      - require      - "exports:true"    quiet: true
NameTypeDefault
root_dirstring-
dependenciesstring[], map[]-
npm_installboolean, string-
targetstring, string[].
configstring-
extstring, string[]-
ignore-pathstring-
ignore-patternstring, string[]-
no-ignorebooleanfalse
globalstring, string[]-
quietbooleanfalse

target#

This option allows you to specify files or directories to analyze. Glob is available.

For example:

linter:  eslint:    target:      - frontend/src      - app/assets/javascripts      - "**/__tests__/**"

dir#

caution

This option is deprecated. Use the target option instead.

This is an alias for target.

config#

This option allows you to specify an additional configuration file. See also the --config option.

ext#

This option allows you to specify file extensions to analyze. See also the --ext option.

ignore-path#

This option allows you to exclude files from analysis by your ignore file. See also the --ignore-path option.

ignore-pattern#

This option allows you to ignore files by patterns. See also the --ignore-pattern option.

no-ignore#

This option allows you to disable the use of ignore files or patterns. See also the --no-ignore option.

global#

This option allows you to define global variables. It requires a comma-separated string. See also the --global option.

quiet#

This option allows you to suppress warnings. When true, only errors are reported. See also the --quiet option.