Skip to content

Commit b489f90

Browse files
committed
Fix lint errors
1 parent b565fba commit b489f90

8 files changed

Lines changed: 28 additions & 168 deletions

File tree

.eslintrc.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ module.exports = {
2727
'import-x/unambiguous': 'off',
2828
},
2929
},
30-
{
31-
files: ['**/*.test.js', '**/*.test.ts'],
32-
extends: ['@metamask/eslint-config-jest'],
33-
rules: {
34-
'@typescript-eslint/restrict-template-expressions': 'off',
35-
},
36-
},
3730
],
3831

3932
ignorePatterns: ['!.eslintrc.js', 'lib/', 'dist/'],

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
"@lavamoat/allow-scripts": "^2.5.1",
5555
"@lavamoat/preinstall-always-fail": "^3.0.0",
5656
"@metamask/eslint-config": "^13.0.0",
57-
"@metamask/eslint-config-jest": "^13.0.0",
5857
"@metamask/eslint-config-nodejs": "^13.0.0",
5958
"@metamask/eslint-config-typescript": "^13.0.0",
6059
"@types/glob": "^7.1.3",
@@ -68,7 +67,6 @@
6867
"eslint": "^8.57.0",
6968
"eslint-config-prettier": "^8.5.0",
7069
"eslint-plugin-import-x": "^0.5.1",
71-
"eslint-plugin-jest": "^27.9.0",
7270
"eslint-plugin-jsdoc": "^47.0.2",
7371
"eslint-plugin-n": "^16.6.2",
7472
"eslint-plugin-prettier": "^5.5.5",

src/git-operations.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
/* eslint-disable import-x/first */
12
// This must be set before the import, so that the default root workspace is set
23
process.env.GITHUB_WORKSPACE = 'root';
34

45
import execa from 'execa';
5-
66
import { vi, describe, it, expect } from 'vitest';
7+
78
import {
89
didPackageChange,
910
getRepositoryHttpsUrl,

src/index.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import * as actionsCore from '@actions/core';
2+
import { describe, expect, it, vi } from 'vitest';
23

34
import * as actionModule from './update';
45
import * as utils from './utils';
56

6-
import { describe, expect, it, vi } from 'vitest';
7-
87
vi.mock('@actions/core', () => {
98
return {
109
error: vi.fn(),

src/package-operations.test.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
1-
import {
1+
import type {
22
ManifestDependencyFieldNames,
33
PackageManifest,
4+
} from '@metamask/action-utils';
5+
import {
46
getPackageManifest,
57
getWorkspaceLocations,
68
writeJsonFile,
9+
ManifestFieldNames,
710
} from '@metamask/action-utils';
8-
import { ManifestFieldNames } from '@metamask/action-utils';
911
import * as autoChangelog from '@metamask/auto-changelog';
1012
import { promises as fs } from 'fs';
1113
import cloneDeep from 'lodash.clonedeep';
14+
import {
15+
beforeEach,
16+
describe,
17+
expect,
18+
it,
19+
vi,
20+
type MockInstance,
21+
} from 'vitest';
1222

1323
import * as gitOps from './git-operations';
1424
import {
@@ -19,8 +29,6 @@ import {
1929
updatePackages,
2030
} from './package-operations';
2131

22-
import { beforeEach, describe, expect, it, vi, type MockInstance } from 'vitest';
23-
2432
vi.mock('fs', () => ({
2533
default: {},
2634
promises: {
@@ -70,10 +78,6 @@ type DependencyFieldsDict = Partial<
7078
Record<ManifestDependencyFieldNames, Record<string, string>>
7179
>;
7280

73-
// Convenience method to match behavior of utils.writeJsonFile
74-
const jsonStringify = (value: unknown): string =>
75-
`${JSON.stringify(value, null, 2)}\n`;
76-
7781
const getMockManifest = (
7882
name: string,
7983
version: string,
@@ -104,9 +108,7 @@ describe('package-operations', () => {
104108
};
105109

106110
beforeEach(() => {
107-
vi.spyOn(fs, 'lstat').mockImplementation((async (
108-
path: string,
109-
) => {
111+
vi.spyOn(fs, 'lstat').mockImplementation((async (path: string) => {
110112
return path.endsWith(SOME_FILE)
111113
? { isDirectory: (): boolean => false }
112114
: { isDirectory: (): boolean => true };
@@ -411,9 +413,10 @@ describe('package-operations', () => {
411413

412414
// no new changelog content and no unreleased changes will cause an error
413415
updateChangelogMock.mockImplementation(async () => '');
414-
const actualChangelog = await vi.importActual<typeof import('@metamask/auto-changelog')>(
415-
'@metamask/auto-changelog/dist/changelog',
416-
);
416+
const actualChangelog = await vi.importActual<
417+
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
418+
typeof import('@metamask/auto-changelog')
419+
>('@metamask/auto-changelog/dist/changelog');
417420

418421
// @ts-expect-error: Partial mock.
419422
parseChangelogMock.mockImplementationOnce(() => {
@@ -478,6 +481,7 @@ describe('package-operations', () => {
478481

479482
updateChangelogMock.mockImplementation(async () => '');
480483
const actualChangelog = await vi.importActual<
484+
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
481485
typeof import('@metamask/auto-changelog')
482486
>('@metamask/auto-changelog/dist/changelog');
483487

@@ -543,6 +547,7 @@ describe('package-operations', () => {
543547
// no new changelog content and no unreleased changes will cause an error
544548
updateChangelogMock.mockImplementation(async () => '');
545549
const actualChangelog = await vi.importActual<
550+
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
546551
typeof import('@metamask/auto-changelog')
547552
>('@metamask/auto-changelog/dist/changelog');
548553

src/update.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import * as actionsCore from '@actions/core';
22
import * as actionUtils from '@metamask/action-utils';
3+
import type { Mock } from 'vitest';
4+
import { describe, expect, it, beforeEach, vi } from 'vitest';
35

46
import * as gitOperations from './git-operations';
57
import * as packageOperations from './package-operations';
68
import { performUpdate } from './update';
79
import * as utils from './utils';
810

9-
import { describe, expect, it, beforeEach, vi, Mock } from 'vitest';
10-
1111
vi.mock('@actions/core', () => {
1212
return {
1313
setOutput: vi.fn(),

src/utils.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import { afterEach, describe, expect, it, vi } from 'vitest';
2+
13
import {
24
AcceptedSemverReleaseTypes,
35
getActionInputs,
46
InputKeys,
57
} from './utils';
68

7-
import { afterEach, describe, expect, it, vi } from 'vitest';
8-
99
vi.mock('fs', () => ({
1010
promises: {
1111
readFile: vi.fn(),

0 commit comments

Comments
 (0)