Skip to content

chore: enable eslint-plugin-perfectionist on types package #9850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ export default tseslint.config(
'packages/integration-tests/{tests,tools,typing}/**/*.ts',
'packages/parser/{src,tests}/**/*.ts',
'packages/rule-tester/{src,tests,typings}/**/*.ts',
'packages/types/{src,tools}/**/*.ts',
'packages/typescript-eslint/{src,tests}/**/*.ts',
'packages/utils/src/**/*.ts',
'packages/visitor-keys/src/**/*.ts',
Expand Down
88 changes: 44 additions & 44 deletions packages/types/src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,100 +4,100 @@
// npx nx generate-lib repo

type Lib =
| 'decorators'
| 'decorators.legacy'
| 'dom'
| 'dom.asynciterable'
| 'dom.iterable'
| 'es5'
| 'es6'
| 'es2015'
| 'es7'
| 'es2016'
| 'es2017'
| 'es2018'
| 'es2019'
| 'es2020'
| 'es2021'
| 'es2022'
| 'es2023'
| 'esnext'
| 'dom'
| 'dom.iterable'
| 'dom.asynciterable'
| 'webworker'
| 'webworker.importscripts'
| 'webworker.iterable'
| 'webworker.asynciterable'
| 'scripthost'
| 'es2015.core'
| 'es2015'
| 'es2015.collection'
| 'es2015.core'
| 'es2015.generator'
| 'es2015.iterable'
| 'es2015.promise'
| 'es2015.proxy'
| 'es2015.reflect'
| 'es2015.symbol'
| 'es2015.symbol.wellknown'
| 'es2016'
| 'es2016.array.include'
| 'es2016.full'
| 'es2016.intl'
| 'es2017'
| 'es2017.date'
| 'es2017.full'
| 'es2017.intl'
| 'es2017.object'
| 'es2017.sharedmemory'
| 'es2017.string'
| 'es2017.intl'
| 'es2017.typedarrays'
| 'es2018'
| 'es2018.asyncgenerator'
| 'es2018.asynciterable'
| 'es2018.full'
| 'es2018.intl'
| 'es2018.promise'
| 'es2018.regexp'
| 'es2019'
| 'es2019.array'
| 'es2019.full'
| 'es2019.intl'
| 'es2019.object'
| 'es2019.string'
| 'es2019.symbol'
| 'es2019.intl'
| 'es2020'
| 'es2020.bigint'
| 'es2020.date'
| 'es2020.full'
| 'es2020.intl'
| 'es2020.number'
| 'es2020.promise'
| 'es2020.sharedmemory'
| 'es2020.string'
| 'es2020.symbol.wellknown'
| 'es2020.intl'
| 'es2020.number'
| 'es2021'
| 'es2021.full'
| 'es2021.intl'
| 'es2021.promise'
| 'es2021.string'
| 'es2021.weakref'
| 'es2021.intl'
| 'es2022'
| 'es2022.array'
| 'es2022.error'
| 'es2022.full'
| 'es2022.intl'
| 'es2022.object'
| 'es2022.regexp'
| 'es2022.sharedmemory'
| 'es2022.string'
| 'es2022.regexp'
| 'es2023'
| 'es2023.array'
| 'es2023.collection'
| 'es2023.full'
| 'es2023.intl'
| 'esnext'
| 'esnext.array'
| 'esnext.collection'
| 'esnext.symbol'
| 'esnext.asynciterable'
| 'esnext.intl'
| 'esnext.disposable'
| 'esnext.bigint'
| 'esnext.string'
| 'esnext.promise'
| 'esnext.weakref'
| 'esnext.collection'
| 'esnext.decorators'
| 'esnext.disposable'
| 'esnext.full'
| 'esnext.intl'
| 'esnext.object'
| 'esnext.promise'
| 'esnext.regexp'
| 'decorators'
| 'decorators.legacy'
| 'es2016.full'
| 'es2017.full'
| 'es2018.full'
| 'es2019.full'
| 'es2020.full'
| 'es2021.full'
| 'es2022.full'
| 'es2023.full'
| 'esnext.full'
| 'lib';
| 'esnext.string'
| 'esnext.symbol'
| 'esnext.weakref'
| 'lib'
| 'scripthost'
| 'webworker'
| 'webworker.asynciterable'
| 'webworker.importscripts'
| 'webworker.iterable';

export { Lib };
44 changes: 22 additions & 22 deletions packages/types/src/parser-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import type { Program } from 'typescript';

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

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

type EcmaVersion =
| 'latest'
| 3
| 5
| 6
Expand All @@ -30,11 +31,10 @@ type EcmaVersion =
| 2023
| 2024
| 2025
| 'latest'
| undefined;

type SourceTypeClassic = 'module' | 'script';
type SourceType = SourceTypeClassic | 'commonjs';
type SourceType = 'commonjs' | SourceTypeClassic;

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

Expand Down Expand Up @@ -65,46 +65,46 @@ interface ProjectServiceOptions {

// If you add publicly visible options here, make sure they're also documented in `docs/packages/Parser.mdx`
interface ParserOptions {
[additionalProperties: string]: unknown;
cacheLifetime?: {
glob?: CacheDurationSeconds;
};

// typescript-estree specific
debugLevel?: DebugLevel;
ecmaFeatures?:
| {
[key: string]: unknown;
globalReturn?: boolean | undefined;
jsx?: boolean | undefined;
[key: string]: unknown;
}
| undefined;
ecmaVersion?: EcmaVersion;

// scope-manager specific
jsxPragma?: string | null;
jsxFragmentName?: string | null;
lib?: Lib[];

// use emitDecoratorMetadata without specifying parserOptions.project
emitDecoratorMetadata?: boolean;
// use experimentalDecorators without specifying parserOptions.project
experimentalDecorators?: boolean;

// typescript-estree specific
debugLevel?: DebugLevel;
errorOnTypeScriptSyntacticAndSemanticIssues?: boolean;

errorOnUnknownASTType?: boolean;
// use experimentalDecorators without specifying parserOptions.project
experimentalDecorators?: boolean;
extraFileExtensions?: string[];
filePath?: string;
jsDocParsingMode?: JSDocParsingMode;
jsxFragmentName?: string | null;
// scope-manager specific
jsxPragma?: string | null;
lib?: Lib[];
programs?: Program[] | null;
project?: string[] | string | boolean | null;
project?: string[] | boolean | string | null;
projectFolderIgnoreList?: string[];
projectService?: boolean | ProjectServiceOptions;
projectService?: ProjectServiceOptions | boolean;
range?: boolean;
sourceType?: SourceType | undefined;
tokens?: boolean;
tsconfigRootDir?: string;
warnOnUnsupportedTypeScriptVersion?: boolean;
cacheLifetime?: {
glob?: CacheDurationSeconds;
};

[additionalProperties: string]: unknown;
warnOnUnsupportedTypeScriptVersion?: boolean;
}

export {
Expand Down
6 changes: 3 additions & 3 deletions packages/types/src/ts-estree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ declare module './generated/ast-spec' {
}

interface ClassBody {
parent: TSESTree.ClassExpression | TSESTree.ClassDeclaration;
parent: TSESTree.ClassDeclaration | TSESTree.ClassExpression;
}

interface ExportSpecifier {
Expand Down Expand Up @@ -216,8 +216,8 @@ declare module './generated/ast-spec' {
interface TSTypeParameter {
parent:
| TSESTree.TSInferType
| TSESTree.TSTypeParameterDeclaration
| TSESTree.TSMappedType;
| TSESTree.TSMappedType
| TSESTree.TSTypeParameterDeclaration;
}
}

Expand Down
Loading