forked from KingSora/OverlayScrollbars
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
153 lines (152 loc) · 4.39 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
const defaultRules = {
'func-names': 'off',
'no-plusplus': 'off',
'no-continue': 'off',
'no-param-reassign': 'off',
'no-nested-ternary': 'off',
'no-underscore-dangle': 'off',
'no-multi-assign': 'off',
'no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true }],
'no-console': ['error', { allow: ['warn', 'error'] }],
'no-empty': ['error', { allowEmptyCatch: true }],
'no-cond-assign': ['error', 'except-parens'],
camelcase: ['error', { allow: ['^__', '^UNSAFE_'] }],
'prefer-destructuring': 'off',
'consistent-return': 'off',
'import/prefer-default-export': 'off',
'import/no-extraneous-dependencies': 'off',
'import/extensions': [
'off',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
'import/order': [
'error',
{
groups: ['builtin', 'external', 'index', 'internal', 'unknown', 'type'],
pathGroups: [
{
pattern: '*.{css,scss,sass}',
group: 'unknown',
patternOptions: { matchBase: true },
position: 'after',
},
],
},
],
'react/function-component-definition': [
'error',
{
namedComponents: 'arrow-function',
unnamedComponents: 'arrow-function',
},
],
'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.tsx'] }],
'react/require-default-props': ['off'],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error'],
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': ['error', { ignoreDeclarationMerge: true }],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error'],
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/consistent-type-imports': 'warn',
'@typescript-eslint/no-this-alias': [
'error',
{
allowDestructuring: true, // Allow `const { props, state } = this`; false by default
allowedNames: ['self', '_self'], // Allow `const self = this`; `[]` by default
},
],
};
const defaultPlugins = ['prettier', 'json', '@typescript-eslint', 'import', 'react'];
module.exports = {
extends: [
'prettier',
'eslint:recommended',
'plugin:react/jsx-runtime',
'plugin:@typescript-eslint/recommended',
],
plugins: defaultPlugins,
ignorePatterns: ['.eslintrc.js'],
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
project: [
'./packages/**/tsconfig.json',
'./examples/**/tsconfig.json',
'./website/**/tsconfig.json',
'./local/**/tsconfig.json',
'./tsconfig.json',
],
},
env: {
browser: true,
es2020: true,
node: true,
jest: true,
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: [
'./packages/**/tsconfig.json',
'./examples/**/tsconfig.json',
'./website/**/tsconfig.json',
'./local/**/tsconfig.json',
],
},
},
},
rules: defaultRules,
overrides: [
{
files: ['*.test.*', '**/test/**/*'],
plugins: [...defaultPlugins, 'jest-dom'],
rules: {
...defaultRules,
'no-shadow': 'off',
'no-use-before-define': 'off',
'no-restricted-syntax': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'no-console': 'off',
'consistent-return': 'off',
'symbol-description': 'off',
'no-new-wrappers': 'off',
'no-prototype-builtins': 'off',
'no-void': 'off',
'no-empty-function': 'off',
'no-new-func': 'off',
},
},
{
files: ['*rollup*'],
rules: {
'no-console': 'off',
'global-require': 'off',
'import/no-dynamic-require': 'off',
},
},
],
};