Skip to content

Commit

Permalink
chore: upgrade to typescript 5 (#1365)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Apr 18, 2023
1 parent e1965a2 commit a058f22
Show file tree
Hide file tree
Showing 43 changed files with 123 additions and 84 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ module.exports = {
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{ disallowTypeAnnotations: false, fixStyle: 'inline-type-imports' },
],
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'eslint-comments/no-unused-disable': 'error',
'eslint-plugin/require-meta-docs-description': [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"semantic-release": "^20.0.0",
"semver": "^7.3.5",
"ts-node": "^10.2.1",
"typescript": "^4.4.0"
"typescript": "^5.0.4"
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^5.0.0",
Expand Down
5 changes: 4 additions & 1 deletion src/rules/__tests__/no-deprecated-functions.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { TSESLint } from '@typescript-eslint/utils';
import rule from '../no-deprecated-functions';
import { JestVersion, detectJestVersion } from '../utils/detectJestVersion';
import {
type JestVersion,
detectJestVersion,
} from '../utils/detectJestVersion';

jest.mock('../utils/detectJestVersion');

Expand Down
2 changes: 1 addition & 1 deletion src/rules/__tests__/unbound-method.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path';
import { ESLintUtils, TSESLint } from '@typescript-eslint/utils';
import { ESLintUtils, type TSESLint } from '@typescript-eslint/utils';
import dedent from 'dedent';
import type { MessageIds, Options } from '../unbound-method';

Expand Down
6 changes: 5 additions & 1 deletion src/rules/consistent-test-it.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { AST_NODE_TYPES, TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
AST_NODE_TYPES,
type TSESLint,
type TSESTree,
} from '@typescript-eslint/utils';
import {
TestCaseName,
createRule,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/expect-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* MIT license, Remco Haszing.
*/

import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
import {
createRule,
getNodeName,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/max-expects.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
import {
FunctionExpression,
type FunctionExpression,
createRule,
isTypeOfJestFnCall,
parseJestFnCall,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/max-nested-describe.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
import { createRule, isTypeOfJestFnCall } from './utils';

export default createRule({
Expand Down
4 changes: 2 additions & 2 deletions src/rules/no-conditional-expect.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
import {
KnownCallExpression,
type KnownCallExpression,
createRule,
getTestCallExpressionsFromDeclaredVariables,
isSupportedAccessor,
Expand Down
4 changes: 2 additions & 2 deletions src/rules/no-deprecated-functions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
import {
JestVersion,
type JestVersion,
createRule,
detectJestVersion,
getNodeName,
Expand Down
6 changes: 5 additions & 1 deletion src/rules/no-done-callback.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { AST_NODE_TYPES, TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
AST_NODE_TYPES,
type TSESLint,
type TSESTree,
} from '@typescript-eslint/utils';
import { createRule, getNodeName, isFunction, parseJestFnCall } from './utils';

const findCallbackArg = (
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-export.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
import { createRule, isTypeOfJestFnCall } from './utils';

export default createRule({
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HookName, createRule, parseJestFnCall } from './utils';
import { type HookName, createRule, parseJestFnCall } from './utils';

export default createRule<
[Partial<{ allow: readonly HookName[] }>],
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-if.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
import {
TestCaseName,
createRule,
Expand Down
6 changes: 5 additions & 1 deletion src/rules/no-large-snapshots.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { isAbsolute } from 'path';
import { AST_NODE_TYPES, TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
AST_NODE_TYPES,
type TSESLint,
type TSESTree,
} from '@typescript-eslint/utils';
import {
createRule,
getAccessorValue,
Expand Down
6 changes: 5 additions & 1 deletion src/rules/no-standalone-expect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { AST_NODE_TYPES, TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
AST_NODE_TYPES,
type TSESLint,
type TSESTree,
} from '@typescript-eslint/utils';
import {
DescribeAlias,
createRule,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-test-return-statement.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
import {
createRule,
getTestCallExpressionsFromDeclaredVariables,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-untyped-mock-factory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
import {
createRule,
getAccessorValue,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-comparison-matcher.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
import {
EqualityMatcher,
createRule,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-each.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { TSESTree } from '@typescript-eslint/utils';
import { JestFnType, createRule, parseJestFnCall } from './utils';
import { type JestFnType, createRule, parseJestFnCall } from './utils';

export default createRule({
name: __filename,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-equality-matcher.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AST_NODE_TYPES, TSESLint } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESLint } from '@typescript-eslint/utils';
import {
EqualityMatcher,
ModifierName,
Expand Down
8 changes: 6 additions & 2 deletions src/rules/prefer-expect-assertions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { AST_NODE_TYPES, TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
ParsedExpectFnCall,
AST_NODE_TYPES,
type TSESLint,
type TSESTree,
} from '@typescript-eslint/utils';
import {
type ParsedExpectFnCall,
createRule,
getAccessorValue,
isFunction,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-expect-resolves.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
import { createRule, parseJestFnCall } from './utils';

export default createRule({
Expand Down
4 changes: 2 additions & 2 deletions src/rules/prefer-lowercase-title.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
CallExpressionWithSingleArgument,
type CallExpressionWithSingleArgument,
DescribeAlias,
StringNode,
type StringNode,
TestCaseName,
createRule,
getStringValue,
Expand Down
6 changes: 3 additions & 3 deletions src/rules/prefer-mock-promise-shorthand.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
import {
AccessorNode,
FunctionExpression,
type AccessorNode,
type FunctionExpression,
createRule,
getAccessorValue,
getNodeName,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-snapshot-hint.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
ParsedExpectFnCall,
type ParsedExpectFnCall,
createRule,
getAccessorValue,
isStringNode,
Expand Down
6 changes: 5 additions & 1 deletion src/rules/prefer-spy-on.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { AST_NODE_TYPES, TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
AST_NODE_TYPES,
type TSESLint,
type TSESTree,
} from '@typescript-eslint/utils';
import { createRule, getNodeName } from './utils';

const findNodeObject = (
Expand Down
10 changes: 7 additions & 3 deletions src/rules/prefer-to-be.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { AST_NODE_TYPES, TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
AccessorNode,
AST_NODE_TYPES,
type TSESLint,
type TSESTree,
} from '@typescript-eslint/utils';
import {
type AccessorNode,
EqualityMatcher,
ParsedExpectFnCall,
type ParsedExpectFnCall,
createRule,
getAccessorValue,
getFirstMatcherArg,
Expand Down
6 changes: 3 additions & 3 deletions src/rules/prefer-to-contain.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
import {
CallExpressionWithSingleArgument,
type CallExpressionWithSingleArgument,
EqualityMatcher,
KnownCallExpression,
type KnownCallExpression,
ModifierName,
createRule,
getAccessorValue,
Expand Down
8 changes: 6 additions & 2 deletions src/rules/prefer-todo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { AST_NODE_TYPES, TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
ParsedJestFnCall,
AST_NODE_TYPES,
type TSESLint,
type TSESTree,
} from '@typescript-eslint/utils';
import {
type ParsedJestFnCall,
createRule,
getAccessorValue,
hasOnlyOneArgument,
Expand Down
6 changes: 5 additions & 1 deletion src/rules/require-hook.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { AST_NODE_TYPES, TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
AST_NODE_TYPES,
type TSESLint,
type TSESTree,
} from '@typescript-eslint/utils';
import {
createRule,
getNodeName,
Expand Down
6 changes: 5 additions & 1 deletion src/rules/unbound-method.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { AST_NODE_TYPES, TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
AST_NODE_TYPES,
type TSESLint,
type TSESTree,
} from '@typescript-eslint/utils';
import {
createRule,
findTopMostCallExpression,
Expand Down
6 changes: 3 additions & 3 deletions src/rules/utils/__tests__/parseJestFnCall.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package';
import { TSESLint, TSESTree } from '@typescript-eslint/utils';
import { TSESLint, type TSESTree } from '@typescript-eslint/utils';
import dedent from 'dedent';
import { espreeParser } from '../../__tests__/test-utils';
import {
ParsedJestFnCall,
ResolvedJestFnWithNode,
type ParsedJestFnCall,
type ResolvedJestFnWithNode,
createRule,
getAccessorValue,
isSupportedAccessor,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/utils/accessors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';

/**
* A `Literal` with a `value` of type `string`.
Expand Down
2 changes: 1 addition & 1 deletion src/rules/utils/followTypeAssertionChain.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';

export type MaybeTypeCast<Expression extends TSESTree.Expression> =
| TSTypeCastExpression<Expression>
Expand Down
8 changes: 4 additions & 4 deletions src/rules/utils/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import { parse as parsePath } from 'path';
import {
AST_NODE_TYPES,
ESLintUtils,
TSESLint,
TSESTree,
type TSESLint,
type TSESTree,
} from '@typescript-eslint/utils';
import { version } from '../../../package.json';
import {
AccessorNode,
type AccessorNode,
getAccessorValue,
isSupportedAccessor,
} from './accessors';
import { followTypeAssertionChain } from './followTypeAssertionChain';
import { ParsedExpectFnCall, isTypeOfJestFnCall } from './parseJestFnCall';
import { type ParsedExpectFnCall, isTypeOfJestFnCall } from './parseJestFnCall';

const REPO_URL = 'https://github.com/jest-community/eslint-plugin-jest';

Expand Down
10 changes: 7 additions & 3 deletions src/rules/utils/parseJestFnCall.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { AST_NODE_TYPES, TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
AccessorNode,
AST_NODE_TYPES,
type TSESLint,
type TSESTree,
} from '@typescript-eslint/utils';
import {
type AccessorNode,
DescribeAlias,
HookName,
KnownMemberExpression,
type KnownMemberExpression,
ModifierName,
TestCaseName,
findTopMostCallExpression,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/valid-describe-callback.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
import {
createRule,
getAccessorValue,
Expand Down
8 changes: 6 additions & 2 deletions src/rules/valid-expect-in-promise.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { AST_NODE_TYPES, TSESLint, TSESTree } from '@typescript-eslint/utils';
import {
KnownCallExpression,
AST_NODE_TYPES,
type TSESLint,
type TSESTree,
} from '@typescript-eslint/utils';
import {
type KnownCallExpression,
ModifierName,
createRule,
findTopMostCallExpression,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/valid-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* MIT license, Tom Vincent.
*/

import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
import {
ModifierName,
createRule,
Expand Down
8 changes: 6 additions & 2 deletions src/rules/valid-title.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { AST_NODE_TYPES, JSONSchema, TSESTree } from '@typescript-eslint/utils';
import {
AST_NODE_TYPES,
type JSONSchema,
type TSESTree,
} from '@typescript-eslint/utils';
import {
DescribeAlias,
StringNode,
type StringNode,
TestCaseName,
createRule,
getStringValue,
Expand Down
Loading

0 comments on commit a058f22

Please sign in to comment.