Skip to content

Commit b4cf0da

Browse files
author
Josh Goldberg
authored
chore: enable no-unsafe-call locally (typescript-eslint#3281)
1 parent 26d71b5 commit b4cf0da

File tree

13 files changed

+38
-32
lines changed

13 files changed

+38
-32
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ module.exports = {
6464

6565
// TODO - enable these new recommended rules
6666
'@typescript-eslint/no-unsafe-assignment': 'off',
67-
'@typescript-eslint/no-unsafe-call': 'off',
6867
'@typescript-eslint/no-unsafe-member-access': 'off',
6968
'@typescript-eslint/no-unsafe-return': 'off',
7069
'@typescript-eslint/restrict-template-expressions': 'off',
@@ -191,6 +190,8 @@ module.exports = {
191190
{
192191
files: ['tests/**/*.js'],
193192
rules: {
193+
'@typescript-eslint/explicit-function-return-type': 'off',
194+
'@typescript-eslint/no-unsafe-call': 'off',
194195
'@typescript-eslint/restrict-plus-operands': 'off',
195196
},
196197
},

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
"@types/lodash": "^4.14.149",
8585
"@types/marked": "^2.0.0",
8686
"@types/node": "^14.14.27",
87+
"@types/node-fetch": "^2.5.10",
8788
"@types/prettier": "^2.2.1",
8889
"@types/rimraf": "^3.0.0",
8990
"@types/semver": "^7.3.4",
@@ -99,13 +100,13 @@
99100
"eslint-plugin-jest": "^24.1.3",
100101
"glob": "^7.1.6",
101102
"husky": "^5.0.9",
102-
"isomorphic-fetch": "^3.0.0",
103103
"jest": "^26.6.3",
104104
"jest-specific-snapshot": "^4.0.0",
105105
"lerna": "^3.22.1",
106106
"lint-staged": "^10.2.13",
107107
"make-dir": "^3.1.0",
108108
"markdownlint-cli": "^0.27.1",
109+
"node-fetch": "^2.6.1",
109110
"prettier": "^2.2.1",
110111
"rimraf": "^3.0.2",
111112
"ts-jest": "^26.5.1",

packages/eslint-plugin-tslint/src/custom-linter.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import { ILinterOptions, Linter, LintResult } from 'tslint';
22
import { Program, SourceFile } from 'typescript';
33

4-
// We need to access the program, but Linter has private program already
5-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6-
const TSLintLinter = Linter as any;
7-
8-
export class CustomLinter extends TSLintLinter {
4+
// @ts-expect-error - We need to access the program, but Linter has private program already
5+
export class CustomLinter extends Linter {
96
constructor(options: ILinterOptions, private readonly program: Program) {
107
super(options, program);
118
}

packages/experimental-utils/src/eslint-utils/RuleTester.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class RuleTester extends TSESLint.RuleTester {
3232
try {
3333
// instead of creating a hard dependency, just use a soft require
3434
// a bit weird, but if they're using this tooling, it'll be installed
35+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
3536
require(parser).clearCaches();
3637
} catch {
3738
// ignored

packages/parser/tests/tools/test-utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ export function createSnapshotTestBlock(
5353
try {
5454
const result = parse();
5555
expect(result).toMatchSnapshot();
56-
} catch (e) {
56+
} catch (error) {
5757
/**
5858
* If we are deliberately throwing because of encountering an unknown
5959
* AST_NODE_TYPE, we rethrow to cause the test to fail
6060
*/
61-
if (e.message.match('Unknown AST_NODE_TYPE')) {
62-
throw new Error(e);
61+
if (/Unknown AST_NODE_TYPE/.exec((error as Error).message)) {
62+
throw new Error(error);
6363
}
6464
expect(parse).toThrowErrorMatchingSnapshot();
6565
}

packages/typescript-estree/src/convert.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// There's lots of funny stuff due to the typing of ts.Node
2-
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-call */
33
import * as ts from 'typescript';
44
import {
55
canContainDirective,

packages/typescript-estree/tests/lib/convert.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// deeplyCopy is private internal
2-
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-call */
33
import { Converter } from '../../src/convert';
44
import * as ts from 'typescript';
55

packages/typescript-estree/tests/lib/parse.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ describe('parseAndGenerateServices', () => {
506506
/**
507507
* Aligns paths between environments, node for windows uses `\`, for linux and mac uses `/`
508508
*/
509-
error.message = error.message.replace(/\\(?!["])/gm, '/');
509+
error.message = (error as Error).message.replace(/\\(?!["])/gm, '/');
510510
throw error;
511511
}
512512
};

packages/typescript-estree/tools/test-utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ export function createSnapshotTestBlock(
3535
try {
3636
const result = parse();
3737
expect(result).toMatchSnapshot();
38-
} catch (e) {
38+
} catch (error) {
3939
/**
4040
* If we are deliberately throwing because of encountering an unknown
4141
* AST_NODE_TYPE, we rethrow to cause the test to fail
4242
*/
43-
if (e.message.match('Unknown AST_NODE_TYPE')) {
44-
throw new Error(e);
43+
if (/Unknown AST_NODE_TYPE/.exec((error as Error).message)) {
44+
throw new Error(error);
4545
}
4646
expect(parse).toThrowErrorMatchingSnapshot();
4747
}

tests/integration/utils/jest-snapshot-resolver.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/explicit-function-return-type */
21
/**
32
* Use a jest snapshotResolver to map the test snapshot output back to the
43
* linked volume. This means that even though we are running our tests inside

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy