eslintのeslint:recommendedとgoogleとairbnbとstandardの違い
ありそうで無かったeslintのconfig比較表です。
2017/8/3現在、下記バージョンでの調査となっています。
- eslint: 4.3.0
- eslint-config-google: 0.9.1
- eslint-config-airbnb-base: 11.3.1
- eslint-config-standard: 10.2.1
Possible Errors
rule | eslint: recommended |
airbnb | standard | |
---|---|---|---|---|
for-direction | off | off | ||
getter-return | off | ['off', { allowImplicit: true | ||
no-await-in-loop | off | error | ||
no-compare-neg-zero | error | off | error | |
no-cond-assign | error | 0 | ['error', 'always'] | error |
no-console | error | warn | ||
no-constant-condition | error | warn | ["error", { "checkLoops": false }] | |
no-control-regex | error | error | error | |
no-debugger | error | error | error | |
no-dupe-args | error | error | error | |
no-dupe-keys | error | error | error | |
no-duplicate-case | error | error | error | |
no-empty | error | error | ||
no-empty-character-class | error | error | error | |
no-ex-assign | error | error | error | |
no-extra-boolean-cast | error | error | error | |
no-extra-parens | off | ['off', 'all', { conditionalAssign: true, nestedBinaryExpressions: false, returnAssign: false, ignoreJSX: 'all', enforceForArrowConditionals: false, }] |
["error", "functions"] | |
no-extra-semi | error | error | ||
no-func-assign | error | error | error | |
no-inner-declarations | error | error | ["error", "functions"] | |
no-invalid-regexp | error | error | error | |
no-irregular-whitespace | error | 2 | error | error |
no-obj-calls | error | error | error | |
no-prototype-builtins | off | error | ||
no-regex-spaces | error | error | error | |
no-sparse-arrays | eror | error | error | |
no-template-curly-in-string | off | error | error | |
no-unexpected-multiline | error | 2 | error | error |
no-unreachable | error | error | error | |
no-unsafe-finally | error | error | error | |
no-unsafe-negation | error | error | error | |
use-isnan | error | error | error | |
valid-jsdoc | off | [2, { requireParamDescription: false, requireReturnDescription: false, requireReturn: false, prefer: {returns: 'return'}, }] |
off | |
valid-typeof | error | ['error', { requireStringLiterals: true }] | ["error", { "requireStringLiterals": true }] |
Best Practices
rule | eslint: recommended |
airbnb | standard | |
---|---|---|---|---|
accessor-pairs | off | off | error | |
array-callback-return | off | error | ||
block-scoped-var | off | error | ||
class-methods-use-this | off | ['error', { exceptMethods: [], }] |
||
complexity | off | ['off', 11] | ||
consistent-return | off | error | ||
curly | off | [2, 'multi-line'] | ['error', 'multi-line'] | ["error", "multi-line"] |
default-case | off | ['error', { commentPattern: '^no default$' }] | ||
dot-location | off | ['error', 'property'] | ["error", "property"] | |
dot-notation | off | ['error', { allowKeywords: true }] | ||
eqeqeq | off | ['error', 'always', { null: 'ignore' }] | ["error", "always", { "null": "ignore" }] | |
guard-for-in | off | 2 | error | |
no-alert | off | warn | ||
no-caller | off | 2 | error | error |
no-case-declarations | error | error | ||
no-div-regex | off | off | ||
no-else-return | off | error | ||
no-empty-function | off | ['error', { allow: [ 'arrowFunctions', 'functions', 'methods', ] }] |
||
no-empty-pattern | error | error | error | |
no-eq-null | off | off | ||
no-eval | off | error | error | |
no-extend-native | off | 2 | error | error |
no-extra-bind | off | 2 | error | error |
no-extra-label | off | error | ||
no-fallthrough | error | error | error | |
no-floating-decimal | off | error | error | |
no-global-assign | error | ['error', { exceptions: [] }] | error | |
no-implicit-coercion | off | ['off', { boolean: false, number: true, string: true, allow: [], }] |
||
no-implicit-globals | off | off | ||
no-implied-eval | off | error | error | |
no-invalid-this | off | 2 | off | |
no-iterator | off | error | error | |
no-labels | off | ['error', { allowLoop: false, allowSwitch: false }] | ["error", { "allowLoop": false, "allowSwitch": false }] | |
no-lone-blocks | off | error | error | |
no-loop-func | off | error | ||
no-magic-numbers | off | ['off', { ignore: [], ignoreArrayIndexes: true, enforceConst: true, detectObjects: false, }] |
||
no-multi-spaces | off | 2 | ['error', { }] |
error |
no-multi-str | off | 2 | error | error |
no-new | off | error | error | |
no-new-func | off | error | error | |
no-new-wrappers | off | 2 | error | error |
no-octal | error | error | error | |
no-octal-escape | off | error | error | |
no-param-reassign | off | ['error', { props: true, ignorePropertyModificationsFor: [ 'acc', 'e', 'ctx', 'req', 'request', 'res', 'response', '$scope', ] }] |
||
no-proto | off | error | error | |
no-redeclare | error | error | error | |
no-restricted-properties | off | ['error', { object: 'arguments', property: 'callee', message: 'arguments.callee is deprecated', }, { property: '__defineGetter__', message: 'Please use Object.defineProperty instead.', }, { property: '__defineSetter__', message: 'Please use Object.defineProperty instead.', }, { object: 'Math', property: 'pow', message: 'Use the exponentiation operator (**) instead.', }] |
||
no-return-assign | off | ['error', 'always'] | ["error", "except-parens"] | |
no-return-await | off | error | error | |
no-script-url | off | error | ||
no-self-assign | error | error | error | |
no-self-compare | off | error | error | |
no-sequences | off | error | error | |
no-throw-literal | off | 2 | error | error |
no-unmodified-loop-condition | off | off | error | |
no-unused-expressions | off | ['error', { allowShortCircuit: false, allowTernary: false, allowTaggedTemplates: false, }] |
["error", { "allowShortCircuit": true, "allowTernary": true, "allowTaggedTemplates": true }] | |
no-unused-labels | error | error | ||
no-useless-call | off | off | error | |
no-useless-concat | off | error | ||
no-useless-escape | error | error | error | |
no-useless-return | off | eror | error | |
no-void | off | error | ||
no-warning-comments | off | ['off', { terms: ['todo', 'fixme', 'xxx'], location: 'start' }] | ||
no-with | off | 2 | error | error |
prefer-promise-reject-errors | off | ['off', { allowEmptyReject: true }] | error | |
radix | off | error | ||
require-await | off | off | ||
vars-on-top | off | error | ||
wrap-iife | off | ['error', 'outside', { functionPrototypeMethods: false }] | ["error", "any", { "functionPrototypeMethods": true }] | |
yoda | off | error | ["error", "never"] |
Strict Mode
rule | eslint: recommended |
airbnb | standard | |
---|---|---|---|---|
strict | off | ['error', 'never'] |
Variables
rule | eslint: recommended |
airbnb | standard | |
---|---|---|---|---|
init-declarations | off | off | ||
no-catch-shadow | off | off | ||
no-delete-var | error | error | errorf | |
no-label-var | off | error | error | |
no-restricted-globals | off | ['off'].concat(restrictedGlobals) | ||
no-shadow | off | error | ||
no-shadow-restricted-names | off | error | error | |
no-undef | error | error | error | |
no-undef-init | off | error | error | |
no-undefined | off | off | ||
no-unused-vars | error | [2, {args: 'none'}] | ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }] | ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": true }] |
no-use-before-define | off | ['error', { functions: true, classes: true, variables: true }] | ["error", { "functions": false, "classes": false, "variables": false }] |
Node.js and CommonJS
rule | eslint: recommended |
airbnb | standard | |
---|---|---|---|---|
cllback-return | off | off | ||
global-require | off | error | ||
handle-callback-err | off | off | ["error", "^(err | |
no-buffer-constructor | off | off | ||
no-mixed-requires | off | ['off', false] | ||
no-new-require | off | error | error | |
no-path-concat | off | error | error | |
no-process-env | off | off | ||
no-process-exit | off | off | ||
no-restricted-modules | off | off | ||
no-sync | off | off |
Stylistic Issues
rule | eslint: recommended |
airbnb | standard | |
---|---|---|---|---|
array-bracket-newline | off | 0 | ['off', { multiline: true, minItems: 3 }] | |
array-bracket-spacing | off | [2, 'never'] | ['error', 'never'] | |
array-element-newline | off | 0 | ['off', { multiline: true, minItems: 3 }] | |
block-spacing | off | [2, 'never'] | ['error', 'always'] | ["error", "always"] |
brace-style | off | 2 | ['error', '1tbs', { allowSingleLine: true }] | ["error", "1tbs", { "allowSingleLine": true }] |
camelcase | off | [2, {properties: 'never'}] | ['error', { properties: 'never' }], | ["error", { "properties": "never" }] |
capitalized-comments | off | ['off', 'never', { line: { ignorePattern: '.*', ignoreInlineComments: true, ignoreConsecutiveComments: true, }, block: { ignorePattern: '.*', ignoreInlineComments: true, ignoreConsecutiveComments: true, }, }] |
||
comma-dangle | off | [2, 'always-multiline'] | ['error', { arrays: 'always-multiline', objects: 'always-multiline', imports: 'always-multiline', exports: 'always-multiline', functions: 'always-multiline', }] |
["error", { "arrays": "never", "objects": "never", "imports": "never", "exports": "never", "functions": "never" }] |
comma-spacing | off | 2 | ['error', { before: false, after: true }] | ["error", { "before": false, "after": true }] |
comma-style | off | 2 | ['error', 'last'] | ["error", "last"] |
computed-property-spacing | off | 2 | ['error', 'never'] | |
consistent-this | off | off | ||
eol-last | off | 2 | ['error', 'always'] | error |
func-call-spacing | off | 2 | ['error', 'never'] | ["error", "never"] |
func-name-matching | off | ['off', 'always', { includeCommonJSModuleExports: false }] |
||
func-names | off | warn | ||
func-style | off | ['off', 'expression'] | ||
id-blacklist | off | off | ||
id-length | off | off | ||
id-match | off | off | ||
indent | off | ['error', 2, { SwitchCase: 1, VariableDeclarator: 1, outerIIFEBody: 1, FunctionDeclaration: { parameters: 1, body: 1 }, FunctionExpression: { parameters: 1, body: 1 } }] |
["error", 2, { "SwitchCase": 1 }] | |
jsx-quotes | off | ['off', 'prefer-double'] | ||
key-spacing | off | 2 | ['error', { beforeColon: false, afterColon: true }] | ["error", { "beforeColon": false, "afterColon": true }] |
keyword-spacing | off | 2 | ['error', { before: true, after: true, overrides: { return: { after: true }, throw: { after: true }, case: { after: true } } }] |
["error", { "before": true, "after": true }] |
line-comment-position | off | ['off', { position: 'above', ignorePattern: '', applyDefaultPatterns: true, }] |
||
linebreak-style | off | 2 | ['error', 'unix'] | |
lines-around-comment | off | off | ||
max-depth | off | ['off', 4] | ||
max-len | off | [2, { code: 80, tabWidth: 2, ignoreUrls: true, ignorePattern: '^goog.(module|require)', }] |
['error', 100, 2, { ignoreUrls: true, ignoreComments: false, ignoreRegExpLiterals: true, ignoreStrings: true, ignoreTemplateLiterals: true, }] |
|
max-lines | off | ['off', { max: 300, skipBlankLines: true, skipComments: true }] |
||
max-nested-callbacks | off | off | ||
max-params | off | ['off', 3] | ||
max-statements | off | ['off', 10] | ||
max-statements-per-line | off | ['off', { max: 1 }] | ||
multiline-ternary | off | ['off', 'never'] | ||
new-cap | off | 2 | ['error', { newIsCap: true, newIsCapExceptions: [], capIsNew: false, capIsNewExceptions: ['Immutable.Map', 'Immutable.Set', 'Immutable.List'], }] |
["error", { "newIsCap": true, "capIsNew": false }] |
new-parens | off | error | error | |
newline-per-chained-call | off | ['error', { ignoreChainWithDepth: 4 }] | ||
no-array-constructor | off | 2 | error | error |
no-bitwise | off | error | ||
no-continue | off | error | ||
no-inline-comments | off | off | ||
no-lonely-if | off | error | ||
no-mixed-operators | off | ['error', { groups: [ ['+', '-', '*', '/', '%', '**'], ['&', '|', '^', '~', '<<', '>>', '>>>'], ['==', '!=', '===', '!==', '>', '>=', '<', '<='], ['&&', '||'], ['in', 'instanceof'] ], allowSamePrecedence: false }] |
["error", { "groups": [ ["==", "!=", "===", "!==", ">", ">=", "<", "<="], ["&&", " |
|
no-mixed-spaces-and-tabs | error | 2 | error | error |
no-multi-assign | off | error | ||
no-multiple-empty-lines | off | [2, {max: 2}] | ['error', { max: 2, maxEOF: 1 }] | ["error", { "max": 1, "maxEOF": 0 }] |
no-negated-condition | off | off | ||
no-nested-ternary | off | error | ||
no-new-object | off | 2 | error | error |
no-plusplus | off | error | ||
no-restricted-syntax | off | [ 'error', { selector: 'ForInStatement', message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.', }, { selector: 'ForOfStatement', message: 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.', }, { selector: 'LabeledStatement', message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.', }, { selector: 'WithStatement', message: ' with is disallowed in strict mode because it makes code impossible to predict and optimize.',}, ] |
||
no-tabs | off | 2 | error | error |
no-ternary | off | off | ||
no-trailing-spaces | off | 2 | ['error', { skipBlankLines: false, }] |
error |
no-underscore-dangle | off | ['error', { allow: [], allowAfterThis: false, allowAfterSuper: false, }] |
||
no-unneeded-ternary | off | ['error', { defaultAssignment: false }] | ["error", { "defaultAssignment": false }] | |
no-whitespace-before-property | off | error | error | |
nonblock-statement-body-position | off | off | ||
object-curly-newline | off | ['off', { ObjectExpression: { minProperties: 3, multiline: true, consistent: true }, ObjectPattern: { minProperties: 3, multiline: true, consistent: true } }] |
||
object-curly-spacing | off | 2 | ['error', 'always'] | |
object-property-newline | off | ['error', { allowMultiplePropertiesPerLine: true, }] |
["error", { "allowMultiplePropertiesPerLine": true }] | |
one-var | off | [2, { var: 'never', let: 'never', const: 'never', }] |
['error', 'never'] | ["error", { "initialized": "never" }] |
one-var-declaration-per-line | off | ['error', 'always'] | ||
operator-assignment | off | ['error', 'always'] | ||
operator-linebreak | off | off | ["error", "after", { "overrides": { "?": "before", ":": "before" } }] | |
padded-blocks | off | [2, 'never'] | ['error', 'never'] | ["error", { "blocks": "never", "switches": "never", "classes": "never" }] |
padding-line-between-statements | off | off | ||
quote-props | off | [2, 'consistent'] | ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }] | |
quotes | off | [2, 'single', {allowTemplateLiterals: true}] | ['error', 'single', { avoidEscape: true }] | ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }] |
require-jsdoc | off | [2, { require: { FunctionDeclaration: true, MethodDefinition: true, ClassDeclaration: true, }, }] |
off | |
semi | off | 2 | ['error', 'always'] | ["error", "never"] |
semi-spacing | off | 2 | ['error', { before: false, after: true }] | ["error", { "before": false, "after": true }] |
semi-style | off | ['off', 'last'] | ||
sort-keys | off | ['off', 'asc', { caseSensitive: false, natural: true }] | ||
sort-vars | off | off | ||
space-before-blocks | off | 2 | error | ["error", "always"] |
space-before-function-paren | off | [2, { asyncArrow: 'always', anonymous: 'never', named: 'never', }] |
['error', { anonymous: 'always', named: 'never', asyncArrow: 'always' }] |
["error", "always"] |
space-in-parens | off | ['error', 'never'] | ["error", "never"] | |
space-infix-ops | off | error | error | |
space-unary-ops | off | ['error', { words: true, nonwords: false, overrides: { }, }] |
["error", { "words": true, "nonwords": false }] | |
spaced-comment | off | [2, 'always'] | sp; }, block: { exceptions: ['-', '+'], markers: ['=', '!'], // space here to support sprockets directives balanced: true, } }] |
["error", "always", { "line": { "markers": ["*package", "!", "/", ","] }, "block": { "balanced": true, "markers": ["package", "!", ",", ":", "::", "flow-include"], "exceptions": [""] } }] |
switch-colon-spacing | off | 2 | ['off', { after: true, before: false }] | |
template-tag-spacing | off | ['off', 'never'] | ["error", "never"] | |
unicode-bom | off | ['error', 'never'] | ["error", "never"] | |
wrap-regex | off | off |
ECMAScript 6
rule | eslint: recommended |
airbnb | standard | |
---|---|---|---|---|
arrow-body-style | off | ['error', 'as-needed', { requireReturnForObjectLiteral: false, }] |
||
arrow-parens | off | [2, 'always'] | ['error', 'as-needed', { requireForBlockBody: true, }] |
|
arrow-spacing | off | ['error', { before: true, after: true }] | ["error", { "before": true, "after": true }] | |
constructor-super | error | 2 | error | error |
generator-star-spacing | off | [2, 'after'] | ['error', { before: false, after: true }] | ["error", { "before": true, "after": true }] |
no-class-assign | error | error | error | |
no-confusing-arrow | off | ['error', { allowParens: true, }] |
||
no-const-assign | error | error | error | |
no-dupe-class-members | error | error | error | |
no-duplicate-imports | off | off | ||
no-new-symbol | error | 2 | error | error |
no-restricted-imports | off | off | ||
no-this-before-super | error | 2 | error | error |
no-useless-computed-key | off | error | error | |
no-useless-constructor | off | error | error | |
no-useless-rename | off | ['error', { ignoreDestructuring: false, ignoreImport: false, ignoreExport: false, }] |
error | |
no-var | off | 2 | error | |
object-shorthand | off | ['error', 'always', { ignoreConstructors: false, avoidQuotes: true, }] |
||
prefer-arrow-callback | off | ['error', { allowNamedFunctions: false, allowUnboundThis: true, }] |
||
prefer-const | off | ['error', { destructuring: 'any', ignoreReadBeforeAssign: true, }] |
||
prefer-destructuring | off | ['off', { VariableDeclarator: { array: false, object: true, }, AssignmentExpression: { array: true, object: true, }, }, { enforceForRenamedProperties: false, }] |
||
prefer-numeric-literals | off | error | ||
prefer-rest-params | off | 2 | error | |
prefer-spread | off | 2 | error | |
prefer-template | off | error | ||
require-yield | error | error | ||
rest-spread-spacing | off | 2 | ['error', 'never'] | ["error", "never"] |
sort-imports | off | ['off', { ignoreCase: false, ignoreMemberSort: false, memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], }] |
||
symbol-description | off | error | error | |
template-curly-spacing | off | error | ["error", "never"] | |
yield-star-spacing | off | [2, 'after'] | ['error', 'after'] | ["error", "both"] |