Skip to content

Commit ac1d625

Browse files
authored
Merge pull request #39904 from github/repo-sync
Repo sync
2 parents 93164b1 + ad51577 commit ac1d625

29 files changed

+1815
-956
lines changed

eslint.config.js

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
import js from '@eslint/js'
2+
import tseslint from '@typescript-eslint/eslint-plugin'
3+
import tsParser from '@typescript-eslint/parser'
4+
import github from 'eslint-plugin-github'
5+
import importPlugin from 'eslint-plugin-import'
6+
import jsxA11y from 'eslint-plugin-jsx-a11y'
7+
import primerReact from 'eslint-plugin-primer-react'
8+
import eslintComments from 'eslint-plugin-eslint-comments'
9+
import i18nText from 'eslint-plugin-i18n-text'
10+
import filenames from 'eslint-plugin-filenames'
11+
import noOnlyTests from 'eslint-plugin-no-only-tests'
12+
import prettierPlugin from 'eslint-plugin-prettier'
13+
import prettier from 'eslint-config-prettier'
14+
import globals from 'globals'
15+
16+
export default [
17+
// JavaScript and MJS files configuration
18+
{
19+
files: ['**/*.{js,mjs}'],
20+
languageOptions: {
21+
ecmaVersion: 2022,
22+
sourceType: 'module',
23+
globals: {
24+
...globals.browser,
25+
...globals.node,
26+
...globals.commonjs,
27+
...globals.es2020,
28+
},
29+
parserOptions: {
30+
requireConfigFile: false,
31+
},
32+
},
33+
settings: {
34+
'import/resolver': {
35+
typescript: true,
36+
node: true,
37+
},
38+
},
39+
plugins: {
40+
github,
41+
import: importPlugin,
42+
'eslint-comments': eslintComments,
43+
'i18n-text': i18nText,
44+
filenames,
45+
'no-only-tests': noOnlyTests,
46+
prettier: prettierPlugin,
47+
},
48+
rules: {
49+
// ESLint recommended rules
50+
...js.configs.recommended.rules,
51+
52+
// GitHub plugin recommended rules
53+
...github.configs.recommended.rules,
54+
55+
// Import plugin error rules
56+
...importPlugin.configs.errors.rules,
57+
58+
// JavaScript-specific overrides
59+
'import/no-extraneous-dependencies': [
60+
'error',
61+
{
62+
packageDir: '.',
63+
},
64+
],
65+
'import/extensions': 'off',
66+
'no-console': 'off',
67+
camelcase: 'off',
68+
'no-shadow': 'off',
69+
'prefer-template': 'off',
70+
'no-constant-condition': 'off',
71+
'no-unused-vars': 'off',
72+
'import/no-named-as-default-member': 'off',
73+
'one-var': 'off',
74+
'import/no-namespace': 'off',
75+
'import/no-anonymous-default-export': 'off',
76+
'object-shorthand': 'off',
77+
'no-empty': 'off',
78+
'prefer-const': 'off',
79+
'import/no-named-as-default': 'off',
80+
'no-useless-concat': 'off',
81+
'func-style': 'off',
82+
83+
// Disable GitHub plugin rules that were disabled in original config
84+
'github/array-foreach': 'off',
85+
'github/no-then': 'off',
86+
87+
// Disable rules that might not exist or cause issues initially
88+
'i18n-text/no-en': 'off',
89+
'filenames/match-regex': 'off',
90+
'eslint-comments/no-use': 'off',
91+
'eslint-comments/no-unused-disable': 'off',
92+
'eslint-comments/no-unlimited-disable': 'off',
93+
94+
// Disable new ESLint 9 rules that are causing issues
95+
'no-constant-binary-expression': 'off',
96+
},
97+
},
98+
99+
// TypeScript and TSX files configuration
100+
{
101+
files: ['**/*.{ts,tsx}'],
102+
languageOptions: {
103+
parser: tsParser,
104+
ecmaVersion: 2022,
105+
sourceType: 'module',
106+
globals: {
107+
...globals.browser,
108+
...globals.node,
109+
...globals.commonjs,
110+
...globals.es2020,
111+
},
112+
parserOptions: {
113+
requireConfigFile: false,
114+
},
115+
},
116+
settings: {
117+
'import/resolver': {
118+
typescript: true,
119+
node: true,
120+
},
121+
},
122+
plugins: {
123+
github,
124+
import: importPlugin,
125+
'eslint-comments': eslintComments,
126+
'i18n-text': i18nText,
127+
filenames,
128+
'no-only-tests': noOnlyTests,
129+
prettier: prettierPlugin,
130+
'@typescript-eslint': tseslint,
131+
'primer-react': primerReact,
132+
'jsx-a11y': jsxA11y,
133+
},
134+
rules: {
135+
// ESLint recommended rules
136+
...js.configs.recommended.rules,
137+
138+
// GitHub plugin recommended rules
139+
...github.configs.recommended.rules,
140+
141+
// Import plugin error rules
142+
...importPlugin.configs.errors.rules,
143+
144+
// TypeScript ESLint recommended rules
145+
...tseslint.configs.recommended.rules,
146+
147+
// Primer React recommended rules
148+
...primerReact.configs.recommended.rules,
149+
150+
// JSX A11y recommended rules
151+
...jsxA11y.configs.recommended.rules,
152+
153+
// TypeScript-specific overrides
154+
'import/no-extraneous-dependencies': [
155+
'error',
156+
{
157+
packageDir: '.',
158+
},
159+
],
160+
'import/extensions': 'off',
161+
'no-console': 'off',
162+
camelcase: 'off',
163+
'no-shadow': 'off',
164+
'prefer-template': 'off',
165+
'no-constant-condition': 'off',
166+
'no-unused-vars': 'off',
167+
'no-undef': 'off',
168+
'no-use-before-define': 'off',
169+
'no-redeclare': 'off', // Allow function overloads in TypeScript
170+
'import/no-named-as-default-member': 'off',
171+
'one-var': 'off',
172+
'import/no-namespace': 'off',
173+
'import/no-anonymous-default-export': 'off',
174+
'object-shorthand': 'off',
175+
'no-empty': 'off',
176+
'prefer-const': 'off',
177+
'import/no-named-as-default': 'off',
178+
'no-useless-concat': 'off',
179+
'func-style': 'off',
180+
181+
// TypeScript ESLint specific rules
182+
'@typescript-eslint/no-unused-vars': 'error',
183+
184+
// Disable GitHub plugin rules that were disabled in original config
185+
'github/array-foreach': 'off',
186+
'github/no-then': 'off',
187+
188+
// Disable rules that might not exist or cause issues initially
189+
'i18n-text/no-en': 'off',
190+
'filenames/match-regex': 'off',
191+
'eslint-comments/no-use': 'off',
192+
'eslint-comments/no-unused-disable': 'off',
193+
'eslint-comments/no-unlimited-disable': 'off',
194+
195+
// Disable new ESLint 9 rules that are causing issues
196+
'no-constant-binary-expression': 'off',
197+
198+
// Disable stricter TypeScript rules initially
199+
'@typescript-eslint/no-explicit-any': 'off',
200+
'@typescript-eslint/no-unused-expressions': 'off',
201+
'@typescript-eslint/ban-ts-comment': 'off',
202+
'@typescript-eslint/no-wrapper-object-types': 'off',
203+
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
204+
'@typescript-eslint/no-unsafe-function-type': 'off',
205+
'@typescript-eslint/no-empty-object-type': 'off',
206+
'@typescript-eslint/prefer-as-const': 'off',
207+
208+
// React/JSX specific rules
209+
'jsx-a11y/no-onchange': 'off',
210+
},
211+
},
212+
213+
// Ignored patterns
214+
{
215+
ignores: [
216+
'tmp/*',
217+
'.next/',
218+
'src/bookmarklets/*',
219+
'rest-api-description/',
220+
'docs-internal-data/',
221+
'src/code-scanning/scripts/generate-code-scanning-query-list.ts',
222+
],
223+
},
224+
225+
// Prettier config (should be last to override formatting rules)
226+
prettier,
227+
]

0 commit comments

Comments
 (0)