Skip to content

Commit 63222be

Browse files
committed
fix(eslint-config-ts): export flat config as array
1 parent 31de6f9 commit 63222be

File tree

3 files changed

+43
-44
lines changed

3 files changed

+43
-44
lines changed

Diff for: packages/eslint-config-ts/eslint-base.js

+20-21
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
const eslint = require('@eslint/js')
2-
const tseslint = require('typescript-eslint')
32
const globals = require('globals')
3+
const tseslint = require('typescript-eslint')
44

55
/**
6-
* @type { import('eslint').Linter.Config }
6+
* @type { import('typescript-eslint').ConfigArray }
77
*/
8-
module.exports = {
9-
...eslint.configs.recommended,
8+
module.exports = [
9+
eslint.configs.recommended,
1010
...tseslint.configs.recommended,
11-
languageOptions: {
12-
ecmaVersion: 2022,
13-
globals: {
14-
...globals.browser,
15-
...globals.es2021,
16-
...globals.node,
17-
document: 'readonly',
18-
navigator: 'readonly',
19-
window: 'readonly'
20-
},
21-
parserOptions: {
22-
ecmaFeatures: {
23-
jsx: true
24-
},
11+
{
12+
languageOptions: {
2513
ecmaVersion: 2022,
14+
globals: {
15+
...globals.browser,
16+
...globals.es2021,
17+
...globals.node
18+
},
19+
parserOptions: {
20+
ecmaFeatures: {
21+
jsx: true
22+
},
23+
ecmaVersion: 2022,
24+
sourceType: 'module'
25+
},
2626
sourceType: 'module'
27-
},
28-
sourceType: 'module'
27+
}
2928
}
30-
}
29+
]

Diff for: packages/eslint-config-ts/eslint-recommended.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
const base = require('./eslint-base')
22

33
/**
4-
* @type { import('eslint').Linter.Config }
4+
* @type { import('typescript-eslint').ConfigArray }
55
*/
6-
module.exports = {
6+
module.exports = [
77
...base,
8-
rules: {
9-
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }],
10-
'@typescript-eslint/explicit-function-return-type': 'error',
11-
'@typescript-eslint/explicit-module-boundary-types': 'off',
12-
'@typescript-eslint/no-empty-function': ['error', { allow: ['arrowFunctions'] }],
13-
'@typescript-eslint/no-empty-interface': ['error', { allowSingleExtends: true }],
14-
'@typescript-eslint/no-explicit-any': 'error',
15-
'@typescript-eslint/no-non-null-assertion': 'off',
16-
'@typescript-eslint/no-var-requires': 'off'
8+
{
9+
rules: {
10+
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }],
11+
'@typescript-eslint/explicit-function-return-type': 'error',
12+
'@typescript-eslint/explicit-module-boundary-types': 'off',
13+
'@typescript-eslint/no-empty-function': ['error', { allow: ['arrowFunctions'] }],
14+
'@typescript-eslint/no-empty-interface': ['error', { allowSingleExtends: true }],
15+
'@typescript-eslint/no-explicit-any': 'error',
16+
'@typescript-eslint/no-non-null-assertion': 'off',
17+
'@typescript-eslint/no-var-requires': 'off'
18+
}
1719
},
18-
overrides: [
19-
{
20-
files: ['*.js'],
21-
rules: {
22-
'@typescript-eslint/explicit-function-return-type': 'off'
23-
}
20+
{
21+
files: ['*.js', '*.mjs'],
22+
rules: {
23+
'@typescript-eslint/explicit-function-return-type': 'off'
2424
}
25-
]
26-
}
25+
}
26+
]

Diff for: packages/eslint-config-ts/index.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { Linter } from 'eslint';
21
import { config } from 'typescript-eslint';
2+
import type { ConfigArray } from 'typescript-eslint';
33

44
declare const _default: {
55
config: typeof config
66
configs: {
7-
base: Linter.Config,
8-
recommended: Linter.Config
7+
base: ConfigArray[],
8+
recommended: ConfigArray[]
99
}
1010
};
1111

12-
export = _default
12+
export = _default;

0 commit comments

Comments
 (0)