-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patheslint.config.js
More file actions
167 lines (156 loc) · 3.59 KB
/
eslint.config.js
File metadata and controls
167 lines (156 loc) · 3.59 KB
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
import js from '@eslint/js'
import tseslint from 'typescript-eslint'
import reactPlugin from 'eslint-plugin-react'
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y'
import prettierPlugin from 'eslint-plugin-prettier/recommended'
import primerReactPlugin from 'eslint-plugin-primer-react'
import * as mdxPlugin from 'eslint-plugin-mdx'
import globals from 'globals'
export default tseslint.config(
// Global ignores
{
ignores: [
'node_modules/**',
'.next/**',
'dist/**',
'out/**',
'types/**',
'CHANGELOG.md',
'**/next-env.d.ts',
'**/coverage/**',
],
},
// Base JavaScript config
js.configs.recommended,
// React config
{
...reactPlugin.configs.flat.recommended,
settings: {
react: {
version: 'detect',
},
},
},
reactPlugin.configs.flat['jsx-runtime'],
// JSX A11y
jsxA11yPlugin.flatConfigs.recommended,
// Prettier
prettierPlugin,
// Primer React
{
files: ['**/*.{js,jsx,ts,tsx}'],
plugins: {
'primer-react': primerReactPlugin,
},
rules: {
...primerReactPlugin.configs.recommended.rules,
'primer-react/no-system-props': 'off',
},
},
// Base rules for all JS/TS files
{
files: ['**/*.{js,jsx,ts,tsx}'],
languageOptions: {
globals: {
...globals.browser,
...globals.commonjs,
...globals.es2021,
...globals.jest,
...globals.node,
__DEV__: 'readonly',
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
'react/prop-types': 'off',
'react/display-name': 'off',
camelcase: [
'error',
{
allow: ['dark_dimmed'],
},
],
},
},
// JavaScript specific rules
{
files: ['**/*.{js,jsx}'],
rules: {
'no-shadow': 'off',
'no-unused-vars': [
'error',
{
ignoreRestSiblings: true,
},
],
},
},
// TypeScript
...tseslint.configs.recommended.map(config => ({
...config,
files: ['**/*.{ts,tsx}'],
})),
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parserOptions: {
projectService: true,
},
},
rules: {
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^React$',
ignoreRestSiblings: true,
},
],
},
},
// MDX files
{
...mdxPlugin.flat,
files: ['**/*.{md,mdx}'],
processor: mdxPlugin.createRemarkProcessor({
lintCodeBlocks: false,
}),
rules: {
'prettier/prettier': 'off',
'react/jsx-no-undef': 'off',
'react/no-unescaped-entities': 'off',
'no-unused-vars': 'off',
},
},
// MDX code blocks
{
...mdxPlugin.flatCodeBlocks,
files: ['**/*.{md,mdx}/**'],
rules: {
...mdxPlugin.flatCodeBlocks?.rules,
camelcase: 'off',
'no-constant-condition': 'off',
'no-console': 'off',
'no-empty-pattern': 'off',
'no-unused-vars': 'off',
'no-undef': 'off',
'react/no-unescaped-entities': 'off',
'react/react-in-jsx-scope': 'off',
'react/jsx-no-undef': 'off',
'react/jsx-key': 'off',
'react/jsx-no-comment-textnodes': 'off',
'prettier/prettier': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'no-redeclare': 'off',
'no-unused-labels': 'off',
},
},
)