1+ import { defineConfig } from 'eslint/config'
12import base from '@strv/eslint-config-base'
23import ts from '@typescript-eslint/eslint-plugin'
34import parser from '@typescript-eslint/parser'
45import stylisticts from '@stylistic/eslint-plugin-ts'
56
6- /** @type {import("eslint").Linter.Config } */
7- const config = {
7+ /** @returns {ReturnType<typeof defineConfig> } */
8+ export default defineConfig ( {
9+ name : '@strv/eslint-config-typescript' ,
810 plugins : {
9- ...base . plugins ,
1011 '@typescript-eslint' : ts ,
1112 '@stylistic/ts' : stylisticts ,
1213 } ,
@@ -20,7 +21,6 @@ const config = {
2021 'import/resolver' : { typescript : { } } ,
2122 } ,
2223 rules : {
23- ...base . rules ,
2424 // Disabled because it generates false positives with interface declarations and TypeScript
2525 // blows up anyway during compilation when it encouters an undefined variable.
2626 'no-undef' : 'off' ,
@@ -90,7 +90,7 @@ const config = {
9090 // Use of the Array constructor to construct a new array is generally discouraged in favor of
9191 // array literal notation because of the single-argument pitfall and because the Array global
9292 // may be redefined.
93- '@typescript-eslint/no-array-constructor' : base . rules [ 'no-array-constructor' ] ,
93+ '@typescript-eslint/no-array-constructor' : base [ 0 ] . rules [ 'no-array-constructor' ] ,
9494 'no-array-constructor' : 'off' ,
9595
9696 // Require that .toString() is only called on objects which provide useful information
@@ -101,7 +101,7 @@ const config = {
101101 '@typescript-eslint/no-base-to-string' : 'warn' ,
102102
103103 // Disallow duplicate class members
104- '@typescript-eslint/no-dupe-class-members' : base . rules [ 'no-dupe-class-members' ] ,
104+ '@typescript-eslint/no-dupe-class-members' : base [ 0 ] . rules [ 'no-dupe-class-members' ] ,
105105 'no-dupe-class-members' : 'off' ,
106106
107107 // Disallow duplicate enum member values
@@ -153,7 +153,7 @@ const config = {
153153 '@typescript-eslint/no-for-in-array' : 'error' ,
154154
155155 // Disallow the use of `eval()`-like methods
156- '@typescript-eslint/no-implied-eval' : base . rules [ 'no-implied-eval' ] ,
156+ '@typescript-eslint/no-implied-eval' : base [ 0 ] . rules [ 'no-implied-eval' ] ,
157157 'no-implied-eval' : 'off' ,
158158
159159 // Disallows explicit type declarations for builtin primitive values
@@ -169,7 +169,7 @@ const config = {
169169 '@typescript-eslint/no-invalid-void-type' : 'warn' ,
170170
171171 // Disallow function declarations that contain unsafe references inside loop statements
172- '@typescript-eslint/no-loop-func' : base . rules [ 'no-loop-func' ] ,
172+ '@typescript-eslint/no-loop-func' : base [ 0 ] . rules [ 'no-loop-func' ] ,
173173 'no-loop-func' : 'off' ,
174174
175175 // Enforce valid definition of new and constructor
@@ -233,7 +233,7 @@ const config = {
233233
234234 // Disallow Shadowing
235235 // This rule aims to eliminate shadowed variable declarations.
236- '@typescript-eslint/no-shadow' : base . rules [ 'no-shadow' ] ,
236+ '@typescript-eslint/no-shadow' : base [ 0 ] . rules [ 'no-shadow' ] ,
237237 'no-shadow' : 'off' ,
238238
239239 // Disallow aliasing this
@@ -248,7 +248,7 @@ const config = {
248248 // the `Error` object as base objects for user-defined exceptions. The fundamental benefit of
249249 // `Error` objects is that they automatically keep track of where they were built and
250250 // originated.
251- '@typescript-eslint/only-throw-error' : [ base . rules [ 'no-throw-literal' ] , {
251+ '@typescript-eslint/only-throw-error' : [ base [ 0 ] . rules [ 'no-throw-literal' ] , {
252252 allowThrowingAny : false ,
253253 allowThrowingUnknown : false ,
254254 } ] ,
@@ -299,13 +299,13 @@ const config = {
299299 // Disallow Unused Expressions
300300 // This rule aims to eliminate unused expressions which have no effect on the state of the
301301 // program.
302- '@typescript-eslint/no-unused-expressions' : base . rules [ 'no-unused-expressions' ] ,
302+ '@typescript-eslint/no-unused-expressions' : base [ 0 ] . rules [ 'no-unused-expressions' ] ,
303303 'no-unused-expressions' : 'off' ,
304304
305305 // Variables that are declared and not used anywhere in the code are most likely an error due
306306 // to incomplete refactoring. Such variables take up space in the code and can lead to
307307 // confusion by readers.
308- '@typescript-eslint/no-unused-vars' : base . rules [ 'no-unused-vars' ] ,
308+ '@typescript-eslint/no-unused-vars' : base [ 0 ] . rules [ 'no-unused-vars' ] ,
309309 'no-unused-vars' : 'off' ,
310310
311311 // Disallow the use of variables before they are defined
@@ -321,7 +321,7 @@ const config = {
321321 // Disallow unnecessary constructors
322322 // This rule flags class constructors that can be safely removed without changing how the class
323323 // works.
324- '@typescript-eslint/no-useless-constructor' : base . rules [ 'no-useless-constructor' ] ,
324+ '@typescript-eslint/no-useless-constructor' : base [ 0 ] . rules [ 'no-useless-constructor' ] ,
325325 'no-useless-constructor' : 'off' ,
326326
327327 // Disallow empty exports that don't change anything in a module file
@@ -375,7 +375,7 @@ const config = {
375375 '@typescript-eslint/require-array-sort-compare' : 'error' ,
376376
377377 // Disallow async functions which have no await expression
378- '@typescript-eslint/require-await' : base . rules [ 'require-await' ] ,
378+ '@typescript-eslint/require-await' : base [ 0 ] . rules [ 'require-await' ] ,
379379 'require-await' : 'off' ,
380380
381381 // When adding two variables, operands must both be of type number or of type string
@@ -427,6 +427,4 @@ const config = {
427427 // applications it's too much.
428428 '@typescript-eslint/explicit-function-return-type' : [ 'off' , { } ] ,
429429 } ,
430- }
431-
432- export default config
430+ } )
0 commit comments