Skip to content

Commit 72d5610

Browse files
authored
Update ESLint config from v9 to v10 (#48)
The ESLint configuration has been updated from v9 to v10, and all related packages has been updated. This resolves the console warning that had been printed upon each run of `yarn lint` about how the current TypeScript version is unsupported. All lint changes were made with `yarn lint:fix` except one, which is where we're using `interface` over `type` to allow for declaration merging in `setupAfterEnv.ts`.
1 parent 837f4a4 commit 72d5610

24 files changed

+443
-423
lines changed

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,33 @@
3737
"devDependencies": {
3838
"@lavamoat/allow-scripts": "^2.0.3",
3939
"@metamask/auto-changelog": "^2.3.0",
40-
"@metamask/eslint-config": "^9.0.0",
41-
"@metamask/eslint-config-jest": "^9.0.0",
42-
"@metamask/eslint-config-nodejs": "^9.0.0",
43-
"@metamask/eslint-config-typescript": "^9.0.1",
40+
"@metamask/eslint-config": "^10.0.0",
41+
"@metamask/eslint-config-jest": "^10.0.0",
42+
"@metamask/eslint-config-nodejs": "^10.0.0",
43+
"@metamask/eslint-config-typescript": "^10.0.0",
4444
"@types/debug": "^4.1.7",
4545
"@types/jest": "^29.2.2",
4646
"@types/jest-when": "^3.5.2",
4747
"@types/node": "^17.0.23",
4848
"@types/rimraf": "^3.0.2",
4949
"@types/which": "^2.0.1",
5050
"@types/yargs": "^17.0.10",
51-
"@typescript-eslint/eslint-plugin": "^4.21.0",
52-
"@typescript-eslint/parser": "^4.21.0",
51+
"@typescript-eslint/eslint-plugin": "^5.42.1",
52+
"@typescript-eslint/parser": "^5.42.1",
5353
"deepmerge": "^4.2.2",
54-
"eslint": "^7.23.0",
55-
"eslint-config-prettier": "^8.1.0",
56-
"eslint-plugin-import": "^2.22.1",
57-
"eslint-plugin-jest": "^24.3.4",
58-
"eslint-plugin-jsdoc": "^36.1.0",
54+
"eslint": "^8.27.0",
55+
"eslint-config-prettier": "^8.5.0",
56+
"eslint-plugin-import": "^2.26.0",
57+
"eslint-plugin-jest": "^26.9.0",
58+
"eslint-plugin-jsdoc": "^39.6.2",
5959
"eslint-plugin-node": "^11.1.0",
60-
"eslint-plugin-prettier": "^3.3.1",
60+
"eslint-plugin-prettier": "^4.2.1",
6161
"jest": "^29.3.0",
6262
"jest-it-up": "^2.0.2",
6363
"jest-when": "^3.5.2",
6464
"nanoid": "^3.3.4",
6565
"prettier": "^2.2.1",
66-
"prettier-plugin-packagejson": "^2.2.17",
66+
"prettier-plugin-packagejson": "^2.3.0",
6767
"rimraf": "^3.0.2",
6868
"stdio-mock": "^1.2.0",
6969
"ts-jest": "^29.0.3",

src/command-line-arguments.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import yargs from 'yargs/yargs';
22
import { hideBin } from 'yargs/helpers';
33

4-
export interface CommandLineArguments {
4+
export type CommandLineArguments = {
55
projectDirectory: string;
66
tempDirectory: string | undefined;
77
reset: boolean;
88
backport: boolean;
9-
}
9+
};
1010

1111
/**
1212
* Parses the arguments provided on the command line using `yargs`.

src/editor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import { debug, resolveExecutable } from './misc-utils';
88
* @property args - Command-line arguments to pass to the executable when
99
* calling it.
1010
*/
11-
export interface Editor {
11+
export type Editor = {
1212
path: string;
1313
args: string[];
14-
}
14+
};
1515

1616
/**
1717
* Looks for an executable that represents a code editor on your computer. Tries

src/env.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
interface Env {
1+
type Env = {
22
EDITOR: string | undefined;
3-
}
3+
};
44

55
/**
66
* Returns all of the environment variables that this tool uses.

src/fs.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('fs', () => {
2727

2828
await fs.promises.writeFile(filePath, 'some content 😄');
2929

30-
expect(await readFile(filePath)).toStrictEqual('some content 😄');
30+
expect(await readFile(filePath)).toBe('some content 😄');
3131
});
3232
});
3333

@@ -54,7 +54,7 @@ describe('fs', () => {
5454

5555
await writeFile(filePath, 'some content 😄');
5656

57-
expect(await fs.promises.readFile(filePath, 'utf8')).toStrictEqual(
57+
expect(await fs.promises.readFile(filePath, 'utf8')).toBe(
5858
'some content 😄',
5959
);
6060
});

src/functional.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ describe('create-release-branch (functional)', () => {
377377
'--max-count=1',
378378
])
379379
).stdout;
380-
expect(latestCommitSubject).toStrictEqual('Release 2.0.0');
380+
expect(latestCommitSubject).toBe('Release 2.0.0');
381381
expect(latestCommitRevs).toContain('HEAD');
382382
expect(latestCommitRevs).toContain('release/2.0.0');
383383
expect(latestBranchCommitId).toStrictEqual(latestCommitId);

src/initial-parameters.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ describe('initial-parameters', () => {
112112
stderr,
113113
});
114114

115-
expect(initialParameters.tempDirectoryPath).toStrictEqual(
116-
'/path/to/cwd/tmp',
117-
);
115+
expect(initialParameters.tempDirectoryPath).toBe('/path/to/cwd/tmp');
118116
});
119117

120118
it('uses a default temporary directory based on the name of the package if no temporary directory was given', async () => {

src/initial-parameters.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import { readProject, Project } from './project';
1515
*/
1616
export type ReleaseType = 'ordinary' | 'backport';
1717

18-
interface InitialParameters {
18+
type InitialParameters = {
1919
project: Project;
2020
tempDirectoryPath: string;
2121
reset: boolean;
2222
releaseType: ReleaseType;
23-
}
23+
};
2424

2525
/**
2626
* Reads the inputs given to this tool via `process.argv` and uses them to

src/misc-utils.test.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ describe('misc-utils', () => {
8686
const originalError = new Error('oops');
8787
const newError = wrapError('Some message', originalError);
8888

89-
expect(newError.message).toStrictEqual('Some message');
89+
expect(newError.message).toBe('Some message');
9090
expect(newError.cause).toBe(originalError);
9191
});
9292

@@ -95,7 +95,7 @@ describe('misc-utils', () => {
9595
originalError.code = 'CODE';
9696
const newError: any = wrapError('Some message', originalError);
9797

98-
expect(newError.code).toStrictEqual('CODE');
98+
expect(newError.code).toBe('CODE');
9999
});
100100

101101
it('returns a new Error which prefixes the given message', () => {
@@ -112,9 +112,7 @@ describe('misc-utils', () => {
112112
.spyOn(whichModule, 'default')
113113
.mockResolvedValue('/path/to/executable');
114114

115-
expect(await resolveExecutable('executable')).toStrictEqual(
116-
'/path/to/executable',
117-
);
115+
expect(await resolveExecutable('executable')).toBe('/path/to/executable');
118116
});
119117

120118
it('returns null if the given executable cannot be found', async () => {
@@ -170,7 +168,7 @@ describe('misc-utils', () => {
170168
expect(execaSpy).toHaveBeenCalledWith('some command', ['arg1', 'arg2'], {
171169
all: true,
172170
});
173-
expect(output).toStrictEqual('some output');
171+
expect(output).toBe('some output');
174172
});
175173
});
176174

src/package-manifest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ export type UnvalidatedPackageManifest = Readonly<Record<string, any>>;
2424
* @property bundledDependencies - The set of packages that are expected to be
2525
* bundled when publishing the package.
2626
*/
27-
export interface ValidatedPackageManifest {
27+
export type ValidatedPackageManifest = {
2828
readonly [PackageManifestFieldNames.Name]: string;
2929
readonly [PackageManifestFieldNames.Version]: SemVer;
3030
readonly [PackageManifestFieldNames.Private]: boolean;
3131
readonly [PackageManifestFieldNames.Workspaces]: string[];
32-
}
32+
};
3333

3434
/**
3535
* Constructs a validation error message for a field within the manifest.

0 commit comments

Comments
 (0)