eslint-config-precure
Version:
ESLint shareable config for precure
209 lines (200 loc) • 5.48 kB
JavaScript
/* eslint-disable unicorn/prevent-abbreviations */
// @flow
module.exports = {
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2019,
sourceType: 'module',
ecmaFeatures: {
experimentalObjectRestSpread: true,
},
},
env: {
browser: true,
node: true,
es6: true,
},
extends: [
'./best-practices.js',
'./possible-errors.js',
'./stylistic.js',
'./import.js',
'./unicorn.js',
'prettier',
],
plugins: ['prettier'],
rules: {
'prettier/prettier': 2,
// rules
'no-var': 2,
'object-shorthand': [2, 'always'],
'prefer-arrow-callback': 0,
'prefer-const': [2, { destructuring: 'all' }],
'prefer-numeric-literals': 2,
'prefer-rest-params': 2,
'prefer-spread': 2,
'no-compare-neg-zero': 2,
'no-cond-assign': 2,
'no-constant-condition': 2,
'no-control-regex': 2,
'no-debugger': 2,
'no-dupe-args': 2,
'no-dupe-keys': 2,
'no-duplicate-case': 2,
'no-empty-character-class': 2,
'no-empty': [2, { allowEmptyCatch: true }],
'no-ex-assign': 2,
'no-extra-boolean-cast': 2,
// 'no-extra-semi': 2,
'no-func-assign': 2,
'no-inner-declarations': 2,
'no-invalid-regexp': 2,
'no-irregular-whitespace': 2, // prettier?
'no-obj-calls': 2,
'no-prototype-builtins': 2,
'no-regex-spaces': 2,
'no-sparse-arrays': 2,
'no-template-curly-in-string': 2,
'no-unreachable': 2,
'no-unsafe-finally': 2,
'no-unsafe-negation': 2,
'use-isnan': 2,
'valid-typeof': [2, { requireStringLiterals: true }],
'no-unexpected-multiline': 0,
'accessor-pairs': 2,
'array-callback-return': 2,
'block-scoped-var': 2,
complexity: 1,
// http://eslint.org/docs/rules/class-methods-use-this
'class-methods-use-this': [2, { exceptMethods: [] }],
'consistent-return': 2,
curly: 2,
'default-case': 2,
'dot-notation': 2,
'dot-location': 0,
eqeqeq: 2,
'guard-for-in': 2,
'no-alert': 2,
'no-caller': 2,
'no-case-declarations': 2,
'no-else-return': 2,
'no-empty-pattern': 2,
'no-eq-null': 2,
'no-eval': 2,
'no-extend-native': 2,
'no-extra-bind': 2,
'no-extra-label': 2,
'no-fallthrough': 2,
'no-global-assign': 2,
'no-implicit-coercion': 2,
'no-implied-eval': 2,
'no-iterator': 2,
'no-labels': 2,
'no-lone-blocks': 2,
'no-loop-func': 2,
'no-multi-str': 2,
'no-new-func': 2,
'no-new-wrappers': 2,
'no-new': 2,
'no-new-require': 2,
'no-octal-escape': 2,
'no-octal': 2,
'no-proto': 2,
'no-redeclare': 2,
'no-return-assign': [2, 'always'],
'no-return-await': 2,
'no-script-url': 2,
'no-self-assign': [2, { props: true }],
'no-self-compare': 2,
'no-sequences': 2,
'no-throw-literal': 2,
'no-unmodified-loop-condition': 2,
'no-unused-expressions': 2,
'no-unused-labels': 2,
'no-useless-call': 2,
'no-useless-concat': 2,
'no-useless-escape': 2,
'no-useless-return': 2,
'no-void': 2,
'no-warning-comments': 1,
'no-with': 2,
'prefer-promise-reject-errors': [2, { allowEmptyReject: true }],
radix: 2,
// 'wrap-iife': [2, 'inside', {functionPrototypeMethods: true}],
yoda: 2,
'no-delete-var': 2,
'no-label-var': 2,
'no-restricted-globals': [2, 'event'],
'no-shadow-restricted-names': 2,
'no-undef-init': 2,
'no-undef': [2, { typeof: true }],
'no-unused-vars': [
2,
{ argsIgnorePattern: '^_+$', ignoreRestSiblings: true },
],
'no-use-before-define': [2, 'nofunc'],
'no-mixed-requires': [2, { grouping: true, allowCall: true }],
'no-path-concat': 2,
// don't use these
'no-restricted-imports': [
'error',
'domain',
'freelist',
'smalloc',
'sys',
'colors',
],
'no-restricted-modules': [
'error',
'domain',
'freelist',
'smalloc',
'sys',
'colors',
],
camelcase: [2, { properties: 'always' }],
'func-name-matching': 2,
'func-names': [2, 'never'],
'linebreak-style': 0,
'max-depth': 1,
'max-nested-callbacks': [1, 4],
'max-params': [1, { max: 4 }],
'new-cap': [2, { newIsCap: true, capIsNew: true }],
'no-array-constructor': 2,
'no-lonely-if': 2,
// https://github.com/prettier/eslint-config-prettier#no-mixed-operators
'no-mixed-operators': 0,
'no-mixed-spaces-and-tabs': 0,
'no-multi-assign': 2,
'no-negated-condition': 2,
'no-new-object': 2,
'no-restricted-syntax': [2, 'WithStatement'],
'no-unneeded-ternary': 2,
'one-var': [2, 'never'],
'one-var-declaration-per-line': 0,
'operator-assignment': [2, 'always'],
'spaced-comment': [
2,
'always',
{
line: { exceptions: ['-'] },
block: { markers: ['!'], balanced: true },
},
],
'no-class-assign': 2,
'no-useless-computed-key': 2,
'no-useless-constructor': 2,
'no-useless-rename': 2,
'require-yield': 2,
'symbol-description': 2,
'template-curly-spacing': 0,
'no-process-exit': 0, // use unicorn/no-process-exit
'max-classes-per-file': [2, 1], // 1つのファイルに1つのクラス
'max-lines-per-function': 2, // 1つの関数は50行以内
'no-async-promise-executor': 2,
'no-misleading-character-class': 2,
'require-atomic-updates': 2,
'require-unicode-regexp': 2,
'no-useless-catch': 2,
},
}