Skip to content

Commit 51d39cc

Browse files
authored
chore: use @typescript-eslint v8 in development (#1757)
* chore: use v8 for `@typescript-eslint` in development * refactor: make typescript happy * chore: add types for removed properties on interface
1 parent d3c480f commit 51d39cc

File tree

5 files changed

+127
-133
lines changed

5 files changed

+127
-133
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@
8585
"@types/jest": "^29.0.0",
8686
"@types/node": "^16.0.0",
8787
"@types/semver": "^7.5.8",
88-
"@typescript-eslint/eslint-plugin": "^7.0.0",
89-
"@typescript-eslint/parser": "^7.0.0",
90-
"@typescript-eslint/utils": "^7.0.0",
88+
"@typescript-eslint/eslint-plugin": "^8.0.0",
89+
"@typescript-eslint/parser": "^8.0.0",
90+
"@typescript-eslint/utils": "^8.0.0",
9191
"babel-jest": "^29.0.0",
9292
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
9393
"dedent": "^1.5.0",

src/rules/prefer-importing-jest-globals.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ export default createRule({
117117
if (importNode?.type === AST_NODE_TYPES.ImportDeclaration) {
118118
for (const specifier of importNode.specifiers) {
119119
if (specifier.type === AST_NODE_TYPES.ImportSpecifier) {
120-
let importName = specifier.imported.name ?? '';
120+
let importName =
121+
'name' in specifier.imported ? specifier.imported.name : '';
121122
const local = getAccessorValue(specifier.local);
122123

123124
if (local !== importName) {

src/rules/unbound-method.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ export type MessageIds = 'unbound' | 'unboundWithoutThisAnnotation';
4848

4949
const DEFAULT_MESSAGE = 'This rule requires `@typescript-eslint/eslint-plugin`';
5050

51+
// todo: remove these along with the actual runtime properties below in new major
52+
declare module '@typescript-eslint/utils/ts-eslint' {
53+
interface RuleMetaDataDocs {
54+
requiresTypeChecking?: boolean;
55+
recommended?: unknown;
56+
}
57+
}
58+
5159
export default createRule<Options, MessageIds>({
5260
defaultOptions: [{ ignoreStatic: false }],
5361
...baseRule,

src/rules/utils/parseJestFnCall.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -452,15 +452,12 @@ const describeImportDefAsImport = (
452452
return null;
453453
}
454454

455-
let imported = def.node.imported.name ?? '';
456-
457-
if ('value' in def.node.imported) {
458-
imported = def.node.imported.value as string;
459-
}
460-
461455
return {
462456
source: def.parent.source.value,
463-
imported,
457+
imported:
458+
'name' in def.node.imported
459+
? def.node.imported.name
460+
: def.node.imported.value,
464461
local: def.node.local.name,
465462
};
466463
};

0 commit comments

Comments
 (0)