Skip to content

Commit 9f70ed1

Browse files
authored
fix(ast-spec): use Expression in argument of ThrowStatement (typescript-eslint#9632)
1 parent 90cebbb commit 9f70ed1

File tree

6 files changed

+5
-14
lines changed

6 files changed

+5
-14
lines changed

eslint.config.mjs

-2
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,7 @@ export default tseslint.config(
352352
// test file specific configuration
353353
{
354354
files: [
355-
'packages/*/tests/**/*.spec.{ts,tsx,cts,mts}',
356355
'packages/*/tests/**/*.test.{ts,tsx,cts,mts}',
357-
'packages/*/tests/**/spec.{ts,tsx,cts,mts}',
358356
'packages/*/tests/**/test.{ts,tsx,cts,mts}',
359357
'packages/parser/tests/**/*.{ts,tsx,cts,mts}',
360358
'packages/integration-tests/tools/integration-test-base.ts',

nx.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
],
9494
"production": [
9595
"default",
96-
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
96+
"!{projectRoot}/**/?(*.)+(test).[jt]s?(x)?(.snap)",
9797
"!{projectRoot}/tsconfig.spec.json",
9898
"!{projectRoot}/jest.config.[jt]s",
9999
"!{projectRoot}/src/test-setup.[jt]s"
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import type { AST_NODE_TYPES } from '../../ast-node-types';
22
import type { BaseNode } from '../../base/BaseNode';
3-
import type { TSAsExpression } from '../../expression/TSAsExpression/spec';
4-
import type { Statement } from '../../unions/Statement';
3+
import type { Expression } from '../../unions/Expression';
54

65
export interface ThrowStatement extends BaseNode {
7-
argument: Statement | TSAsExpression | null;
6+
argument: Expression;
87
type: AST_NODE_TYPES.ThrowStatement;
98
}

packages/eslint-plugin/src/rules/only-throw-error.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ export default createRule<Options, MessageIds>({
8989

9090
return {
9191
ThrowStatement(node): void {
92-
if (node.argument) {
93-
checkThrowArgument(node.argument);
94-
}
92+
checkThrowArgument(node.argument);
9593
},
9694
};
9795
},

packages/scope-manager/tsconfig.build.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"types": ["node", "jest"]
1010
},
1111
"include": ["src", "typings"],
12-
"exclude": ["**/*.spec.ts", "**/*.test.ts"],
12+
"exclude": ["**/*.test.ts"],
1313
"references": [
1414
{ "path": "../types/tsconfig.build.json" },
1515
{ "path": "../visitor-keys/tsconfig.build.json" }

packages/scope-manager/tsconfig.spec.json

-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@
99
"tests",
1010
"tools",
1111
"**/*.test.ts",
12-
"**/*.spec.ts",
1312
"**/*.test.tsx",
14-
"**/*.spec.tsx",
1513
"**/*.test.js",
16-
"**/*.spec.js",
1714
"**/*.test.jsx",
18-
"**/*.spec.jsx",
1915
"**/*.d.ts"
2016
]
2117
}

0 commit comments

Comments
 (0)