1
1
// @ts -check
2
2
3
- import { fixupPluginRules } from "@eslint/compat" ;
4
- import { FlatCompat } from "@eslint/eslintrc" ;
5
3
import jsEslint from "@eslint/js" ;
6
4
import eslintConfigPrettier from "eslint-config-prettier" ;
7
- import eslintPluginImportX from "eslint-plugin-import-x" ;
5
+ import * as eslintPluginImportX from "eslint-plugin-import-x" ;
8
6
import * as tsEslint from "typescript-eslint" ;
9
7
10
- const compat = new FlatCompat ( {
11
- baseDirectory : import . meta. dirname ,
12
- recommendedConfig : jsEslint . configs . recommended ,
13
- allConfig : jsEslint . configs . all ,
14
- } ) ;
15
-
16
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
17
- /**
18
- * @param {string } name the pugin name
19
- * @param {string } alias the plugin alias
20
- * @returns {import("eslint").ESLint.Plugin }
21
- */
22
- function legacyPlugin ( name , alias = name ) {
23
- const plugin = compat . plugins ( name ) [ 0 ] ?. plugins ?. [ alias ] ;
24
-
25
- if ( ! plugin ) {
26
- throw new Error ( `Unable to resolve plugin ${ name } and/or alias ${ alias } ` ) ;
27
- }
28
-
29
- return fixupPluginRules ( plugin ) ;
30
- }
31
- /* eslint-enable @typescript-eslint/explicit-function-return-type */
32
-
33
8
export default tsEslint . config (
34
9
jsEslint . configs . recommended ,
35
10
eslintPluginImportX . flatConfigs . recommended ,
@@ -56,10 +31,6 @@ export default tsEslint.config(
56
31
] ,
57
32
} ,
58
33
{
59
- plugins : {
60
- github : legacyPlugin ( "eslint-plugin-github" , "github" ) , // pending https://github.com/github/eslint-plugin-github/issues/513
61
- import : legacyPlugin ( "eslint-plugin-import" , "import" ) , // Needed for above
62
- } ,
63
34
rules : {
64
35
"@typescript-eslint/await-thenable" : "warn" ,
65
36
"@typescript-eslint/explicit-function-return-type" : "warn" ,
@@ -80,19 +51,15 @@ export default tsEslint.config(
80
51
allowNumber : true ,
81
52
} ,
82
53
] ,
83
- "github/array-foreach" : "error" ,
84
- "github/no-implicit-buggy-globals" : "error" ,
85
- "github/no-then" : "error" ,
86
- "github/no-dynamic-script-tag" : "error" ,
87
- "import/no-extraneous-dependencies" : [
54
+ "import-x/no-extraneous-dependencies" : [
88
55
"error" ,
89
56
{
90
57
devDependencies : true ,
91
58
optionalDependencies : true ,
92
59
peerDependencies : true ,
93
60
} ,
94
61
] ,
95
- "import/order" : [
62
+ "import-x /order" : [
96
63
"warn" ,
97
64
{ "newlines-between" : "always" , alphabetize : { order : "asc" } } ,
98
65
] ,
0 commit comments