eslint-config-kentcdodds
Version:
ESLint rules according to kentcdodds' personal preference
110 lines (109 loc) • 3.86 kB
JavaScript
module.exports = {
env: {
browser: true,
node: true,
},
rules: {
'array-bracket-spacing': [2, 'never'],
'arrow-parens': [2, 'as-needed'],
'block-spacing': 2,
'brace-style': [2, '1tbs'],
camelcase: [2, {properties: 'always'}],
'capitalized-comments': 0, // wHO CaRes?
'comma-dangle': [
2,
{
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'always-multiline',
},
],
'comma-spacing': [2, {before: false, after: true}],
'comma-style': [2, 'last'],
'computed-property-spacing': [2, 'never'],
'consistent-this': 0, // Too many use-cases for reassigning "this" to different values
'eol-last': 2,
'func-call-spacing': [2, 'never'],
'func-names': 2,
'func-name-matching': 2,
'func-style': [2, 'declaration'],
'generator-star-spacing': [2, 'after'],
'id-blacklist': 2,
'init-declarations': 0,
'id-length': 0, // when using short composable functions, using single-letter variables is fine
'id-match': [
2,
// camelCase, PascalCase, __filename, CONST_VALUE, stream$, $el
'^\\$?(__)?(([A-Z]|[a-z]|[0-9]+)|([A-Z_]))*\\$?$',
],
indent: [2, 2, {SwitchCase: 1}],
'jsx-quotes': [2, 'prefer-double'],
'key-spacing': [2, {beforeColon: false, afterColon: true}],
'keyword-spacing': [2, {before: true, after: true}],
'linebreak-style': [2, 'unix'],
'line-comment-position': 0,
'lines-around-comment': 0,
'lines-around-directive': 0,
'max-depth': [2, 4],
'max-len': [2, 120, 2],
'max-lines': [2, {max: 500, skipBlankLines: false, skipComments: false}],
'max-nested-callbacks': [2, 5],
'max-params': [2, 5],
'max-statements-per-line': [2, {max: 1}],
'max-statements': [2, 30],
'multiline-ternary': 0,
'new-cap': 2,
'new-parens': 2,
'newline-after-var': 0,
'newline-before-return': 0,
'newline-per-chained-call': 0,
'no-array-constructor': 2,
'no-bitwise': 2,
'no-continue': 2,
'no-inline-comments': 0,
'no-lonely-if': 2,
'no-mixed-spaces-and-tabs': 2,
'no-multi-assign': 2, // it's handy, but harder to read
'no-multiple-empty-lines': 0,
'no-negated-condition': 2,
'no-nested-ternary': 2,
'no-new-object': 2,
'no-plusplus': 0,
'no-spaced-func': 2,
'no-tabs': 2,
'no-ternary': 0,
'no-trailing-spaces': [2, {skipBlankLines: true}],
'no-underscore-dangle': 0,
'no-unneeded-ternary': 2,
'no-whitespace-before-property': 2,
'nonblock-statement-body-position': 0,
'object-curly-newline': 0, // couldn't figure out how to configure it the way I want :-(
'object-curly-spacing': 0, // babel/object-curly-spacing
'object-property-newline': 0,
'object-shorthand': [2, 'properties'], // methods are optional so you can specify a name if you want
'one-var-declaration-per-line': 2,
'one-var': [2, {uninitialized: 'always', initialized: 'never'}],
'operator-assignment': 0, // readability on a case-by-case basis
'operator-linebreak': [2, 'after'],
'padded-blocks': 0,
'prefer-destructuring': 0, // nah, I like it, but not that much...
quotes: [2, 'single', {avoidEscape: true, allowTemplateLiterals: true}],
'quote-props': [2, 'as-needed'],
'require-jsdoc': 0,
'template-tag-spacing': [2, 'never'],
'semi-spacing': [2, {before: false, after: true}],
semi: [2, 'never'],
'sort-keys': 0,
'sort-vars': 0,
'space-before-blocks': [2, 'always'],
'space-before-function-paren': [2, 'never'],
'space-in-parens': [2, 'never'],
'space-infix-ops': 2,
'space-unary-ops': [2, {words: true, nonwords: false}],
'spaced-comment': 0,
'unicode-bom': [2, 'never'],
'wrap-regex': 0,
},
}