1+ // @ts -check
12"use strict" ;
23
34const configInternal = require ( "@babel/eslint-config-internal" ) ;
@@ -6,8 +7,7 @@ const pluginN = require("eslint-plugin-n");
67const pluginPrettier = require ( "eslint-plugin-prettier" ) ;
78const pluginBabelDevelopment = require ( "@babel/eslint-plugin-development" ) ;
89const pluginBabelDevelopmentInternal = require ( "@babel/eslint-plugin-development-internal" ) ;
9- const pluginTypeScriptESLint = require ( "@typescript-eslint/eslint-plugin" ) ;
10- const parserTypeScriptESLint = require ( "@typescript-eslint/parser" ) ;
10+ const typescriptEslint = require ( "typescript-eslint" ) ;
1111
1212const { FlatCompat } = require ( "@eslint/eslintrc" ) ;
1313
@@ -75,97 +75,92 @@ module.exports = [
7575 "import/no-extraneous-dependencies" : "error" ,
7676 } ,
7777 } ,
78- ...compat
79- . extends (
80- "plugin:@typescript-eslint/recommended-type-checked" ,
81- "plugin:@typescript-eslint/stylistic-type-checked"
82- )
83- . map ( config => {
84- return {
85- ...config ,
86- files : [ "**/*.{ts,cts}" ] ,
87- languageOptions : {
88- parser : parserTypeScriptESLint ,
89- parserOptions : {
90- allowAutomaticSingleRunInference : true ,
91- EXPERIMENTAL_useProjectService : true ,
78+ ...typescriptEslint . config ( {
79+ files : [ "**/*.{ts,cts}" ] ,
80+ extends : [
81+ ...typescriptEslint . configs . recommendedTypeChecked ,
82+ ...typescriptEslint . configs . stylisticTypeChecked ,
83+ ] ,
84+ languageOptions : {
85+ parser : typescriptEslint . parser ,
86+ parserOptions : {
87+ allowAutomaticSingleRunInference : true ,
88+ EXPERIMENTAL_useProjectService : true ,
89+ } ,
90+ } ,
91+ plugins : {
92+ "@typescript-eslint" : typescriptEslint . plugin ,
93+ } ,
94+ rules : {
95+ "no-unused-vars" : "off" ,
96+ "@typescript-eslint/no-unused-vars" : "error" ,
97+ "no-dupe-class-members" : "off" ,
98+ "@typescript-eslint/no-dupe-class-members" : "error" ,
99+ "no-undef" : "off" ,
100+ "no-redeclare" : "off" ,
101+ "@typescript-eslint/ban-ts-comment" : [
102+ "error" ,
103+ {
104+ "ts-ignore" : {
105+ descriptionFormat : "^\\(Babel 7 vs Babel 8\\) .+$" ,
92106 } ,
93107 } ,
94- plugins : {
95- "@typescript-eslint" : pluginTypeScriptESLint ,
108+ ] ,
109+ "@typescript-eslint/consistent-type-imports" : [
110+ "error" ,
111+ { disallowTypeAnnotations : false } ,
112+ ] ,
113+ "@typescript-eslint/no-use-before-define" : [
114+ "error" ,
115+ {
116+ functions : false ,
117+ classes : false ,
118+ allowNamedExports : true ,
96119 } ,
97- rules : {
98- ...config . rules ,
99- "no-unused-vars" : "off" ,
100- "@typescript-eslint/no-unused-vars" : "error" ,
101- "no-dupe-class-members" : "off" ,
102- "@typescript-eslint/no-dupe-class-members" : "error" ,
103- "no-undef" : "off" ,
104- "no-redeclare" : "off" ,
105- "@typescript-eslint/ban-ts-comment" : [
106- "error" ,
107- {
108- "ts-ignore" : {
109- descriptionFormat : "^\\(Babel 7 vs Babel 8\\) .+$" ,
110- } ,
111- } ,
112- ] ,
113- "@typescript-eslint/consistent-type-imports" : [
114- "error" ,
115- { disallowTypeAnnotations : false } ,
116- ] ,
117- "@typescript-eslint/no-use-before-define" : [
118- "error" ,
119- {
120- functions : false ,
121- classes : false ,
122- allowNamedExports : true ,
123- } ,
124- ] ,
125- "@typescript-eslint/no-confusing-void-expression" : [
126- "error" ,
127- { ignoreArrowShorthand : true } ,
128- ] ,
129- "@typescript-eslint/no-import-type-side-effects" : "error" ,
120+ ] ,
121+ "@typescript-eslint/no-confusing-void-expression" : [
122+ "error" ,
123+ { ignoreArrowShorthand : true } ,
124+ ] ,
125+ "@typescript-eslint/no-import-type-side-effects" : "error" ,
130126
131- // Todo: Investigate, for each of these, whether we want them
132- "@typescript-eslint/array-type" : "off" ,
133- "@typescript-eslint/ban-types" : "off" ,
134- "@typescript-eslint/consistent-generic-constructors" : "off" ,
135- "@typescript-eslint/consistent-indexed-object-style" : "off" ,
136- "@typescript-eslint/consistent-type-definitions" : "off" ,
137- "@typescript-eslint/dot-notation" : "off" ,
138- "@typescript-eslint/no-base-to-string" : "off" ,
139- "@typescript-eslint/no-duplicate-type-constituents" : "off" ,
140- "@typescript-eslint/no-empty-function" : "off" ,
141- "@typescript-eslint/no-empty-interface" : "off" ,
142- "@typescript-eslint/no-explicit-any" : "off" ,
143- "@typescript-eslint/no-misused-promises" : "off" ,
144- "@typescript-eslint/no-namespace" : "off" ,
145- "@typescript-eslint/no-this-alias" : "off" ,
146- "@typescript-eslint/no-unsafe-assignment" : "off" ,
147- "@typescript-eslint/no-unsafe-call" : "off" ,
148- "@typescript-eslint/no-unsafe-declaration-merging" : "off" ,
149- "@typescript-eslint/no-unsafe-member-access" : "off" ,
150- "@typescript-eslint/no-var-requires" : "off" ,
151- "@typescript-eslint/prefer-for-of" : "off" ,
152- "@typescript-eslint/prefer-function-type" : "off" ,
153- "@typescript-eslint/prefer-nullish-coalescing" : "off" ,
154- "@typescript-eslint/prefer-string-starts-ends-with" : "off" ,
155- "@typescript-eslint/require-await" : "off" ,
156- "@typescript-eslint/restrict-template-expressions" : "off" ,
157- "@typescript-eslint/sort-type-constituents" : "off" ,
158- "@typescript-eslint/triple-slash-reference" : "off" ,
159- "@typescript-eslint/unbound-method" : "off" ,
160- "prefer-rest-params" : "off" ,
127+ // Todo: Investigate, for each of these, whether we want them
128+ "@typescript-eslint/array-type" : "off" ,
129+ "@typescript-eslint/ban-types" : "off" ,
130+ "@typescript-eslint/consistent-generic-constructors" : "off" ,
131+ "@typescript-eslint/consistent-indexed-object-style" : "off" ,
132+ "@typescript-eslint/consistent-type-definitions" : "off" ,
133+ "@typescript-eslint/dot-notation" : "off" ,
134+ "@typescript-eslint/no-base-to-string" : "off" ,
135+ "@typescript-eslint/no-duplicate-type-constituents" : "off" ,
136+ "@typescript-eslint/no-empty-function" : "off" ,
137+ "@typescript-eslint/no-empty-interface" : "off" ,
138+ "@typescript-eslint/no-explicit-any" : "off" ,
139+ "@typescript-eslint/no-misused-promises" : "off" ,
140+ "@typescript-eslint/no-namespace" : "off" ,
141+ "@typescript-eslint/no-this-alias" : "off" ,
142+ "@typescript-eslint/no-unsafe-assignment" : "off" ,
143+ "@typescript-eslint/no-unsafe-call" : "off" ,
144+ "@typescript-eslint/no-unsafe-declaration-merging" : "off" ,
145+ "@typescript-eslint/no-unsafe-member-access" : "off" ,
146+ "@typescript-eslint/no-var-requires" : "off" ,
147+ "@typescript-eslint/prefer-for-of" : "off" ,
148+ "@typescript-eslint/prefer-function-type" : "off" ,
149+ "@typescript-eslint/prefer-nullish-coalescing" : "off" ,
150+ "@typescript-eslint/prefer-string-starts-ends-with" : "off" ,
151+ "@typescript-eslint/require-await" : "off" ,
152+ "@typescript-eslint/restrict-template-expressions" : "off" ,
153+ "@typescript-eslint/sort-type-constituents" : "off" ,
154+ "@typescript-eslint/triple-slash-reference" : "off" ,
155+ "@typescript-eslint/unbound-method" : "off" ,
156+ "prefer-rest-params" : "off" ,
161157
162- // https://github.com/typescript-eslint/typescript-eslint/issues/5014
163- "@typescript-eslint/no-inferrable-types" : "off" ,
164- "@typescript-eslint/no-unsafe-argument" : "off" ,
165- "@typescript-eslint/no-unsafe-return" : "off" ,
166- } ,
167- } ;
168- } ) ,
158+ // https://github.com/typescript-eslint/typescript-eslint/issues/5014
159+ "@typescript-eslint/no-inferrable-types" : "off" ,
160+ "@typescript-eslint/no-unsafe-argument" : "off" ,
161+ "@typescript-eslint/no-unsafe-return" : "off" ,
162+ } ,
163+ } ) ,
169164 {
170165 files : sourceFiles ( "js,ts,cjs,mjs" ) ,
171166 languageOptions : {
0 commit comments