Skip to content

Commit 42f920c

Browse files
authored
chore: update ts-eslint (#9953)
1 parent 3078172 commit 42f920c

File tree

20 files changed

+83
-59
lines changed

20 files changed

+83
-59
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"@types/jest": "24.0.2",
1919
"@types/node": "*",
2020
"@types/which": "^1.3.2",
21-
"@typescript-eslint/eslint-plugin": "^2.19.0",
22-
"@typescript-eslint/parser": "^2.19.0",
21+
"@typescript-eslint/eslint-plugin": "^2.30.0",
22+
"@typescript-eslint/parser": "^2.30.0",
2323
"ansi-regex": "^5.0.0",
2424
"ansi-styles": "^4.2.0",
2525
"babel-eslint": "^10.0.3",

packages/expect/src/extractExpectedAssertionsErrors.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,16 @@ const resetAssertionsLocalState = () => {
2323
});
2424
};
2525

26+
type AssertionsErrors = Array<{
27+
actual: string;
28+
error: string;
29+
expected: string | number;
30+
}>;
31+
2632
// Create and format all errors related to the mismatched number of `expect`
2733
// calls and reset the matcher's state.
28-
const extractExpectedAssertionsErrors = () => {
29-
const result = [];
34+
const extractExpectedAssertionsErrors: () => AssertionsErrors = () => {
35+
const result: AssertionsErrors = [];
3036
const {
3137
assertionCalls,
3238
expectedAssertionsNumber,

packages/jest-circus/src/formatNodeAssertErrors.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ const humanReadableOperators: Record<string, string> = {
3838
strictEqual: 'to strictly be equal',
3939
};
4040

41-
const formatNodeAssertErrors = (event: Circus.Event, state: Circus.State) => {
41+
const formatNodeAssertErrors = (
42+
event: Circus.Event,
43+
state: Circus.State,
44+
): void => {
4245
if (event.name === 'test_done') {
4346
event.test.errors = event.test.errors.map((errors: Circus.TestError) => {
4447
let error;

packages/jest-core/src/lib/active_filters_message.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type {Config} from '@jest/types';
1111
const activeFilters = (
1212
globalConfig: Config.GlobalConfig,
1313
delimiter: string = '\n',
14-
) => {
14+
): string => {
1515
const {testNamePattern, testPathPattern} = globalConfig;
1616
if (testNamePattern || testPathPattern) {
1717
const filters = [

packages/jest-core/src/plugins/quit.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import {BaseWatchPlugin} from 'jest-watcher';
8+
import {BaseWatchPlugin, UsageData} from 'jest-watcher';
99

1010
class QuitPlugin extends BaseWatchPlugin {
1111
isInternal: true;
@@ -15,15 +15,15 @@ class QuitPlugin extends BaseWatchPlugin {
1515
this.isInternal = true;
1616
}
1717

18-
async run() {
18+
async run(): Promise<void> {
1919
if (typeof this._stdin.setRawMode === 'function') {
2020
this._stdin.setRawMode(false);
2121
}
2222
this._stdout.write('\n');
2323
process.exit(0);
2424
}
2525

26-
getUsageInfo() {
26+
getUsageInfo(): UsageData {
2727
return {
2828
key: 'q',
2929
prompt: 'quit watch mode',

packages/jest-core/src/plugins/test_name_pattern.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
*/
77

88
import type {Config} from '@jest/types';
9-
import {BaseWatchPlugin, Prompt, UpdateConfigCallback} from 'jest-watcher';
9+
import {
10+
BaseWatchPlugin,
11+
Prompt,
12+
UpdateConfigCallback,
13+
UsageData,
14+
} from 'jest-watcher';
1015
import TestNamePatternPrompt from '../TestNamePatternPrompt';
1116
import activeFilters from '../lib/active_filters_message';
1217

@@ -20,14 +25,14 @@ class TestNamePatternPlugin extends BaseWatchPlugin {
2025
this.isInternal = true;
2126
}
2227

23-
getUsageInfo() {
28+
getUsageInfo(): UsageData {
2429
return {
2530
key: 't',
2631
prompt: 'filter by a test name regex pattern',
2732
};
2833
}
2934

30-
onKey(key: string) {
35+
onKey(key: string): void {
3136
this._prompt.put(key);
3237
}
3338

packages/jest-core/src/plugins/test_path_pattern.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
*/
77

88
import type {Config} from '@jest/types';
9-
import {BaseWatchPlugin, Prompt, UpdateConfigCallback} from 'jest-watcher';
9+
import {
10+
BaseWatchPlugin,
11+
Prompt,
12+
UpdateConfigCallback,
13+
UsageData,
14+
} from 'jest-watcher';
1015
import TestPathPatternPrompt from '../TestPathPatternPrompt';
1116
import activeFilters from '../lib/active_filters_message';
1217

@@ -20,14 +25,14 @@ class TestPathPatternPlugin extends BaseWatchPlugin {
2025
this.isInternal = true;
2126
}
2227

23-
getUsageInfo() {
28+
getUsageInfo(): UsageData {
2429
return {
2530
key: 'p',
2631
prompt: 'filter by a filename regex pattern',
2732
};
2833
}
2934

30-
onKey(key: string) {
35+
onKey(key: string): void {
3136
this._prompt.put(key);
3237
}
3338

packages/jest-core/src/plugins/update_snapshots.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
BaseWatchPlugin,
1111
JestHookSubscriber,
1212
UpdateConfigCallback,
13+
UsageData,
1314
} from 'jest-watcher';
1415

1516
class UpdateSnapshotsPlugin extends BaseWatchPlugin {
@@ -30,13 +31,13 @@ class UpdateSnapshotsPlugin extends BaseWatchPlugin {
3031
return Promise.resolve(false);
3132
}
3233

33-
apply(hooks: JestHookSubscriber) {
34+
apply(hooks: JestHookSubscriber): void {
3435
hooks.onTestRunComplete(results => {
3536
this._hasSnapshotFailure = results.snapshot.failure;
3637
});
3738
}
3839

39-
getUsageInfo() {
40+
getUsageInfo(): UsageData | null {
4041
if (this._hasSnapshotFailure) {
4142
return {
4243
key: 'u',

packages/jest-core/src/plugins/update_snapshots_interactive.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import type {Config} from '@jest/types';
99
import type {AggregatedResult, AssertionLocation} from '@jest/test-result';
10-
import {BaseWatchPlugin, JestHookSubscriber} from 'jest-watcher';
10+
import {BaseWatchPlugin, JestHookSubscriber, UsageData} from 'jest-watcher';
1111
import SnapshotInteractiveMode from '../SnapshotInteractiveMode';
1212

1313
class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin {
@@ -41,7 +41,7 @@ class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin {
4141
return failedTestPaths;
4242
}
4343

44-
apply(hooks: JestHookSubscriber) {
44+
apply(hooks: JestHookSubscriber): void {
4545
hooks.onTestRunComplete(results => {
4646
this._failedSnapshotTestAssertions = this.getFailedSnapshotTestAssertions(
4747
results,
@@ -52,7 +52,7 @@ class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin {
5252
});
5353
}
5454

55-
onKey(key: string) {
55+
onKey(key: string): void {
5656
if (this._snapshotInteractiveMode.isActive()) {
5757
this._snapshotInteractiveMode.put(key);
5858
}
@@ -85,11 +85,8 @@ class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin {
8585
}
8686
}
8787

88-
getUsageInfo() {
89-
if (
90-
this._failedSnapshotTestAssertions &&
91-
this._failedSnapshotTestAssertions.length > 0
92-
) {
88+
getUsageInfo(): UsageData | null {
89+
if (this._failedSnapshotTestAssertions?.length > 0) {
9390
return {
9491
key: 'i',
9592
prompt: 'update failing snapshots interactively',

packages/jest-diff/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const FALLBACK_FORMAT_OPTIONS_0 = {...FALLBACK_FORMAT_OPTIONS, indent: 0};
5050

5151
// Generate a string that will highlight the difference between two values
5252
// with green and red. (similar to how github does code diffing)
53+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
5354
function diff(a: any, b: any, options?: DiffOptions): string | null {
5455
if (Object.is(a, b)) {
5556
return NO_DIFF_MESSAGE;

0 commit comments

Comments
 (0)