+11
-4
lines changedFilter options
+11
-4
lines changed Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import process from 'node:process'
2
2
import type { ConfigItem, OptionsComponentExts, OptionsOverrides, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes } from '../types'
3
3
import { GLOB_SRC } from '../globs'
4
4
import { parserTs, pluginAntfu, pluginImport, pluginTs } from '../plugins'
5
-
import { renameRules } from '../utils'
5
+
import { renameRules, toArray } from '../utils'
6
6
7
7
export function typescript(
8
8
options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions,
@@ -11,7 +11,6 @@ export function typescript(
11
11
componentExts = [],
12
12
overrides = {},
13
13
parserOptions = {},
14
-
tsconfigPath,
15
14
} = options ?? {}
16
15
17
16
const typeAwareRules: ConfigItem['rules'] = {
@@ -36,6 +35,10 @@ export function typescript(
36
35
'ts/unbound-method': 'error',
37
36
}
38
37
38
+
const tsconfigPath = options?.tsconfigPath
39
+
? toArray(options.tsconfigPath)
40
+
: undefined
41
+
39
42
return [
40
43
{
41
44
// Install the plugins without globs, so they can be configured separately.
@@ -58,7 +61,7 @@ export function typescript(
58
61
sourceType: 'module',
59
62
...tsconfigPath
60
63
? {
61
-
project: [tsconfigPath],
64
+
project: tsconfigPath,
62
65
tsconfigRootDir: process.cwd(),
63
66
}
64
67
: {},
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ export interface OptionsTypeScriptWithTypes {
86
86
* When this options is provided, type aware rules will be enabled.
87
87
* @see https://typescript-eslint.io/linting/typed-linting/
88
88
*/
89
-
tsconfigPath?: string
89
+
tsconfigPath?: string | string[]
90
90
}
91
91
92
92
export interface OptionsHasTypeScript {
Original file line number Diff line number Diff line change
@@ -17,3 +17,7 @@ export function renameRules(rules: Record<string, any>, from: string, to: string
17
17
}),
18
18
)
19
19
}
20
+
21
+
export function toArray<T>(value: T | T[]): T[] {
22
+
return Array.isArray(value) ? value : [value]
23
+
}
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4