-
Notifications
You must be signed in to change notification settings - Fork 3
/
eslint.config.js
123 lines (117 loc) · 2.47 KB
/
eslint.config.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
const react = require('eslint-plugin-react');
const noUnsanitized = require('eslint-plugin-no-unsanitized');
const globals = require('globals');
const js = require('@eslint/js');
module.exports = [
js.configs.recommended,
{
ignores: [
'**/coverage',
'**/lib',
'**/node_modules',
'**/build',
'packages/documentation/.docusaurus',
],
},
{
files: [
'**/babel.config.js',
'**/eslint.config.js',
'**/jest.config.js',
'**/jest.config.base.js',
'**/webpack.config.js',
// docusaurus-specific
'packages/documentation/docusaurus.config.js',
'packages/documentation/sidebars.js',
],
languageOptions: {
globals: {
...globals.node,
},
sourceType: 'commonjs',
},
},
{
plugins: {
'no-unsanitized': noUnsanitized,
},
languageOptions: {
globals: {
...globals.browser,
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
complexity: ['error', { max: 12 }],
'linebreak-style': ['error', 'unix'],
'max-depth': ['error', 4],
'max-len': ['error', { code: 150 }],
'max-lines': [
'error',
{ max: 300, skipBlankLines: true, skipComments: true },
],
'max-lines-per-function': [
'warn',
{ max: 55, skipBlankLines: true, skipComments: true },
],
'max-params': ['warn', { max: 4 }],
'no-mixed-spaces-and-tabs': ['off'],
'no-shadow': ['error', { builtinGlobals: true }],
semi: ['error', 'always'],
'no-unsanitized/property': [
'error',
{ escape: { methods: ['escapeHTML'] } },
],
'no-unsanitized/method': ['error'],
},
},
{
files: ['packages/chord-mark**/src/**/*'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'lodash',
message:
'Please do not import lodash as a whole: import individual lodash functions instead.',
},
],
},
],
},
},
{
files: ['packages/chord-mark**/tests/**/*'],
languageOptions: {
globals: {
...globals.node,
...globals.jest,
},
},
rules: {
'max-len': ['off'],
'max-lines': ['off'],
'max-lines-per-function': ['off'],
'max-params': ['off'],
'no-unsanitized/property': ['off'],
},
},
{
...react.configs.flat.recommended,
files: ['packages/documentation/src/**/*'],
plugins: {
react,
},
settings: { react: { version: 'detect' } },
rules: {
'react/prop-types': 0,
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
},
},
];