diff --git a/.eslintrc.json b/.eslintrc.json index a6d1b6345b4..1fdedf0965a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -82,6 +82,10 @@ { "selector": "property", "format": null } ], + "@typescript-eslint/unified-signatures": "error", + "no-unused-expressions": "off", + "@typescript-eslint/no-unused-expressions": ["error", { "allowTernary": true }], + // Rules enabled in typescript-eslint configs that are not applicable here "@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/class-literal-property-style": "off", diff --git a/Herebyfile.mjs b/Herebyfile.mjs index c3acff2969e..dfb94e5d996 100644 --- a/Herebyfile.mjs +++ b/Herebyfile.mjs @@ -517,6 +517,7 @@ export const lint = task({ `${folder}/.eslintcache`, "--format", formatter, + "--report-unused-disable-directives", ]; if (cmdLineOptions.fix) { diff --git a/scripts/build/options.mjs b/scripts/build/options.mjs index be5ef5ae4ea..c4cb9c47233 100644 --- a/scripts/build/options.mjs +++ b/scripts/build/options.mjs @@ -7,7 +7,6 @@ const parsed = minimist(process.argv.slice(2), { boolean: ["dirty", "light", "colors", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built", "ci", "bundle", "typecheck", "lint", "coverage"], string: ["browser", "tests", "break", "host", "reporter", "stackTraceLimit", "timeout", "shards", "shardId"], alias: { - /* eslint-disable quote-props */ b: "browser", i: ["inspect", "inspect-brk", "break", "debug", "debug-brk"], t: ["tests", "test"], @@ -17,7 +16,6 @@ const parsed = minimist(process.argv.slice(2), { skippercent: "skipPercent", w: "workers", f: "fix", - /* eslint-enable quote-props */ }, default: { soft: false, diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index d29142c7214..bdfaee183e5 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -349,7 +349,7 @@ interface PackageJson extends PackageJsonPathFields { } function readPackageJsonField>(jsonContent: PackageJson, fieldName: K, typeOfTag: "string", state: ModuleResolutionState): PackageJson[K] | undefined; -function readPackageJsonField>(jsonContent: PackageJson, fieldName: K, typeOfTag: "object", state: ModuleResolutionState): PackageJson[K] | undefined; +function readPackageJsonField>(jsonContent: PackageJson, fieldName: K, typeOfTag: "object", state: ModuleResolutionState): PackageJson[K] | undefined; // eslint-disable-line @typescript-eslint/unified-signatures function readPackageJsonField(jsonContent: PackageJson, fieldName: K, typeOfTag: "string" | "object", state: ModuleResolutionState): PackageJson[K] | undefined { if (!hasProperty(jsonContent, fieldName)) { if (state.traceEnabled) { @@ -1327,7 +1327,7 @@ export function createModuleResolutionCache( getCanonicalFileName: (s: string) => string, options?: CompilerOptions, packageJsonInfoCache?: PackageJsonInfoCache, - optionsToRedirectsKey?: Map, + optionsToRedirectsKey?: Map, // eslint-disable-line @typescript-eslint/unified-signatures ): ModuleResolutionCache; export function createModuleResolutionCache( currentDirectory: string, @@ -1360,7 +1360,7 @@ export function createTypeReferenceDirectiveResolutionCache( getCanonicalFileName: (s: string) => string, options?: CompilerOptions, packageJsonInfoCache?: PackageJsonInfoCache, - optionsToRedirectsKey?: Map, + optionsToRedirectsKey?: Map, // eslint-disable-line @typescript-eslint/unified-signatures ): TypeReferenceDirectiveResolutionCache; export function createTypeReferenceDirectiveResolutionCache( currentDirectory: string, @@ -1754,7 +1754,7 @@ function tryResolveJSModuleWorker(moduleName: string, initialDir: string, host: } export function bundlerModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; /** @internal */ -export function bundlerModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, conditions?: string[]): ResolvedModuleWithFailedLookupLocations; +export function bundlerModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, conditions?: string[]): ResolvedModuleWithFailedLookupLocations; // eslint-disable-line @typescript-eslint/unified-signatures export function bundlerModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, conditions?: string[]): ResolvedModuleWithFailedLookupLocations { const containingDirectory = getDirectoryPath(containingFile); let extensions = compilerOptions.noDtsResolution ? Extensions.ImplementationFiles : Extensions.TypeScript | Extensions.JavaScript | Extensions.Declaration; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 28061c88e94..e7865b66c1f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -8697,7 +8697,7 @@ export interface NodeFactory { /** @deprecated */ createImportTypeAssertionContainer(clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; /** @deprecated */ updateImportTypeAssertionContainer(node: ImportTypeAssertionContainer, clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; createImportAttributes(elements: NodeArray, multiLine?: boolean): ImportAttributes; - /** @internal */ createImportAttributes(elements: NodeArray, multiLine?: boolean, token?: ImportAttributes["token"]): ImportAttributes; + /** @internal */ createImportAttributes(elements: NodeArray, multiLine?: boolean, token?: ImportAttributes["token"]): ImportAttributes; // eslint-disable-line @typescript-eslint/unified-signatures updateImportAttributes(node: ImportAttributes, elements: NodeArray, multiLine?: boolean): ImportAttributes; createImportAttribute(name: ImportAttributeName, value: Expression): ImportAttribute; updateImportAttribute(node: ImportAttribute, name: ImportAttributeName, value: Expression): ImportAttribute; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index fe006c4c6ee..5632d364304 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -4202,7 +4202,7 @@ export class ProjectService { closeExternalProject(uncheckedFileName: string): void; /** @internal */ - closeExternalProject(uncheckedFileName: string, print: boolean): void; + closeExternalProject(uncheckedFileName: string, print: boolean): void; // eslint-disable-line @typescript-eslint/unified-signatures closeExternalProject(uncheckedFileName: string, print?: boolean): void { const fileName = toNormalizedPath(uncheckedFileName); const configuredProjects = this.externalProjectToConfiguredProjectMap.get(fileName); @@ -4373,7 +4373,7 @@ export class ProjectService { openExternalProject(proj: protocol.ExternalProject): void; /** @internal */ - openExternalProject(proj: protocol.ExternalProject, print: boolean): void; + openExternalProject(proj: protocol.ExternalProject, print: boolean): void; // eslint-disable-line @typescript-eslint/unified-signatures openExternalProject(proj: protocol.ExternalProject, print?: boolean): void { const existingExternalProject = this.findExternalProjectByProjectName(proj.projectFileName); const existingConfiguredProjects = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName); diff --git a/src/typingsInstallerCore/typingsInstaller.ts b/src/typingsInstallerCore/typingsInstaller.ts index 96a7d169d0c..412faeb4b42 100644 --- a/src/typingsInstallerCore/typingsInstaller.ts +++ b/src/typingsInstallerCore/typingsInstaller.ts @@ -526,7 +526,7 @@ export abstract class TypingsInstaller { protected abstract installWorker(requestId: number, packageNames: string[], cwd: string, onRequestCompleted: RequestCompletedAction): void; protected abstract sendResponse(response: SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes | WatchTypingLocations): void; /** @internal */ - protected abstract sendResponse(response: SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes | WatchTypingLocations | PackageInstalledResponse | TypesRegistryResponse): void; + protected abstract sendResponse(response: SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes | WatchTypingLocations | PackageInstalledResponse | TypesRegistryResponse): void; // eslint-disable-line @typescript-eslint/unified-signatures protected readonly latestDistTag = "latest"; }