Error on unused eslint directives, reenable lost eslint rules (#57350)

This commit is contained in:
Jake Bailey 2024-02-27 10:49:41 -08:00 committed by GitHub
parent a77370342d
commit 23156cb970
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 13 additions and 10 deletions

View File

@ -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",

View File

@ -517,6 +517,7 @@ export const lint = task({
`${folder}/.eslintcache`,
"--format",
formatter,
"--report-unused-disable-directives",
];
if (cmdLineOptions.fix) {

View File

@ -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,

View File

@ -349,7 +349,7 @@ interface PackageJson extends PackageJsonPathFields {
}
function readPackageJsonField<K extends MatchingKeys<PackageJson, string | undefined>>(jsonContent: PackageJson, fieldName: K, typeOfTag: "string", state: ModuleResolutionState): PackageJson[K] | undefined;
function readPackageJsonField<K extends MatchingKeys<PackageJson, object | undefined>>(jsonContent: PackageJson, fieldName: K, typeOfTag: "object", state: ModuleResolutionState): PackageJson[K] | undefined;
function readPackageJsonField<K extends MatchingKeys<PackageJson, object | undefined>>(jsonContent: PackageJson, fieldName: K, typeOfTag: "object", state: ModuleResolutionState): PackageJson[K] | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
function readPackageJsonField<K extends keyof PackageJson>(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<CompilerOptions, RedirectsCacheKey>,
optionsToRedirectsKey?: Map<CompilerOptions, RedirectsCacheKey>, // 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<CompilerOptions, RedirectsCacheKey>,
optionsToRedirectsKey?: Map<CompilerOptions, RedirectsCacheKey>, // 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;

View File

@ -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<ImportAttribute>, multiLine?: boolean): ImportAttributes;
/** @internal */ createImportAttributes(elements: NodeArray<ImportAttribute>, multiLine?: boolean, token?: ImportAttributes["token"]): ImportAttributes;
/** @internal */ createImportAttributes(elements: NodeArray<ImportAttribute>, multiLine?: boolean, token?: ImportAttributes["token"]): ImportAttributes; // eslint-disable-line @typescript-eslint/unified-signatures
updateImportAttributes(node: ImportAttributes, elements: NodeArray<ImportAttribute>, multiLine?: boolean): ImportAttributes;
createImportAttribute(name: ImportAttributeName, value: Expression): ImportAttribute;
updateImportAttribute(node: ImportAttribute, name: ImportAttributeName, value: Expression): ImportAttribute;

View File

@ -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);

View File

@ -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";
}