|
| 1 | +const prettierPlugin = require('eslint-plugin-prettier'); |
| 2 | + |
| 3 | +module.exports = [ |
| 4 | + { |
| 5 | + ignores: ['coverage/**'], |
| 6 | + }, |
| 7 | + { |
| 8 | + languageOptions: { |
| 9 | + ecmaVersion: 2017, |
| 10 | + globals: { |
| 11 | + __dirname: 'readonly', |
| 12 | + __filename: 'readonly', |
| 13 | + console: 'readonly', |
| 14 | + process: 'readonly', |
| 15 | + Buffer: 'readonly', |
| 16 | + setImmediate: 'readonly', |
| 17 | + clearImmediate: 'readonly', |
| 18 | + setTimeout: 'readonly', |
| 19 | + clearTimeout: 'readonly', |
| 20 | + setInterval: 'readonly', |
| 21 | + clearInterval: 'readonly', |
| 22 | + require: 'readonly', |
| 23 | + module: 'writable', |
| 24 | + exports: 'writable', |
| 25 | + global: 'readonly', |
| 26 | + Promise: 'readonly', |
| 27 | + Map: 'readonly', |
| 28 | + Set: 'readonly', |
| 29 | + Symbol: 'readonly', |
| 30 | + WeakMap: 'readonly', |
| 31 | + WeakSet: 'readonly', |
| 32 | + Reflect: 'readonly', |
| 33 | + }, |
| 34 | + }, |
| 35 | + plugins: { |
| 36 | + prettier: prettierPlugin, |
| 37 | + }, |
| 38 | + rules: { |
| 39 | + 'prettier/prettier': 'error', |
| 40 | + 'max-len': ['error', {code: 100}], |
| 41 | + 'array-bracket-spacing': ['error', 'never'], |
| 42 | + 'brace-style': ['error', '1tbs'], |
| 43 | + camelcase: 'error', |
| 44 | + 'comma-style': ['error', 'last'], |
| 45 | + 'computed-property-spacing': ['error', 'never'], |
| 46 | + 'consistent-this': ['error', 'self'], |
| 47 | + curly: ['warn', 'multi-line'], |
| 48 | + 'dot-notation': 'error', |
| 49 | + 'eol-last': 'error', |
| 50 | + eqeqeq: ['error', 'smart'], |
| 51 | + 'key-spacing': 'warn', |
| 52 | + 'new-cap': ['error', {capIsNew: false}], |
| 53 | + 'no-console': 'warn', |
| 54 | + 'no-floating-decimal': 'error', |
| 55 | + 'no-inner-declarations': 'error', |
| 56 | + 'no-mixed-spaces-and-tabs': 'error', |
| 57 | + 'no-redeclare': 'error', |
| 58 | + 'no-shadow': 'warn', |
| 59 | + 'no-spaced-func': 'error', |
| 60 | + 'no-trailing-spaces': 'error', |
| 61 | + 'no-undef': 'error', |
| 62 | + 'no-underscore-dangle': 'off', |
| 63 | + 'no-unused-vars': ['error', {vars: 'all', args: 'after-used'}], |
| 64 | + 'no-use-before-define': ['error', 'nofunc'], |
| 65 | + 'no-var': 'error', |
| 66 | + 'no-warning-comments': ['warn', {terms: ['todo'], location: 'anywhere'}], |
| 67 | + 'object-curly-spacing': ['error', 'never'], |
| 68 | + 'prefer-const': ['error', {destructuring: 'all'}], |
| 69 | + quotes: ['error', 'single'], |
| 70 | + semi: ['error', 'always'], |
| 71 | + 'semi-spacing': ['error', {before: false, after: true}], |
| 72 | + 'keyword-spacing': 'error', |
| 73 | + 'space-before-blocks': 'error', |
| 74 | + 'space-before-function-paren': [ |
| 75 | + 'error', |
| 76 | + {anonymous: 'always', named: 'never'}, |
| 77 | + ], |
| 78 | + 'space-in-parens': 'error', |
| 79 | + 'space-infix-ops': 'error', |
| 80 | + strict: 'off', |
| 81 | + }, |
| 82 | + }, |
| 83 | + { |
| 84 | + files: ['lib/**'], |
| 85 | + rules: { |
| 86 | + 'max-len': ['error', {code: 100}], |
| 87 | + }, |
| 88 | + }, |
| 89 | + { |
| 90 | + files: ['benchmark/**', 'examples/**'], |
| 91 | + languageOptions: { |
| 92 | + ecmaVersion: 2017, |
| 93 | + }, |
| 94 | + rules: { |
| 95 | + 'no-console': 'off', |
| 96 | + }, |
| 97 | + }, |
| 98 | + { |
| 99 | + files: ['test/**'], |
| 100 | + languageOptions: { |
| 101 | + ecmaVersion: 2017, |
| 102 | + sourceType: 'module', |
| 103 | + }, |
| 104 | + rules: { |
| 105 | + 'handle-callback-err': 'warn', |
| 106 | + 'no-shadow': 'off', |
| 107 | + 'no-warning-comments': 'off', |
| 108 | + }, |
| 109 | + }, |
| 110 | +]; |
0 commit comments