Skip to content

Commit cd7735f

Browse files
chore: update typescript-eslint to v4.23.0 (#1062)
* chore(deps): update typescript-eslint monorepo to v4.23.0 * misc: correct eslint warnings * misc: no clue why the original rules stub was an array instead of a record Co-authored-by: Renovate Bot <bot@renovateapp.com>
1 parent f12bdbc commit cd7735f

25 files changed

+139
-96
lines changed

package-lock.json

Lines changed: 37 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
"@types/lodash": "4.14.169",
3535
"@types/minimatch": "3.0.4",
3636
"@types/node": "12.20.13",
37-
"@typescript-eslint/eslint-plugin": "4.20.0",
38-
"@typescript-eslint/parser": "4.20.0",
37+
"@typescript-eslint/eslint-plugin": "4.23.0",
38+
"@typescript-eslint/parser": "4.23.0",
3939
"babel-jest": "26.6.3",
4040
"eslint": "7.26.0",
4141
"husky": "6.0.0",

src/converters/comments/convertComments.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe("convertComments", () => {
2727
dependencies,
2828
{ comments: undefined },
2929
createStubOriginalConfigurationsData(),
30-
new Map(),
30+
new Map<string, string[]>(),
3131
);
3232

3333
// Assert
@@ -49,7 +49,7 @@ describe("convertComments", () => {
4949
dependencies,
5050
{ comments: true },
5151
createStubOriginalConfigurationsData(),
52-
new Map(),
52+
new Map<string, string[]>(),
5353
);
5454

5555
// Assert
@@ -74,7 +74,7 @@ describe("convertComments", () => {
7474
dependencies,
7575
{ comments: true },
7676
createStubOriginalConfigurationsData(),
77-
new Map(),
77+
new Map<string, string[]>(),
7878
);
7979

8080
// Assert
@@ -96,7 +96,7 @@ describe("convertComments", () => {
9696
dependencies,
9797
{ comments: ["*.ts"] },
9898
createStubOriginalConfigurationsData(),
99-
new Map(),
99+
new Map<string, string[]>(),
100100
);
101101

102102
// Assert
@@ -115,7 +115,7 @@ describe("convertComments", () => {
115115
dependencies,
116116
{ comments: ["*.ts"] },
117117
createStubOriginalConfigurationsData(),
118-
new Map(),
118+
new Map<string, string[]>(),
119119
);
120120

121121
// Assert

src/converters/comments/convertFileComments.test.ts

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ describe("convertFileComments", () => {
2626
const dependencies = createStubDependencies(readFileError);
2727

2828
// Act
29-
const result = await convertFileComments(dependencies, stubFileName, new Map(), new Map());
29+
const result = await convertFileComments(
30+
dependencies,
31+
stubFileName,
32+
new Map<string, string[]>(),
33+
new Map<string, string[]>(),
34+
);
3035

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

4146
// Act
42-
await convertFileComments(dependencies, stubFileName, new Map(), new Map());
47+
await convertFileComments(
48+
dependencies,
49+
stubFileName,
50+
new Map<string, string[]>(),
51+
new Map<string, string[]>(),
52+
);
4353

4454
// Assert
4555
expect(dependencies.fileSystem.writeFile).not.toHaveBeenCalled();
@@ -70,7 +80,12 @@ export const g = true;
7080
`);
7181

7282
// Act
73-
await convertFileComments(dependencies, stubFileName, new Map(), new Map());
83+
await convertFileComments(
84+
dependencies,
85+
stubFileName,
86+
new Map<string, string[]>(),
87+
new Map<string, string[]>(),
88+
);
7489

7590
// Assert
7691
expect(dependencies.fileSystem.writeFile).toHaveBeenCalledWith(
@@ -110,7 +125,12 @@ export const b = true;
110125
`);
111126

112127
// Act
113-
await convertFileComments(dependencies, stubFileName, new Map(), new Map());
128+
await convertFileComments(
129+
dependencies,
130+
stubFileName,
131+
new Map<string, string[]>(),
132+
new Map<string, string[]>(),
133+
);
114134

115135
// Assert
116136
expect(dependencies.fileSystem.writeFile).toHaveBeenCalledWith(
@@ -136,7 +156,7 @@ export const a = true;
136156
await convertFileComments(
137157
dependencies,
138158
stubFileName,
139-
new Map(),
159+
new Map<string, string[]>(),
140160
new Map([["ts-a", ["es-cached"]]]),
141161
);
142162

@@ -162,7 +182,7 @@ export const a = true;
162182
dependencies,
163183
stubFileName,
164184
new Map([["ts-a", ["es-cached"]]]),
165-
new Map(),
185+
new Map<string, string[]>(),
166186
);
167187

168188
// Assert
@@ -183,7 +203,12 @@ export const a = true;
183203
`);
184204

185205
// Act
186-
await convertFileComments(dependencies, stubFileName, new Map(), new Map());
206+
await convertFileComments(
207+
dependencies,
208+
stubFileName,
209+
new Map<string, string[]>(),
210+
new Map<string, string[]>(),
211+
);
187212

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

205230
// Act
206-
await convertFileComments(dependencies, stubFileName, new Map(), new Map());
231+
await convertFileComments(
232+
dependencies,
233+
stubFileName,
234+
new Map<string, string[]>(),
235+
new Map<string, string[]>(),
236+
);
207237

208238
// Assert
209239
expect(dependencies.fileSystem.writeFile).toHaveBeenCalledWith(

src/converters/editorConfigs/converters/convertVSCodeConfig.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ const knownMissingSettings = [
1313
];
1414

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

1922
// Only create a new config file path if the input and output configs roughly match
2023
const eslintPathMatches =
2124
editorSettings["tslint.configFile"] &&
25+
typeof editorSettings["tslint.configFile"] === "string" &&
2226
!path.relative(
2327
path.dirname(editorSettings["tslint.configFile"]),
2428
path.dirname(settings.config),

src/converters/lintConfigs/convertLintConfig.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe("convertLintConfig", () => {
3636
dependencies,
3737
stubSettings,
3838
createStubOriginalConfigurationsData(),
39-
new Map(),
39+
new Map<string, string[]>(),
4040
);
4141

4242
// Assert
@@ -62,7 +62,7 @@ describe("convertLintConfig", () => {
6262
dependencies,
6363
stubSettings,
6464
createStubOriginalConfigurationsData(),
65-
new Map(),
65+
new Map<string, string[]>(),
6666
);
6767

6868
// Assert

src/converters/lintConfigs/createESLintConfiguration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe("createESLintConfiguration", () => {
1717
dependencies,
1818
originalConfigurations,
1919
true,
20-
new Map(),
20+
new Map<string, string[]>(),
2121
);
2222

2323
// Assert

src/converters/lintConfigs/formatting/formatters/withKeysSorted.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
export const withKeysSorted = (input: any) => {
2-
const output: Record<string, any> = {};
3-
const keys = Object.keys(input).sort((a, b) => a.localeCompare(b));
1+
export const withKeysSorted = <T extends Record<string, unknown>>(input: T) => {
2+
const output = {} as T;
3+
const keys: (keyof T)[] = Object.keys(input).sort((a, b) => a.localeCompare(b));
44

55
for (const key of keys) {
66
output[key] = input[key];

src/converters/lintConfigs/pruning/removeExtendsDuplicatedRules.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe("removeExtendsDuplicatedRules", () => {
3333
});
3434

3535
// Act
36-
const { differentRules } = removeExtendsDuplicatedRules(allRules, new Map());
36+
const { differentRules } = removeExtendsDuplicatedRules(allRules, new Map<string, ESLintRuleOptionsWithArguments>());
3737

3838
// Assert
3939
expect(differentRules.size).toBe(1);

src/converters/lintConfigs/rules/convertRule.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { TSLintRuleOptions } from "./types";
66
describe("convertRule", () => {
77
it("returns undefined when no converter exists for a rule", () => {
88
// Arrange
9-
const converters = new Map();
9+
const converters = new Map<string, RuleConverter>();
1010

1111
// Act
1212
const result = convertRule(

src/converters/lintConfigs/rules/convertRule.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export const convertRule = (
1313

1414
try {
1515
return converter(tslintRule);
16-
} catch (error) {
17-
return ConversionError.forRuleError(error, tslintRule);
16+
} catch (error: unknown) {
17+
// TODO: Maybe we can provide a different error message for generic errors.
18+
return ConversionError.forRuleError(error as Error, tslintRule);
1819
}
1920
};

0 commit comments

Comments
 (0)