Move eslint.config.js to Typescript (#58027)
This commit is contained in:
57
eslint-plugins.d.ts
vendored
Normal file
57
eslint-plugins.d.ts
vendored
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
// Type declarations for ESLint plugins without official TypeScript definitions
|
||||||
|
|
||||||
|
declare module 'eslint-plugin-github' {
|
||||||
|
import type { ESLint, Linter } from 'eslint'
|
||||||
|
|
||||||
|
const plugin: ESLint.Plugin & {
|
||||||
|
configs: {
|
||||||
|
recommended: Linter.FlatConfig
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default plugin
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'eslint-plugin-primer-react' {
|
||||||
|
import type { ESLint, Linter } from 'eslint'
|
||||||
|
|
||||||
|
const plugin: ESLint.Plugin & {
|
||||||
|
configs: {
|
||||||
|
recommended: Linter.FlatConfig
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default plugin
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'eslint-plugin-eslint-comments' {
|
||||||
|
import type { ESLint } from 'eslint'
|
||||||
|
|
||||||
|
const plugin: ESLint.Plugin
|
||||||
|
|
||||||
|
export default plugin
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'eslint-plugin-i18n-text' {
|
||||||
|
import type { ESLint } from 'eslint'
|
||||||
|
|
||||||
|
const plugin: ESLint.Plugin
|
||||||
|
|
||||||
|
export default plugin
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'eslint-plugin-filenames' {
|
||||||
|
import type { ESLint } from 'eslint'
|
||||||
|
|
||||||
|
const plugin: ESLint.Plugin
|
||||||
|
|
||||||
|
export default plugin
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'eslint-plugin-no-only-tests' {
|
||||||
|
import type { ESLint } from 'eslint'
|
||||||
|
|
||||||
|
const plugin: ESLint.Plugin
|
||||||
|
|
||||||
|
export default plugin
|
||||||
|
}
|
||||||
@@ -14,89 +14,6 @@ import prettier from 'eslint-config-prettier'
|
|||||||
import globals from 'globals'
|
import globals from 'globals'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
// JavaScript and MJS files configuration
|
|
||||||
{
|
|
||||||
files: ['**/*.{js,mjs}'],
|
|
||||||
languageOptions: {
|
|
||||||
ecmaVersion: 2022,
|
|
||||||
sourceType: 'module',
|
|
||||||
globals: {
|
|
||||||
...globals.browser,
|
|
||||||
...globals.node,
|
|
||||||
...globals.commonjs,
|
|
||||||
...globals.es2020,
|
|
||||||
},
|
|
||||||
parserOptions: {
|
|
||||||
requireConfigFile: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
settings: {
|
|
||||||
'import/resolver': {
|
|
||||||
typescript: true,
|
|
||||||
node: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: {
|
|
||||||
github,
|
|
||||||
import: importPlugin,
|
|
||||||
'eslint-comments': eslintComments,
|
|
||||||
'i18n-text': i18nText,
|
|
||||||
filenames,
|
|
||||||
'no-only-tests': noOnlyTests,
|
|
||||||
prettier: prettierPlugin,
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
// ESLint recommended rules
|
|
||||||
...js.configs.recommended.rules,
|
|
||||||
|
|
||||||
// GitHub plugin recommended rules
|
|
||||||
...github.configs.recommended.rules,
|
|
||||||
|
|
||||||
// Import plugin error rules
|
|
||||||
...importPlugin.configs.errors.rules,
|
|
||||||
|
|
||||||
// JavaScript-specific overrides
|
|
||||||
'import/no-extraneous-dependencies': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
packageDir: '.',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'import/extensions': 'off',
|
|
||||||
'no-console': 'off',
|
|
||||||
camelcase: 'off',
|
|
||||||
'no-shadow': 'off',
|
|
||||||
'prefer-template': 'off',
|
|
||||||
'no-constant-condition': 'off',
|
|
||||||
'no-unused-vars': 'off',
|
|
||||||
'import/no-named-as-default-member': 'off',
|
|
||||||
'one-var': 'off',
|
|
||||||
'import/no-namespace': 'off',
|
|
||||||
'import/no-anonymous-default-export': 'off',
|
|
||||||
'object-shorthand': 'off',
|
|
||||||
'no-empty': 'off',
|
|
||||||
'prefer-const': 'off',
|
|
||||||
'import/no-named-as-default': 'off',
|
|
||||||
'no-useless-concat': 'off',
|
|
||||||
'func-style': 'off',
|
|
||||||
|
|
||||||
// Disable GitHub plugin rules that were disabled in original config
|
|
||||||
'github/array-foreach': 'off',
|
|
||||||
'github/no-then': 'off',
|
|
||||||
|
|
||||||
// Disable rules that might not exist or cause issues initially
|
|
||||||
'i18n-text/no-en': 'off',
|
|
||||||
'filenames/match-regex': 'off',
|
|
||||||
'eslint-comments/no-use': 'off',
|
|
||||||
'eslint-comments/no-unused-disable': 'off',
|
|
||||||
'eslint-comments/no-unlimited-disable': 'off',
|
|
||||||
|
|
||||||
// Disable new ESLint 9 rules that are causing issues
|
|
||||||
'no-constant-binary-expression': 'off',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// TypeScript and TSX files configuration
|
|
||||||
{
|
{
|
||||||
files: ['**/*.{ts,tsx}'],
|
files: ['**/*.{ts,tsx}'],
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
21
package-lock.json
generated
21
package-lock.json
generated
@@ -116,6 +116,7 @@
|
|||||||
"@types/connect-timeout": "1.9.0",
|
"@types/connect-timeout": "1.9.0",
|
||||||
"@types/cookie": "0.6.0",
|
"@types/cookie": "0.6.0",
|
||||||
"@types/cookie-parser": "1.4.8",
|
"@types/cookie-parser": "1.4.8",
|
||||||
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
||||||
"@types/event-to-promise": "^0.7.5",
|
"@types/event-to-promise": "^0.7.5",
|
||||||
"@types/express": "^5.0.3",
|
"@types/express": "^5.0.3",
|
||||||
"@types/imurmurhash": "^0.1.4",
|
"@types/imurmurhash": "^0.1.4",
|
||||||
@@ -156,6 +157,7 @@
|
|||||||
"graphql": "^16.9.0",
|
"graphql": "^16.9.0",
|
||||||
"http-status-code": "^2.1.0",
|
"http-status-code": "^2.1.0",
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
|
"jiti": "^2.6.1",
|
||||||
"json-schema-merge-allof": "^0.8.1",
|
"json-schema-merge-allof": "^0.8.1",
|
||||||
"lint-staged": "^16.0.0",
|
"lint-staged": "^16.0.0",
|
||||||
"markdownlint": "^0.34.0",
|
"markdownlint": "^0.34.0",
|
||||||
@@ -4063,6 +4065,16 @@
|
|||||||
"@types/ms": "*"
|
"@types/ms": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/eslint-plugin-jsx-a11y": {
|
||||||
|
"version": "6.10.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.10.1.tgz",
|
||||||
|
"integrity": "sha512-5RtuPVe0xz8BAhrkn2oww6Uw885atf962Q4fqZo48QdO3EQA7oCEDSXa6optgJ1ZMds3HD9ITK5bfm4AWuoXFQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"eslint": "^9"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/estree": {
|
"node_modules/@types/estree": {
|
||||||
"version": "1.0.7",
|
"version": "1.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz",
|
||||||
@@ -10183,6 +10195,15 @@
|
|||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/jiti": {
|
||||||
|
"version": "2.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/jiti/-/jiti-2.6.1.tgz",
|
||||||
|
"integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"jiti": "lib/jiti-cli.mjs"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/joi": {
|
"node_modules/joi": {
|
||||||
"version": "17.13.3",
|
"version": "17.13.3",
|
||||||
"resolved": "https://registry.npmjs.org/joi/-/joi-17.13.3.tgz",
|
"resolved": "https://registry.npmjs.org/joi/-/joi-17.13.3.tgz",
|
||||||
|
|||||||
@@ -258,6 +258,7 @@
|
|||||||
"@types/connect-timeout": "1.9.0",
|
"@types/connect-timeout": "1.9.0",
|
||||||
"@types/cookie": "0.6.0",
|
"@types/cookie": "0.6.0",
|
||||||
"@types/cookie-parser": "1.4.8",
|
"@types/cookie-parser": "1.4.8",
|
||||||
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
||||||
"@types/event-to-promise": "^0.7.5",
|
"@types/event-to-promise": "^0.7.5",
|
||||||
"@types/express": "^5.0.3",
|
"@types/express": "^5.0.3",
|
||||||
"@types/imurmurhash": "^0.1.4",
|
"@types/imurmurhash": "^0.1.4",
|
||||||
@@ -298,6 +299,7 @@
|
|||||||
"graphql": "^16.9.0",
|
"graphql": "^16.9.0",
|
||||||
"http-status-code": "^2.1.0",
|
"http-status-code": "^2.1.0",
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
|
"jiti": "^2.6.1",
|
||||||
"json-schema-merge-allof": "^0.8.1",
|
"json-schema-merge-allof": "^0.8.1",
|
||||||
"lint-staged": "^16.0.0",
|
"lint-staged": "^16.0.0",
|
||||||
"markdownlint": "^0.34.0",
|
"markdownlint": "^0.34.0",
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'url'
|
||||||
import { Command } from 'commander'
|
import { Command } from 'commander'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'url'
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { Command } from 'commander'
|
import { Command } from 'commander'
|
||||||
|
|||||||
Reference in New Issue
Block a user