11// @ts -check
22
3- import { fixupPluginRules } from "@eslint/compat" ;
4- import { FlatCompat } from "@eslint/eslintrc" ;
53import jsEslint from "@eslint/js" ;
64import eslintConfigPrettier from "eslint-config-prettier" ;
7- import eslintPluginImportX from "eslint-plugin-import-x" ;
5+ import * as eslintPluginImportX from "eslint-plugin-import-x" ;
86import * as tsEslint from "typescript-eslint" ;
97
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-
338export default tsEslint . config (
349 jsEslint . configs . recommended ,
3510 eslintPluginImportX . flatConfigs . recommended ,
@@ -56,10 +31,6 @@ export default tsEslint.config(
5631 ] ,
5732 } ,
5833 {
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- } ,
6334 rules : {
6435 "@typescript-eslint/await-thenable" : "warn" ,
6536 "@typescript-eslint/explicit-function-return-type" : "warn" ,
@@ -80,19 +51,15 @@ export default tsEslint.config(
8051 allowNumber : true ,
8152 } ,
8253 ] ,
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" : [
8855 "error" ,
8956 {
9057 devDependencies : true ,
9158 optionalDependencies : true ,
9259 peerDependencies : true ,
9360 } ,
9461 ] ,
95- "import/order" : [
62+ "import-x /order" : [
9663 "warn" ,
9764 { "newlines-between" : "always" , alphabetize : { order : "asc" } } ,
9865 ] ,
0 commit comments