eslint-config-chain-able
Version:
an opinionated ESLint configuration
313 lines (279 loc) • 9.44 kB
JavaScript
module.exports = {
extends: ['supermind', 'google'],
plugins: [
'prettier',
'react',
'no-for-each',
'flowtype',
'prefer-includes',
'jest',
'jsdoc',
// 'plugin:inferno/recommended'
// 'inferno',
],
parser: 'babel-eslint',
env: {
node: true,
browser: true,
es6: true,
worker: true,
serviceworker: true,
},
globals: {
test: true,
before: true,
beforeEach: true,
describe: true,
it: true,
afterEach: true,
context: true,
},
rules: {
strict: 'OFF',
'func-names': 'OFF',
'import/no-extraneous-dependencies': 'warn',
// https://github.com/airbnb/javascript#functions--signature-spacing
// http://eslint.org/docs/rules/space-before-blocks
'arrow-spacing': [
'error',
{
before: true,
after: true,
},
],
// @NOTE: triggers for all .indexOf so that needs work, thus is 1 not 2
// https://github.com/sindresorhus/eslint-plugin-unicorn/pull/70
// https://github.com/iambrandonn/eslint-plugin-contains
// https://github.com/eslint/eslint/issues/4209
// https://github.com/wix/eslint-plugin-lodash/issues/46
// do not use .contains
// ['error', 'always']
'prefer-includes/prefer-includes': 1,
// https://github.com/airbnb/javascript#comments--spaces
// http://eslint.org/docs/rules/spaced-comment
// 'spaced-comment': ['error', 'always'],
'spaced-comment': ['off'],
'lines-around-comment': ['off'],
// https://github.com/airbnb/javascript#whitespace--before-blocks
// http://eslint.org/docs/rules/space-before-blocks
'space-before-blocks': [
'error',
{
functions: 'always',
keywords: 'always',
classes: 'always',
},
],
'no-trailing-spaces': ['error', {skipBlankLines: true}],
'no-unreachable': 1,
// https://github.com/airbnb/javascript#naming--camelCase
// http://eslint.org/docs/rules/camelcase
camelcase: 1,
// for loop fixing
// @NOTE: toggle these between 0 & 2 for fixing or not
// or use /* eslint-disable */ for immutables
'no-for-each/no-for-each': 0,
'no-for-each/no-for-in': 0,
'no-for-each/no-for-of': 0,
// common goodness
'no-underscore-dangle': 0,
'no-mixed-requires': 0,
'no-process-exit': 0,
'no-warning-comments': 0,
curly: 0,
'no-multi-spaces': 0,
'no-alert': 1,
// http://eslint.org/docs/rules/comma-dangle
// 'comma-dangle': ['error', 'always-multiline'],
'keyword-spacing': [
2,
{
before: true,
after: true,
},
],
'space-before-function-paren': ['error', 'never'],
semi: ['error', 'never'],
// http://eslint.org/docs/rules/object-curly-spacing
'object-curly-spacing': ['error', 'never'],
'space-infix-ops': ['error', {int32Hint: false}],
'new-cap': 0,
'no-spaced-func': 2,
'semi-spacing': 2,
'key-spacing': [2],
indent: ['error', 2, {SwitchCase: 1}],
// indent: 'OFF',
// es6 ---------
// https://github.com/airbnb/javascript#objects
'object-shorthand': [
'warn',
'always',
{
// @NOTE: still works, but looks weird
avoidQuotes: true,
},
],
// http://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html
// http://eslint.org/docs/rules/func-style
// 'disallowFunctionDeclarations': 1,
'func-style': [
'error',
'declaration',
{
allowArrowFunctions: true,
},
],
// https://github.com/airbnb/javascript#functions--reassign-params
// http://eslint.org/docs/rules/no-param-reassign.html
'no-param-reassign': 1,
// https://github.com/airbnb/javascript#functions
// http://eslint.org/docs/rules/prefer-rest-params
'prefer-rest-params': 2,
'no-loop-func': 2,
// https://github.com/airbnb/javascript#functions
// https://github.com/eslint/eslint/blob/master/docs/rules/eol-last.md
// https://github.com/airbnb/javascript#whitespace--newline-at-end
// ['error', 'always']
'eol-last': 2,
// @TODO:
// https://github.com/airbnb/javascript#es6-styles
//
// https://github.com/airbnb/javascript#arrows--one-arg-parens
// https://github.com/airbnb/javascript#constructors--no-useless
// https://github.com/airbnb/javascript#modules--no-wildcard
// https://github.com/airbnb/javascript#modules--no-duplicate-imports
// https://github.com/airbnb/javascript#modules--multiline-imports-over-newlines
// https://github.com/airbnb/javascript#hoisting--about
// https://github.com/airbnb/javascript#comparison--nested-ternaries
// https://github.com/airbnb/javascript#blocks--cuddled-elses
// https://github.com/airbnb/javascript#comments--multiline
// https://github.com/airbnb/javascript#whitespace--chains
// https://github.com/airbnb/javascript#whitespace--after-blocks
// http://jscs.info/rule/disallowNodeTypes
// https://github.com/airbnb/javascript#whitespace--padded-blocks
// 'padded-blocks': ['error', 'always'],
'padded-blocks': ['error', 'never'],
// https://github.com/airbnb/javascript#whitespace--in-parens
// http://eslint.org/docs/rules/space-in-parens.html
'space-in-parens': ['error', 'never'],
// https://github.com/airbnb/javascript#whitespace--in-brackets
'array-bracket-spacing': ['error', 'never'],
// https://github.com/airbnb/javascript#whitespace--max-len
'max-len': [
'warn',
{
code: 80,
ignoreComments: true,
ignoreUrls: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
},
],
// https://github.com/airbnb/javascript#naming--self-this
// nananenano/tsk-tsk ---
'no-debugger': 1,
'no-empty': 2,
'no-invalid-regexp': 1,
'no-unused-expressions': 1,
'no-native-reassign': 1,
'no-fallthrough': 1,
'no-undef': 2,
'no-dupe-keys': 2,
'no-empty-character-class': 2,
'no-self-compare': 2,
'valid-typeof': 2,
'no-unused-vars': 1,
'handle-callback-err': 2,
'no-shadow-restricted-names': 2,
'no-new-require': 2,
'no-mixed-spaces-and-tabs': 2,
'no-console': 0,
quotes: [1, 'single', {allowTemplateLiterals: true}],
// -------------- import export
// https://twitter.com/dan_abramov/status/716219619330154496
// 'import/no-unresolved': [2, {commonjs: true, amd: true}],
// 'import/named': 2,
// 'import/namespace': 2,
// 'import/default': 2,
// 'import/export': 2,
// flow ---
// 'flowtype-errors/show-errors': 1,
'flowtype/boolean-style': [2, 'boolean'],
'flowtype/define-flow-type': 1,
'flowtype/delimiter-dangle': [0, 'never'],
'flowtype/generic-spacing': [2, 'never'],
'flowtype/no-primitive-constructor-types': 2,
'flowtype/object-type-delimiter': [2, 'comma'],
// is often wrong for jsdocs
'flowtype/require-valid-file-annotation': 'off',
'flowtype/space-after-type-colon': [2, 'always'],
'flowtype/space-before-generic-bracket': [2, 'never'],
'flowtype/space-before-type-colon': [2, 'never'],
'flowtype/union-intersection-spacing': [2, 'always'],
'flowtype/use-flow-type': 1,
'flowtype/valid-syntax': 1,
// rules I didn't like that extended
// 'newline-per-chained-call': ['error', {ignoreChainWithDepth: 2}],
'require-jsdoc': 0,
'class-methods-use-this': 0,
'no-process-env': 0,
'prefer-reflect': 0,
'no-continue': 0,
'nonblock-statement-body-position': 0,
'prefer-destructuring': 0,
'brace-style': ['error', 'stroustrup', {allowSingleLine: true}],
'prefer-template': 0,
'global-require': 0,
'no-invalid-this': 'off',
// suggest using the spread operator instead of .apply()
// https://github.com/airbnb/javascript#functions--spread-vs-apply
// http://eslint.org/docs/rules/prefer-spread
'prefer-const': 'off',
'no-undefined': 'off',
'prefer-spread': 'off',
'no-implicit-coercion': 'off',
'arrow-body-style': 'off',
'arrow-parens': 'off',
'no-bitwise': 'off',
'no-return-assign': 'off',
'no-var': 'off',
'func-names': 'off',
// on node only...
// 'import/no-dynamic-require': 'warn',
'comma-dangle': [
'error',
{
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'never',
},
],
// 'ava/assertion-arguments': 'error',
// 'ava/no-async-fn-without-await': 'error',
// 'ava/no-cb-test': 'error',
// 'ava/no-duplicate-modifiers': 'error',
// 'ava/no-identical-title': 'error',
// 'ava/no-ignored-test-files': 'error',
// 'ava/no-invalid-end': 'error',
// 'ava/no-nested-tests': 'error',
// 'ava/no-only-test': 'error',
// 'ava/no-skip-assert': 'error',
// 'ava/no-skip-test': 'error',
// 'ava/no-statement-after-end': 'error',
// 'ava/no-todo-implementation': 'error',
// 'ava/no-todo-test': 'warn',
// 'ava/no-unknown-modifiers': 'error',
// 'ava/prefer-async-await': 'error',
// 'ava/prefer-power-assert': 'off',
// 'ava/test-ended': 'error',
// 'ava/test-title': ['error', 'if-multiple'],
// 'ava/use-test': 'error',
},
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: false,
},
},
}