8000 chore: enable eslint-plugin-perfectionist on types package (#9850) · abrahamguo/typescript-eslint@e87ab8c · GitHub
[go: up one dir, main page]

Skip to content

Commit e87ab8c

Browse files
chore: enable eslint-plugin-perfectionist on types package (typescript-eslint#9850)
1 parent 9f70ed1 commit e87ab8c

File tree

4 files changed

+70
-69
lines changed

4 files changed

+70
-69
lines changed

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,7 @@ export default tseslint.config(
575575
'packages/integration-tests/{tests,tools,typing}/**/*.ts',
576576
'packages/parser/{src,tests}/**/*.ts',
577577
'packages/rule-tester/{src,tests,typings}/**/*.ts',
578+
'packages/types/{src,tools}/**/*.ts',
578579
'packages/typescript-eslint/{src,tests}/**/*.ts',
579580
'packages/utils/src/**/*.ts',
580581
'packages/visitor-keys/src/**/*.ts',

packages/types/src/lib.ts

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,100 +4,100 @@
44
// npx nx generate-lib repo
55

66
type Lib =
7+
| 'decorators'
8+
| 'decorators.legacy'
9+
| 'dom'
10+
| 'dom.asynciterable'
11+
| 'dom.iterable'
712
| 'es5'
813
| 'es6'
9-
| 'es2015'
1014
| 'es7'
11-
| 'es2016'
12-
| 'es2017'
13-
| 'es2018'
14-
| 'es2019'
15-
| 'es2020'
16-
| 'es2021'
17-
| 'es2022'
18-
| 'es2023'
19-
| 'esnext'
20-
| 'dom'
21-
| 'dom.iterable'
22-
| 'dom.asynciterable'
23-
| 'webworker'
24-
| 'webworker.importscripts'
25-
| 'webworker.iterable'
26-
| 'webworker.asynciterable'
27-
| 'scripthost'
28-
| 'es2015.core'
15+
| 'es2015'
2916
| 'es2015.collection'
17+
| 'es2015.core'
3018
| 'es2015.generator'
3119
| 'es2015.iterable'
3220
| 'es2015.promise'
3321
| 'es2015.proxy'
3422
| 'es2015.reflect'
3523
| 'es2015.symbol'
3624
| 'es2015.symbol.wellknown'
25+
| 'es2016'
3726
| 'es2016.array.include'
27+
| 'es2016.full'
3828
| 'es2016.intl'
29+
| 'es2017'
3930
| 'es2017.date'
31+
| 'es2017.full'
32+
| 'es2017.intl'
4033
| 'es2017.object'
4134
| 'es2017.sharedmemory'
4235
| 'es2017.string'
43-
| 'es2017.intl'
4436
| 'es2017.typedarrays'
37+
| 'es2018'
4538
| 'es2018.asyncgenerator'
4639
| 'es2018.asynciterable'
40+
| 'es2018.full'
4741
| 'es2018.intl'
4842
| 'es2018.promise'
4943
| 'es2018.regexp'
44+
| 'es2019'
5045
| 'es2019.array'
46+
| 'es2019.full'
47+
| 'es2019.intl'
5148
| 'es2019.object'
5249
| 'es2019.string'
5350
| 'es2019.symbol'
54-
| 'es2019.intl'
51+
| 'es2020'
5552
| 'es2020.bigint'
5653
| 'es2020.date'
54+
| 'es2020.full'
55+
| 'es2020.intl'
56+
| 'es2020.number'
5757
| 'es2020.promise'
5858
| 'es2020.sharedmemory'
5959
| 'es2020.string'
6060
| 'es2020.symbol.wellknown'
61-
| 'es2020.intl'
62-
| 'es2020.number'
61+
| 'es2021'
62+
| 'es2021.full'
63+
| 'es2021.intl'
6364
| 'es2021.promise'
6465
| 'es2021.string'
6566
| 'es2021.weakref'
66-
| 'es2021.intl'
67+
| 'es2022'
6768
| 'es2022.array'
6869
| 'es2022.error'
70+
| 'es2022.full'
6971
| 'es2022.intl'
7072
| 'es2022.object'
73+
| 'es2022.regexp'
7174
| 'es2022.sharedmemory'
7275
| 'es2022.string'
73-
| 'es2022.regexp'
76+
| 'es2023'
7477
| 'es2023.array'
7578
| 'es2023.collection'
79+
| 'es2023.full'
7680
| 'es2023.intl'
81+
| 'esnext'
7782
| 'esnext.array'
78-
| 'esnext.collection'
79-
| 'esnext.symbol'
8083
| 'esnext.asynciterable'
81-
| 'esnext.intl'
82-
| 'esnext.disposable'
8384
| 'esnext.bigint'
84-
| 'esnext.string'
85-
| 'esnext.promise'
86-
| 'esnext.weakref'
85+
| 'esnext.collection'
8786
| 'esnext.decorators'
87+
| 'esnext.disposable'
88+
| 'esnext.full'
89+
| 'esnext.intl'
8890
| 'esnext.object'
91+
| 'esnext.promise'
8992
| 'esnext.regexp'
90-
| 'decorators'
91-
| 'decorators.legacy'
92-
| 'es2016.full'
93-
| 'es2017.full'
94-
| 'es2018.full'
95-
| 'es2019.full'
96-
| 'es2020.full'
97-
| 'es2021.full'
98-
| 'es2022.full'
99-
| 'es2023.full'
100-
| 'esnext.full'
101-
| 'lib';
93+
| 'esnext.string'
94+
| 'esnext.symbol'
95+
| 'esnext.weakref'
96+
| 'lib'
97+
| 'scripthost'
98+
| 'webworker'
99+
| 'webworker.asynciterable'
100+
| 'webworker.importscripts'
101+
| 'webworker.iterable';
102102

103103
export { Lib };

packages/types/src/parser-options.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import type { Program } from 'typescript';
22

33
import type { Lib } from './lib';
44

5-
type DebugLevel = ('eslint' | 'typescript-eslint' | 'typescript')[] | boolean;
6-
type CacheDurationSeconds = number | 'Infinity';
5+
type DebugLevel = ('eslint' | 'typescript' | 'typescript-eslint')[] | boolean;
6+
type CacheDurationSeconds = 'Infinity' | number;
77

88
type EcmaVersion =
9+
| 'latest'
910
| 3
1011
| 5
1112
| 6
@@ -30,11 +31,10 @@ type EcmaVersion =
3031
| 2023
3132
| 2024
3233
| 2025
33-
| 'latest'
3434
| undefined;
3535

3636
type SourceTypeClassic = 'module' | 'script';
37-
type SourceType = SourceTypeClassic | 'commonjs';
37+
type SourceType = 'commonjs' | SourceTypeClassic;
3838

3939
type JSDocParsingMode = 'all' | 'none' | 'type-info';
4040

@@ -65,46 +65,46 @@ interface ProjectServiceOptions {
6565

6666
// If you add publicly visible options here, make sure they're also documented in `docs/packages/Parser.mdx`
6767
interface ParserOptions {
68+
[additionalProperties: string]: unknown;
69+
cacheLifetime?: {
70+
glob?: CacheDurationSeconds;
71+
};
72+
73+
// typescript-estree specific
74+
debugLevel?: DebugLevel;
6875
ecmaFeatures?:
6976
| {
77+
[key: string]: unknown;
7078
globalReturn?: boolean | undefined;
7179
jsx?: boolean | undefined;
72-
[key: string]: unknown;
7380
}
7481
| undefined;
7582
ecmaVersion?: EcmaVersion;
7683

77-
// scope-manager specific
78-
jsxPragma?: string | null;
79-
jsxFragmentName?: string | null;
80-
lib?: Lib[];
81-
8284
// use emitDecoratorMetadata without specifying parserOptions.project
8385
emitDecoratorMetadata?: boolean;
84-
// use experimentalDecorators without specifying parserOptions.project
85-
experimentalDecorators?: boolean;
86-
87-
// typescript-estree specific
88-
debugLevel?: DebugLevel;
8986
errorOnTypeScriptSyntacticAndSemanticIssues?: boolean;
87+
9088
errorOnUnknownASTType?: boolean;
89+
// use experimentalDecorators without specifying parserOptions.project
90+
experimentalDecorators?: boolean;
9191
extraFileExtensions?: string[];
9292
filePath?: string;
9393
jsDocParsingMode?: JSDocParsingMode;
94+
jsxFragmentName?: string | null;
95+
// scope-manager specific
96+
jsxPragma?: string | null;
97+
lib?: Lib[];
9498
programs?: Program[] | null;
95-
project?: string[] | string | boolean | null;
99+
project?: string[] | boolean | string | null;
96100
projectFolderIgnoreList?: string[];
97-
projectService?: boolean | ProjectServiceOptions;
101+
projectService?: ProjectServiceOptions | boolean;
98102
range?: boolean;
99103
sourceType?: SourceType | undefined;
100104
tokens?: boolean;
101105
tsconfigRootDir?: string;
102-
warnOnUnsupportedTypeScriptVersion?: boolean;
103-
cacheLifetime?: {
104-
glob?: CacheDurationSeconds;
105-
};
106106

107-
[additionalProperties: string]: unknown;
107+
warnOnUnsupportedTypeScriptVersion?: boolean;
108108
}
109109

110110
export {

packages/types/src/ts-estree.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ declare module './generated/ast-spec' {
5151
}
5252

5353
interface ClassBody {
54-
parent: TSESTree.ClassExpression | TSESTree.ClassDeclaration;
54+
parent: TSESTree.ClassDeclaration | TSESTree.ClassExpression;
5555
}
5656

5757
interface ExportSpecifier {
@@ -216,8 +216,8 @@ declare module './generated/ast-spec' {
216216
interface TSTypeParameter {
217217
parent:
218218
| TSESTree.TSInferType
219-
| TSESTree.TSTypeParameterDeclaration
220-
| TSESTree.TSMappedType;
219+
| TSESTree.TSMappedType
220+
| TSESTree.TSTypeParameterDeclaration;
221221
}
222222
}
223223

0 commit comments

Comments
 (0)
0