eslint-config-jhh
Version:
JHH ESLint config
142 lines (113 loc) • 4.25 kB
JavaScript
/**
* These rules relate to ES6, also known as ES2015
*
* @see http://eslint.org/docs/rules/#ecmascript-6
*/
module.exports = {
env: {
es6: true
},
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
generators: false
}
},
rules: {
// require braces around arrow function bodies
'arrow-body-style': ['warn', 'as-needed', {
requireReturnForObjectLiteral: false
}],
// require parentheses around arrow function arguments
'arrow-parens': ['warn', 'as-needed', {
requireForBlockBody: true
}],
// enforce consistent spacing before and after the arrow in arrow
// functions
'arrow-spacing': ['warn', {
before: true,
after: true
}],
// require super() calls in constructors
'constructor-super': 'error',
// enforce consistent spacing around * operators in generator functions
'generator-star-spacing': ['warn', {
before: false,
after: true
}],
// disallow reassigning class members
'no-class-assign': 'error',
// disallow arrow functions where they could be confused with
// comparisons
'no-confusing-arrow': ['warn', {
allowParens: true
}],
// disallow reassigning const variables
// ... or else wtf does const mean?
'no-const-assign': 'error',
// disallow duplicate class members
// Jesus...
'no-dupe-class-members': 'error',
// disallow duplicate module imports
// Idiot proofing
'no-duplicate-imports': 'error',
// disallow new operators with the Symbol object
'no-new-symbol': 'error',
// disallow this/super before calling super() in constructors
'no-this-before-super': 'error',
// disallow unnecessary constructors
'no-useless-constructor': 'warn',
// disallow renaming import, export, and destructured assignments to
// the same name
// More idiot proofing
'no-useless-rename': ['error', {
ignoreImport: false,
ignoreExport: false,
ignoreDestructuring: false
}],
// require let or const instead of var
'no-var': 'warn',
// require or disallow method and property shorthand syntax for
// object literals
'object-shorthand': ['warn', 'consistent-as-needed'],
// require arrow functions as callbacks
'prefer-arrow-callback': ['warn', {
allowNamedFunctions: false,
allowUnboundThis: true
}],
// require const declarations for variables that are never reassigned
// after declared
'prefer-const': ['warn', {
destructuring: 'any',
ignoreReadBeforeAssign: true
}],
// disallow parseInt() in favor of binary, octal, and hexadecimal
// literals
'prefer-numeric-literals': 'warn',
// require rest parameters instead of arguments
'prefer-rest-params': 'error',
// require spread operators instead of .apply()
'prefer-spread': 'error',
// require template literals instead of string concatenation
'prefer-template': 'error',
// require generator functions to contain yield
'require-yield': 'error',
// enforce spacing between rest and spread operators and their
// expressions
'rest-spread-spacing': ['error', 'never'],
// enforce sorted import declarations within modules
'sort-imports': ['off', {
ignoreCase: false,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single']
}],
// require symbol descriptions
'symbol-description': 'error',
// require or disallow spacing around embedded expressions of
// template strings
'template-curly-spacing': ['error', 'never'],
// require or disallow spacing around the * in yield* expressions
'yield-star-spacing': ['error', 'after']
}
}