forked from primer/brand
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
184 lines (184 loc) · 4.32 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
extends: [
'plugin:import/recommended',
'plugin:react/jsx-runtime',
'plugin:react/recommended',
'plugin:jsx-a11y/recommended',
'plugin:react-hooks/recommended',
'plugin:prettier/recommended',
'plugin:github/recommended',
'plugin:github/browser',
'plugin:primer-react/recommended',
],
ignorePatterns: [
'node_modules',
'.cache',
'coverage/**/*',
'docs/public/**/*',
'storybook-static/**/*',
'dist/**/*',
'lib/**/*',
'types/**/*',
'integration-tests/**/*',
],
globals: {
__DEV__: 'readonly',
},
env: {
browser: true,
commonjs: true,
es6: true,
jest: true,
node: true,
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: {}, // this loads <rootdir>/tsconfig.json to eslint
},
},
// rules which apply to JS, TS, etc.
rules: {
'filenames/match-regex': 0,
'eslint-comments/no-unused-disable': 0,
'react/prop-types': 0,
'react/display-name': 0,
'react-hooks/exhaustive-deps': 'error',
camelcase: [
'error',
{
allow: ['dark_dimmed'],
},
],
},
overrides: [
// rules which apply only to JS
{
files: ['**/*.{js,jsx}'],
rules: {
'eslint-comments/no-use': 0,
'import/no-namespace': 0,
'no-shadow': 0,
'import/no-commonjs': 0,
'import/no-nodejs-modules': 0,
'no-unused-vars': [
'error',
{
ignoreRestSiblings: true,
},
],
},
},
// rules for style-dictionary JS source files
{
files: ['src/tokens/**/*.js'],
rules: {
'prettier/prettier': 0,
},
},
// rules which apply only to TS
{
parserOptions: {
project: 'tsconfig.json',
},
files: ['**/*.{ts,tsx}'],
extends: ['plugin:@typescript-eslint/recommended', 'prettier'],
rules: {
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-explicit-any': 2,
'@typescript-eslint/no-unnecessary-condition': 2,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
},
},
// rules which apply only to TSX tests
{
files: ['**/*.test.{ts,tsx}'],
rules: {
'i18n-text/no-en': 0,
},
},
// rules which apply only to TSX storybook stories
{
files: ['**/*.stories.{ts,tsx}'],
rules: {
'i18n-text/no-en': 0,
},
},
// rules which apply only to TS scripts
{
files: ['scripts/*.{ts,tsx}'],
rules: {
'import/no-nodejs-modules': [
'error',
{
allow: ['path', 'fs'],
},
],
},
},
// rules which apply only to Markdown
{
files: ['**/*.{md,mdx}'],
extends: ['plugin:mdx/recommended'],
settings: {
'mdx/code-blocks': true,
},
rules: {
'prettier/prettier': 0,
},
},
// rules which apply only to Markdown code blocks
{
files: ['**/*.{md,mdx}/**'],
parserOptions: {
project: false,
},
rules: {
camelcase: 0,
'import/no-unresolved': 0,
'no-constant-condition': 0,
'no-console': 0,
'no-empty-pattern': 0,
'no-unused-vars': 0,
'no-undef': 0,
'react/no-unescaped-entities': 0,
'react/react-in-jsx-scope': 0,
'react/jsx-no-undef': 0,
'react/jsx-key': 0,
'react/jsx-no-comment-textnodes': 0,
'i18n-text/no-en': 0,
'import/no-anonymous-default-export': 0,
'import/extensions': 0,
'prettier/prettier': 0,
'@typescript-eslint/no-unnecessary-condition': 0,
'@typescript-eslint/no-unused-vars': 0,
'no-redeclare': 0,
'github/a11y-svg-has-accessible-name': 0,
},
},
// rules which apply only to Figma code connect files
{
files: ['**/*.figma.tsx'],
rules: {
'github/unescaped-html-literal': 0,
'i18n-text/no-en': 0,
},
},
],
}