forked from focus-trap/focus-trap
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
114 lines (100 loc) · 2.74 KB
/
.eslintrc.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
module.exports = {
root: true,
parser: '@babel/eslint-parser',
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
},
ecmaVersion: 6,
sourceType: 'script',
},
extends: [
'eslint:recommended',
'plugin:cypress/recommended',
'prettier', // ALWAYS LAST: disable style rules that conflict with prettier
],
env: {
es6: true,
commonjs: true,
browser: true,
},
overrides: [
{
files: ['index.js', 'rollup.config.js', 'cypress/support/e2e.js'],
parserOptions: {
sourceType: 'module',
},
},
],
plugins: ['jest'],
rules: {
//// possible errors
'no-regex-spaces': 'off',
'no-await-in-loop': 'error',
'no-async-promise-executor': 'error',
'no-misleading-character-class': 'error',
//// best practices
curly: 'error',
'default-case': 'error',
eqeqeq: 'error',
'guard-for-in': 'error',
'no-alert': 'error',
'no-caller': 'error',
'no-console': 'error',
'no-else-return': 'error',
'no-eq-null': 'error',
'no-eval': 'error',
'no-lone-blocks': 'error',
'no-loop-func': 'error',
'no-multi-spaces': 'error',
'no-new': 'off', // OFF to allow `myFunction(new RegExp('foo'))`, for example
'no-new-func': 'error', // disallow `new Function(...)` to declare a new function
'no-new-wrappers': 'error', // disallow `new Number/String/Boolean()`
'no-throw-literal': 'error',
'no-warning-comments': [
'error',
{
terms: ['DEBUG', 'FIXME', 'HACK'],
location: 'start',
},
],
//// strict mode
strict: ['error', 'function'],
//// variables
'no-catch-shadow': 'error',
'no-shadow': 'error',
'no-unused-vars': [
'error',
{
args: 'none',
caughtErrors: 'none',
},
],
'no-use-before-define': 'error',
//// stylistic issues
// NONE: Prettier will take care of these by reformatting the code on commit,
// save a few exceptions.
// Prettier will format using single quotes per mds-format settings, but
// will not require single quotes instead of backticks/template strings
// when interpolation isn't used, so this rule will catch those cases
quotes: [
'error',
'single',
{
avoidEscape: true,
allowTemplateLiterals: false,
},
],
//// ECMAScript 6 (non-stylistic issues only)
'no-duplicate-imports': ['error', { includeExports: true }],
'no-useless-constructor': 'error',
'no-var': 'error',
'prefer-arrow-callback': 'off',
'prefer-const': 'error',
//// from jest plugin
'jest/no-disabled-tests': 'error',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/valid-title': 'error',
},
};