-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.js
120 lines (117 loc) · 4.17 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
'use strict';
module.exports = {
extends: 'eslint:recommended',
env: { es2020: true },
plugins: ['import'],
rules: {
'array-callback-return': 'error',
'block-scoped-var': 'error',
'camelcase': ['error', { properties: 'never' }],
'consistent-return': 'error',
'curly': ['error', 'multi-line'],
'default-case': ['error', { commentPattern: '^no default$' }],
'dot-notation': ['error', { allowKeywords: true }],
'eqeqeq': ['error', 'allow-null'],
'guard-for-in': 'error',
'import/export': 'error',
'import/imports-first': ['error', 'absolute-first'],
'import/newline-after-import': 'error',
'import/no-amd': 'error',
'import/no-duplicates': 'error',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'**/*.test.js',
'**/scripts/**',
'**/test/**',
'**/tests/**',
'prettier.config.js',
],
},
],
'import/no-mutable-exports': 'error',
'import/no-named-as-default': 'error',
'import/no-named-as-default-member': 'error',
'import/no-unresolved': ['error', { commonjs: true }],
'import/prefer-default-export': 'error',
'new-cap': ['error', { newIsCap: true }],
'no-array-constructor': 'error',
'no-caller': 'error',
'no-confusing-arrow': ['error', { allowParens: false }],
'no-console': 'error',
'no-duplicate-imports': 'error',
'no-else-return': 'error',
'no-empty-function': ['error', { allow: ['arrowFunctions', 'functions', 'methods'] }],
'no-eval': 'error',
'no-extra-bind': 'error',
'no-extra-label': 'error',
'no-extra-semi': 'off', // Handled by Prettier
'no-implied-eval': 'error',
'no-iterator': 'error',
'no-label-var': 'error',
'no-lone-blocks': 'error',
'no-lonely-if': 'error',
'no-loop-func': 'error',
'no-mixed-spaces-and-tabs': 'off', // Handled by Prettier
'no-multi-str': 'error',
'no-nested-ternary': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-new-object': 'error',
'no-new-require': 'error',
'no-new-wrappers': 'error',
'no-octal-escape': 'error',
'no-proto': 'error',
'no-restricted-syntax': ['error', 'DebuggerStatement', 'ForInStatement', 'WithStatement'],
'no-return-assign': 'error',
'no-script-url': 'error',
'no-self-compare': 'error',
'no-sequences': 'error',
'no-shadow': 'error',
'no-throw-literal': 'error',
'no-undef-init': 'error',
'no-unexpected-multiline': 'off', // Handled by Prettier
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
'no-unused-expressions': ['error'],
'no-unused-vars': ['error', { vars: 'local', args: 'after-used' }],
'no-useless-computed-key': 'error',
'no-useless-concat': 'error',
'no-useless-constructor': 'error',
'no-useless-rename': [
'error',
{ ignoreDestructuring: false, ignoreImport: false, ignoreExport: false },
],
'no-var': 'error',
'no-void': 'error',
'object-shorthand': ['error', 'always', { ignoreConstructors: false, avoidQuotes: true }],
'one-var': ['error', 'never'],
'operator-assignment': ['error', 'always'],
'quotes': ['error', 'single', { avoidEscape: true }],
'prefer-arrow-callback': ['error', { allowNamedFunctions: false, allowUnboundThis: true }],
'prefer-const': ['error', { destructuring: 'any', ignoreReadBeforeAssign: true }],
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-template': 'error',
'radix': 'error',
'require-atomic-updates': 'off', // Reports false positives: https://github.com/eslint/eslint/issues/11899
'vars-on-top': 'error',
'spaced-comment': ['error', 'always', { exceptions: ['-', '+'], markers: ['=', '!'] }],
'strict': ['error', 'safe'],
'yoda': 'error',
},
overrides: [
{
files: ['**/*.mjs'],
parserOptions: { sourceType: 'module' },
},
{
files: ['**/*.test.js', '**/test/**'],
env: { mocha: true, jest: true },
rules: {
'no-unused-expressions': 'off', // Prevent errors on expect's e.g.: expect(foo).to.be.something
},
},
{ files: ['jest.setupEnvironment.js'], env: { jest: true } },
],
};