Skip to content

chore: update typescript-eslint to v4.23.0 #1062

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
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
74 changes: 37 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"@types/lodash": "4.14.169",
"@types/minimatch": "3.0.4",
"@types/node": "12.20.13",
"@typescript-eslint/eslint-plugin": "4.20.0",
"@typescript-eslint/parser": "4.20.0",
"@typescript-eslint/eslint-plugin": "4.23.0",
"@typescript-eslint/parser": "4.23.0",
"babel-jest": "26.6.3",
"eslint": "7.26.0",
"husky": "6.0.0",
Expand Down
10 changes: 5 additions & 5 deletions src/converters/comments/convertComments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe("convertComments", () => {
dependencies,
{ comments: undefined },
createStubOriginalConfigurationsData(),
new Map(),
new Map<string, string[]>(),
);

// Assert
Expand All @@ -49,7 +49,7 @@ describe("convertComments", () => {
dependencies,
{ comments: true },
createStubOriginalConfigurationsData(),
new Map(),
new Map<string, string[]>(),
);

// Assert
Expand All @@ -74,7 +74,7 @@ describe("convertComments", () => {
dependencies,
{ comments: true },
createStubOriginalConfigurationsData(),
new Map(),
new Map<string, string[]>(),
);

// Assert
Expand All @@ -96,7 +96,7 @@ describe("convertComments", () => {
dependencies,
{ comments: ["*.ts"] },
createStubOriginalConfigurationsData(),
new Map(),
new Map<string, string[]>(),
);

// Assert
Expand All @@ -115,7 +115,7 @@ describe("convertComments", () => {
dependencies,
{ comments: ["*.ts"] },
createStubOriginalConfigurationsData(),
new Map(),
new Map<string, string[]>(),
);

// Assert
Expand Down
46 changes: 38 additions & 8 deletions src/converters/comments/convertFileComments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ describe("convertFileComments", () => {
const dependencies = createStubDependencies(readFileError);

// Act
const result = await convertFileComments(dependencies, stubFileName, new Map(), new Map());
const result = await convertFileComments(
dependencies,
stubFileName,
new Map<string, string[]>(),
new Map<string, string[]>(),
);

// Assert
expect(result).toBe(readFileError);
Expand All @@ -39,7 +44,12 @@ describe("convertFileComments", () => {
`);

// Act
await convertFileComments(dependencies, stubFileName, new Map(), new Map());
await convertFileComments(
dependencies,
stubFileName,
new Map<string, string[]>(),
new Map<string, string[]>(),
);

// Assert
expect(dependencies.fileSystem.writeFile).not.toHaveBeenCalled();
Expand Down Expand Up @@ -70,7 +80,12 @@ export const g = true;
`);

// Act
await convertFileComments(dependencies, stubFileName, new Map(), new Map());
await convertFileComments(
dependencies,
stubFileName,
new Map<string, string[]>(),
new Map<string, string[]>(),
);

// Assert
expect(dependencies.fileSystem.writeFile).toHaveBeenCalledWith(
Expand Down Expand Up @@ -110,7 +125,12 @@ export const b = true;
`);

// Act
await convertFileComments(dependencies, stubFileName, new Map(), new Map());
await convertFileComments(
dependencies,
stubFileName,
new Map<string, string[]>(),
new Map<string, string[]>(),
);

// Assert
expect(dependencies.fileSystem.writeFile).toHaveBeenCalledWith(
Expand All @@ -136,7 +156,7 @@ export const a = true;
await convertFileComments(
dependencies,
stubFileName,
new Map(),
new Map<string, string[]>(),
new Map([["ts-a", ["es-cached"]]]),
);

Expand All @@ -162,7 +182,7 @@ export const a = true;
dependencies,
stubFileName,
new Map([["ts-a", ["es-cached"]]]),
new Map(),
new Map<string, string[]>(),
);

// Assert
Expand All @@ -183,7 +203,12 @@ export const a = true;
`);

// Act
await convertFileComments(dependencies, stubFileName, new Map(), new Map());
await convertFileComments(
dependencies,
stubFileName,
new Map<string, string[]>(),
new Map<string, string[]>(),
);

// Assert
expect(dependencies.fileSystem.writeFile).toHaveBeenCalledWith(
Expand All @@ -203,7 +228,12 @@ export const a = true;
`);

// Act
await convertFileComments(dependencies, stubFileName, new Map(), new Map());
await convertFileComments(
dependencies,
stubFileName,
new Map<string, string[]>(),
new Map<string, string[]>(),
);

// Assert
expect(dependencies.fileSystem.writeFile).toHaveBeenCalledWith(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ const knownMissingSettings = [
];

export const convertVSCodeConfig: EditorConfigConverter = (rawEditorSettings, settings) => {
const editorSettings = parseJson(rawEditorSettings);
const autoFixOnSave = editorSettings["editor.codeActionsOnSave"]?.["source.fixAll.tslint"];
const editorSettings: Record<string, string | number | symbol> = parseJson(rawEditorSettings);
const autoFixOnSave =
editorSettings["editor.codeActionsOnSave"] &&
typeof editorSettings["editor.codeActionsOnSave"] === "object" &&
editorSettings["editor.codeActionsOnSave"]?.["source.fixAll.tslint"];

// Only create a new config file path if the input and output configs roughly match
const eslintPathMatches =
editorSettings["tslint.configFile"] &&
typeof editorSettings["tslint.configFile"] === "string" &&
!path.relative(
path.dirname(editorSettings["tslint.configFile"]),
path.dirname(settings.config),
Expand Down
4 changes: 2 additions & 2 deletions src/converters/lintConfigs/convertLintConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("convertLintConfig", () => {
dependencies,
stubSettings,
createStubOriginalConfigurationsData(),
new Map(),
new Map<string, string[]>(),
);

// Assert
Expand All @@ -62,7 +62,7 @@ describe("convertLintConfig", () => {
dependencies,
stubSettings,
createStubOriginalConfigurationsData(),
new Map(),
new Map<string, string[]>(),
);

// Assert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("createESLintConfiguration", () => {
dependencies,
originalConfigurations,
true,
new Map(),
new Map<string, string[]>(),
);

// Assert
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const withKeysSorted = (input: any) => {
const output: Record<string, any> = {};
const keys = Object.keys(input).sort((a, b) => a.localeCompare(b));
export const withKeysSorted = <T extends Record<string, unknown>>(input: T) => {
const output = {} as T;
const keys: (keyof T)[] = Object.keys(input).sort((a, b) => a.localeCompare(b));

for (const key of keys) {
output[key] = input[key];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("removeExtendsDuplicatedRules", () => {
});

// Act
const { differentRules } = removeExtendsDuplicatedRules(allRules, new Map());
const { differentRules } = removeExtendsDuplicatedRules(allRules, new Map<string, ESLintRuleOptionsWithArguments>());

// Assert
expect(differentRules.size).toBe(1);
Expand Down
2 changes: 1 addition & 1 deletion src/converters/lintConfigs/rules/convertRule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TSLintRuleOptions } from "./types";
describe("convertRule", () => {
it("returns undefined when no converter exists for a rule", () => {
// Arrange
const converters = new Map();
const converters = new Map<string, RuleConverter>();

// Act
const result = convertRule(
Expand Down
5 changes: 3 additions & 2 deletions src/converters/lintConfigs/rules/convertRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export const convertRule = (

try {
return converter(tslintRule);
} catch (error) {
return ConversionError.forRuleError(error, tslintRule);
} catch (error: unknown) {
// TODO: Maybe we can provide a different error message for generic errors.
return ConversionError.forRuleError(error as Error, tslintRule);
}
};
Loading