Skip to content

Commit b40648f

Browse files
authored
fix(utils): correct types to align with @types/eslint v9 (typescript-eslint#9657)
1 parent 60b7fb4 commit b40648f

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

packages/integration-tests/fixtures/flat-config-types-@types__eslint-v8/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"@eslint/js": "latest",
88
"@types/eslint": "^8",
99
"eslint": "latest",
10-
"@stylistic/eslint-plugin": "2.3.0",
10+
"@stylistic/eslint-plugin": "latest",
1111
"eslint-plugin-deprecation": "latest",
1212
"eslint-plugin-jest": "latest"
1313
}

packages/integration-tests/fixtures/flat-config-types-@types__eslint-v9/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"@eslint/js": "latest",
88
"@types/eslint": "^9",
99
"eslint": "latest",
10-
"@stylistic/eslint-plugin": "2.3.0",
10+
"@stylistic/eslint-plugin": "latest",
1111
"eslint-plugin-deprecation": "latest",
1212
"eslint-plugin-jest": "latest"
1313
}

packages/integration-tests/tests/flat-config-types-@types__eslint-v8.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ for (const additionalFlags of [
1515
out => {
1616
const lines = out.split('\n').filter(
1717
line =>
18+
line &&
1819
// error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
1920
// this is fine for us to ignore in this context
20-
line && !line.includes('error TS18028'),
21+
!line.includes('error TS18028'),
2122
);
2223

2324
// The types should not error (e.g. https://github.com/eslint-stylistic/eslint-stylistic/issues/276)

packages/integration-tests/tests/flat-config-types-@types__eslint-v9.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ for (const additionalFlags of [
1818
line &&
1919
// error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
2020
// this is fine for us to ignore in this context
21-
!line.includes('error TS18028') &&
22-
// currently expected errors from @stylistic/eslint-plugin as it doesn't support ESLint v9 types yet
23-
!line.startsWith('node_modules/@stylistic/eslint-plugin/'),
21+
!line.includes('error TS18028'),
2422
);
2523

2624
// The types should not error (e.g. https://github.com/eslint-stylistic/eslint-stylistic/issues/276)

packages/utils/src/ts-eslint/Config.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,18 @@ export namespace SharedConfig {
1616
export type RuleEntry = RuleLevel | RuleLevelAndOptions;
1717
export type RulesRecord = Partial<Record<string, RuleEntry>>;
1818

19-
export type GlobalVariableOptionBase = 'off' | 'readonly' | 'writable';
20-
export type GlobalVariableOption = GlobalVariableOptionBase | boolean;
19+
export type GlobalVariableOptionBase =
20+
| 'off'
21+
| 'readonly'
22+
| 'writable'
23+
| /** @deprecated use `'writable'` */ 'writeable'
24+
| /** @deprecated use `'readonly'` */ 'readable';
25+
export type GlobalVariableOptionBoolean =
26+
| /** @deprecated use `'writable'` */ true
27+
| /** @deprecated use `'readonly'` */ false;
28+
export type GlobalVariableOption =
29+
| GlobalVariableOptionBase
30+
| GlobalVariableOptionBoolean;
2131

2232
export interface GlobalsConfig {
2333
[name: string]: GlobalVariableOption;
@@ -199,7 +209,7 @@ export namespace FlatConfig {
199209
* Set to `"latest"` for the most recent supported version.
200210
* @default "latest"
201211
*/
202-
ecmaVersion?: EcmaVersion;
212+
ecmaVersion?: EcmaVersion | undefined;
203213
/**
204214
* An object specifying additional objects that should be added to the global scope during linting.
205215
*/
@@ -212,7 +222,7 @@ export namespace FlatConfig {
212222
* require('espree')
213223
* ```
214224
*/
215-
parser?: Parser;
225+
parser?: Parser | undefined;
216226
/**
217227
* An object specifying additional options that are passed directly to the parser.
218228
* The available options are parser-dependent.
@@ -229,7 +239,7 @@ export namespace FlatConfig {
229239
* "commonjs"
230240
* ```
231241
*/
232-
sourceType?: SourceType;
242+
sourceType?: SourceType | undefined;
233243
}
234244

235245
// it's not a json schema so it's nowhere near as nice to read and convert...

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy