Open rogerxu opened 7 years ago
Configuring ESLint - ESLint - Pluggable JavaScript linter
If there are multiple configuration files in the same directory, ESLint will only use one. The priority order is:
.eslintrc.js
.eslintrc.yaml
.eslintrc.yml
.eslintrc.json
- ESLint’s JSON files also allow JavaScript-style comments..eslintrc
- Deprecatedpackage.json
.eslintrc.json
{
"root": true,
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "script",
"ecmaFeatures": {
"impliedStrict": true
}
},
"env": {
"node": true,
"es6": true
},
"globals": {},
"extends": "eslint:recommended",
"rules": {}
}
"for-direction": "error"
- 4.0.0
"getter-return": "error"
- 4.2.0
"no-async-promise-executor": "error"
- 5.3.0
"no-await-in-loop": "error"
- 3.12.0
"no-compare-neg-zero": "error"
- 3.17.0
"no-cond-assign": ["error", "except-parens"]
"no-console": "error"
"no-constant-condition": "error"
"no-control-regex": "error"
"no-debugger": "error"
"no-dupe-args": "error"
"no-dupe-keys": "error"
"no-duplicate-case": "error"
"no-empty": "error"
"no-empty-character-class": "error"
"no-ex-assign": "error"
"no-extra-boolean-cast": "error"
"no-extra-parens": "error"
"no-extra-semi": "error"
"no-func-assign": "error"
"no-inner-declarations": "error"
"no-invalid-regexp": "error"
"no-irregular-whitespace": "error"
"no-misleading-character-class": "error"
- 5.3.0
"no-obj-calls": "error"
"no-prototype-builtins": "error"
"no-regex-spaces": "error"
"no-sparse-arrays": "error"
"no-template-curly-in-string": "error"
- 3.3.0
"no-unexpected-multiline": "error"
"no-unreachable": "error"
"no-unsafe-finally": "error"
"no-unsafe-negation": "error"
- 3.3.0
"require-atomic-updates": "error"
- 5.3.0
"use-isnan": "error"
"valid-jsdoc": ["error", options]
{
"prefer": {
"return": "returns"
},
"requireReturn": false,
"requireReturnType": true,
"requireParamDescription": true,
"requireReturnDescription": true
}
"valid-typeof": "error"
"accessor-pairs": "error"
"array-callback-return": "error"
"block-scoped-var": "error"
"class-methods-use-this": "error"
- 3.4.0
"complexity": ["error", 20]
"consistent-return": "error"
"curly": "error"
"default-case": "error"
"dot-location": ["error", "property"]
"dot-notation": "error"
"eqeqeq": ["error", "smart"]
"guard-for-in": "error"
"max-classes-per-file": "error"
- 5.0.0
"no-alert": "error"
"no-caller": "error"
"no-case-declarations": "error"
"no-div-regex": "error"
"no-else-return": "error"
"no-empty-function": "error"
"no-empty-pattern": "error"
"no-eq-null": "error"
"no-eval": "error"
"no-extend-native": "error"
"no-extra-bind": "error"
"no-extra-label": "error"
"no-fallthrough": "error"
"no-floating-decimal": "error"
"no-global-assign": "error"
- 3.3.0
"no-implicit-coercion": "error"
"no-implicit-globals": "error"
"no-implied-eval": "error"
"no-invalid-this": "error"
"no-iterator": "error"
"no-labels": "error"
"no-lone-blocks": "error"
"no-loop-func": "error"
"no-magic-numbers": ["warn", options]
{
"ignore": [-1, 0, 1],
"detectObjects": true
}
"no-multi-spaces": "error"
"no-multi-str": "error"
"no-new": "error"
"no-new-func": "error"
"no-new-wrappers": "error"
"no-octal": "error"
"no-octal-escape": "error"
"no-param-reassign": "error"
"no-proto": "error"
"no-redeclare": "error"
"no-restricted-properties": "error"
- 3.5.0
"no-return-assign": ["error", "except-parens"]
"no-return-await": "error"
- 3.10.0
"no-script-url": "error"
"no-self-assign": "error"
"no-self-compare": "error"
"no-sequences": "error"
"no-throw-literal": "error"
"no-unmodified-loop-condition": "error"
"no-unused-expressions": "error"
"no-unused-labels": "error"
"no-useless-call": "error"
"no-useless-concat": "error"
"no-useless-escape": "error"
"no-useless-return": "error"
- 3.9.0
"no-void": "error"
"no-warning-comments": "warn"
"no-with": "error"
"prefer-promise-reject-errors": "error"
- 3.14.0
"radix": "error"
"require-await": "error"
- 3.11.0
"require-unicode-regexp": "error"
- 5.3.0
"vars-on-top": "off"
"wrap-iife": ["error", "inside"]
"yoda": "error"
"strict": ["error", "safe"]
"init-declarations": ["off", "always"]
"no-delete-var": "error"
"no-label-var": "error"
"no-restricted-globals": "error"
"no-shadow": "error"
"no-shadow-restricted-names": "error"
"no-undef": "error"
"no-undef-init": "error"
"no-undefined": "error"
"no-unused-vars": ["error", options]
{
"vars": "all",
"args": "after-used",
"ignoreRestSiblings": false
}
"no-use-before-define": ["error", options]
{
"functions": false
}
"callback-return": "error"
"global-require": "error"
"handle-callback-err": "error"
"no-buffer-constructor": "error"
- 4.0.0"no-mixed-requires": "error"
"no-new-require": "error"
"no-path-concat": "error"
"no-process-env": "error"
"no-process-exit": "error"
"no-restricted-modules": "error"
"no-sync": "error"
"array-bracket-newline": ["error", "consistent"]
- 4.0.0
"array-bracket-spacing": ["error", "never"]
"array-element-newline" :["error", "consistent"]
- 4.0.0
"block-spacing": ["error", "always"]
"brace-style": ["error", "1tbs", {"allowSingleLine": true}]
"camelcase": ["error", {"properties": "always"}]
"capitalized-comments": "off"
- 3.11.0
"comma-dangle": ["error", "always-multiline"]
"comma-spacing": ["error", {"before": false, "after": true}]
"comma-style": ["error", "last"]
"computed-property-spacing": ["error", "never"]
"consistent-this": ["error", "that"]
"eol-last": ["error", "always"]
"func-call-spacing": ["error", "never"]
- 3.3.0
"func-name-matching": ["error", "always"]
- 3.8.0
"func-names": ["error", "as-needed"]
"func-style": ["error", "expression"]
"function-paren-newline": ["error", "multiline"]
- 4.6.0
"id-blacklist": ["error", "e", "cb"]
"id-length": "error"
"id-match: "error"
"implicit-arrow-linebreak": ["error", "beside"]
- 4.12.0
"indent": ["error", 2, {"SwitchCase": 1}]
"jsx-quotes": ["error", "prefer-double"]
"key-spacing": ["error", {"beforeColon": false, "afterColon": true, "mode": "strict"}]
"keyword-spacing": ["error", {"before": true, "after": true}]
"line-comment-position": ["off", {"position": "above"}]
- 3.5.0
"linebreak-style": ["error", "unix"]
,
"lines-around-comment": ["error", options]
{
"beforeBlockComment": true,
"beforeLineComment": true,
"allowBlockStart": true,
"allowObjectStart": true
}
"lines-between-class-members": ["error", "always"]
- 4.9.0
"max-depth": ["error", 4]
"max-len": ["error", 200, 4]
"max-lines: ["error", 1000]"
"max-lines-per-function": ["warn", 50]
- 5.0.0
"max-nested-callbacks": ["error", 3]
"max-params": ["error", 3]
"max-statements": ["error", 20]
"max-statements-per-line": ["error", {"max": 1}]
"multiline-comment-style": ["error", "separate-lines"]
"multiline-ternary": ["error", "always-multiline"]
"new-cap": ["error", options]
{
"newIsCap": true,
"capIsNew": true
}
"new-parens": "error"
"newline-per-chained-call": ["error", {"ignoreChainWithDepth": 2}]
"no-array-constructor": "error"
"no-bitwise": "error"
"no-continue": "error"
"no-inline-comments": "off"
"no-lonely-if": "error"
"no-mixed-operators": "off"
"no-mixed-spaces-and-tabs": "error"
"no-multi-assign": "error"
- 3.14.0
"no-multiple-empty-lines": ["error", {"max": 2}]
"no-negated-condition": "off"
"no-nested-ternary": "error"
"no-new-object": "error"
"no-plusplus": "off"
"no-restricted-syntax": "off"
"no-tabs": "error"
"no-ternary": "off"
"no-trailing-spaces": "error"
"no-underscore-dangle": "error"
"no-unneeded-ternary": "error"
"no-whitespace-before-property": "error"
"nonblock-statement-body-position": "error"
- 3.17.0
"object-curly-newline": ["error", {"consistent": true}]
"object-curly-spacing": ["error", "never"]
"object-property-newline": "off"
"one-var": "off"
"one-var-declaration-per-line": ["error", "initializations"]
"operator-assignment": ["error", "always"]
"operator-linebreak": ["error", "before"]
"padded-blocks": ["error", "never"]
"padding-line-between-statements": ["error", options]
- 4.0.0
{
"blankLine": "always",
"prev": "*",
"next": "return"
}
"prefer-object-spread": "error"
- 5.0.0
"quote-props": ["error", "as-needed"]
"quotes": ["error", "single"]
"require-jsdoc": ["warn", options]
{
"require": {
"FunctionDeclaration": true,
"MethodDefinition": false,
"ClassDeclaration": false,
"ArrowFunctionExpression": false
}
}
"semi": ["error", "always"]
"semi-spacing": ["error", options]
{
"before": false,
"after": true
}
"semi-style": ["error", "last"]
- 4.0.0
"sort-keys": "off"
- 3.3.0
"sort-vars": "off"
"space-before-blocks": ["error", "always"]
"space-before-function-paren": ["error", options]
{
"anonymous": "always",
"named": "never",
"asyncArrow": "always"
}
"space-in-parens": ["error", "never"]
"space-infix-ops": "error"
"space-unary-ops": ["error", options]
{
"words": true,
"nonwords": false
}
"spaced-comment": ["error", "always", options]
{
"exceptions": ["*"]
}
"switch-colon-spacing": ["error", options]
- 4.0.0
{
"after": true,
"before": false
}
"template-tag-spacing": ["error", "never"]
- 3.15.0
"unicode-bom": ["error", "never"]
"wrap-regex": "off"
"arrow-body-style": ["error", "as-needed"]
"arrow-parens": ["error", "always"]
"arrow-spacing": "error"
"constructor-super": "error"
"generator-star-spacing": ["error", options]
{
"before": true,
"after": false
}
"no-class-assign": "error"
"no-confusing-arrow": "error"
"no-const-assign": "error"
"no-dupe-class-members": "error"
"no-duplicate-imports": "error"
"no-new-symbol": "error"
"no-restricted-imports": "error"
"no-this-before-super": "error"
"no-useless-computed-key": "error"
"no-useless-constructor": "error"
"no-useless-rename": "error"
"no-var": "error"
"object-shorthand": ["error", "always"]
"prefer-arrow-callback": "error"
"prefer-const": "error"
"prefer-destructuring": "error"
- 3.13.0
"prefer-numeric-literals": "error"
"prefer-rest-params": "error"
"prefer-spread": "error"
"prefer-template": "error"
"require-yield": "error"
"rest-spread-spacing": ["error", "never"]
"sort-imports": "off"
"symbol-description": "error"
"template-curly-spacing": ["error", "never"]
"yield-star-spacing": ["error", "after"]
Microsoft/vscode-eslint: VSCode extension to integrate eslint into VSCode
Node.js API - ESLint - Pluggable JavaScript linter
.vscode/settings.json
{
"eslint.options": {
"ignorePath": "app/.eslintignore",
"rulePaths": ["app/node_modules/@sap/di.code-validation.js/src/defaultConfig/fioriCustomRules/.eslintrules"]
},
}
ESLint - Pluggable JavaScript linter