Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bba2c9c

Browse files
authored
Move eslint.config.js to Typescript (#58027)
1 parent 8c6e5a3 commit bba2c9c

7 files changed

Lines changed: 80 additions & 89 deletions

File tree

eslint-plugins.d.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Type declarations for ESLint plugins without official TypeScript definitions
2+
3+
declare module 'eslint-plugin-github' {
4+
import type { ESLint, Linter } from 'eslint'
5+
6+
const plugin: ESLint.Plugin & {
7+
configs: {
8+
recommended: Linter.FlatConfig
9+
}
10+
}
11+
12+
export default plugin
13+
}
14+
15+
declare module 'eslint-plugin-primer-react' {
16+
import type { ESLint, Linter } from 'eslint'
17+
18+
const plugin: ESLint.Plugin & {
19+
configs: {
20+
recommended: Linter.FlatConfig
21+
}
22+
}
23+
24+
export default plugin
25+
}
26+
27+
declare module 'eslint-plugin-eslint-comments' {
28+
import type { ESLint } from 'eslint'
29+
30+
const plugin: ESLint.Plugin
31+
32+
export default plugin
33+
}
34+
35+
declare module 'eslint-plugin-i18n-text' {
36+
import type { ESLint } from 'eslint'
37+
38+
const plugin: ESLint.Plugin
39+
40+
export default plugin
41+
}
42+
43+
declare module 'eslint-plugin-filenames' {
44+
import type { ESLint } from 'eslint'
45+
46+
const plugin: ESLint.Plugin
47+
48+
export default plugin
49+
}
50+
51+
declare module 'eslint-plugin-no-only-tests' {
52+
import type { ESLint } from 'eslint'
53+
54+
const plugin: ESLint.Plugin
55+
56+
export default plugin
57+
}

eslint.config.js renamed to eslint.config.ts

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -14,89 +14,6 @@ import prettier from 'eslint-config-prettier'
1414
import globals from 'globals'
1515

1616
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
10017
{
10118
files: ['**/*.{ts,tsx}'],
10219
languageOptions: {

package-lock.json

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@
258258
"@types/connect-timeout": "1.9.0",
259259
"@types/cookie": "0.6.0",
260260
"@types/cookie-parser": "1.4.8",
261+
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
261262
"@types/event-to-promise": "^0.7.5",
262263
"@types/express": "^5.0.3",
263264
"@types/imurmurhash": "^0.1.4",
@@ -298,6 +299,7 @@
298299
"graphql": "^16.9.0",
299300
"http-status-code": "^2.1.0",
300301
"husky": "^9.1.7",
302+
"jiti": "^2.6.1",
301303
"json-schema-merge-allof": "^0.8.1",
302304
"lint-staged": "^16.0.0",
303305
"markdownlint": "^0.34.0",

src/ai-tools/scripts/ai-tools.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env node
2-
31
import { fileURLToPath } from 'url'
42
import { Command } from 'commander'
53
import fs from 'fs'

src/metrics/scripts/docsaudit.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env node
2-
31
import fs from 'fs'
42
import path from 'path'
53
import { fileURLToPath } from 'url'

src/metrics/scripts/docstat.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env node
2-
31
import fs from 'fs'
42
import path from 'path'
53
import { Command } from 'commander'

0 commit comments

Comments
 (0)