8000 fix(eslint-plugin): [no-unsafe-call] fix incorrect selector (#1826) · shishkin/typescript-eslint@8ec53a3 · GitHub
[go: up one dir, main page]

< 8000 div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;">
Skip to content

Commit 8ec53a3

Browse files
authored
fix(eslint-plugin): [no-unsafe-call] fix incorrect selector (typescript-eslint#1826)
1 parent 9b0023a commit 8ec53a3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/eslint-plugin/src/rules/no-unsafe-call.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default util.createRule<[], MessageIds>({
4141
}
4242

4343
return {
44-
':matches(CallExpression, OptionalCallExpression) > :not(Import)'(
44+
':matches(CallExpression, OptionalCallExpression) > :not(Import).callee'(
4545
node: Exclude<TSESTree.LeftHandSideExpression, TSESTree.Import>,
4646
): void {
4747
checkCall(node, node, 'unsafeCall');

packages/eslint-plugin/tests/rules/no-unsafe-call.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ ruleTester.run('no-unsafe-call', rule, {
2121
'new Map()',
2222
'String.raw`foo`',
2323
'const x = import("./foo");',
24+
// https://github.com/typescript-eslint/typescript-eslint/issues/1825
25+
`
26+
let foo: any = 23;
27+
String(foo); // ERROR: Unsafe call of an any typed value
28+
`,
2429
],
2530
invalid: [
2631
...batchedSingleLineTests({

0 commit comments

Comments
 (0)
0