Skip to content

Commit b1e1aa3

Browse files
committed
lint:fix
1 parent 84b5d51 commit b1e1aa3

36 files changed

+176
-134
lines changed

src/command-line-arguments.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import yargs from 'yargs/yargs';
21
import { hideBin } from 'yargs/helpers';
2+
import yargs from 'yargs/yargs';
33

44
export type CommandLineArguments = {
55
projectDirectory: string;

src/editor.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { when } from 'jest-when';
2+
23
import { determineEditor } from './editor';
34
import * as envModule from './env';
45
import * as miscUtils from './misc-utils';

src/editor.ts

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export async function determineEditor(): Promise<Editor | null> {
3131
executablePath = await resolveExecutable(EDITOR);
3232
} catch (error) {
3333
debug(
34+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
3435
`Could not resolve executable ${EDITOR} (${error}), falling back to VSCode`,
3536
);
3637
}
@@ -43,6 +44,7 @@ export async function determineEditor(): Promise<Editor | null> {
4344
executableArgs.push('--wait');
4445
} catch (error) {
4546
debug(
47+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
4648
`Could not resolve path to VSCode: ${error}, continuing regardless`,
4749
);
4850
}

src/fs.test.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import * as actionUtils from '@metamask/action-utils';
12
import fs from 'fs';
3+
import { when } from 'jest-when';
24
import path from 'path';
35
import { rimraf } from 'rimraf';
4-
import { when } from 'jest-when';
5-
import * as actionUtils from '@metamask/action-utils';
6-
import { withSandbox } from '../tests/helpers';
6+
77
import {
88
readFile,
99
writeFile,
@@ -13,6 +13,7 @@ import {
1313
ensureDirectoryPathExists,
1414
removeFile,
1515
} from './fs';
16+
import { withSandbox } from '../tests/helpers';
1617

1718
jest.mock('@metamask/action-utils');
1819

src/fs.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import fs from 'fs';
21
import {
32
readJsonObjectFile as underlyingReadJsonObjectFile,
43
writeJsonFile as underlyingWriteJsonFile,
54
} from '@metamask/action-utils';
5+
import fs from 'fs';
6+
67
import { wrapError, isErrorWithCode } from './misc-utils';
78

89
/**

src/functional.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { withMonorepoProjectEnvironment } from '../tests/functional/helpers/with';
21
import { buildChangelog } from '../tests/functional/helpers/utils';
2+
import { withMonorepoProjectEnvironment } from '../tests/functional/helpers/with';
33

44
jest.setTimeout(10_000);
55

src/initial-parameters.test.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1+
import { when } from 'jest-when';
12
import os from 'os';
23
import path from 'path';
3-
import { when } from 'jest-when';
4+
5+
import * as commandLineArgumentsModule from './command-line-arguments';
6+
import * as envModule from './env';
7+
import { determineInitialParameters } from './initial-parameters';
8+
import * as projectModule from './project';
49
import {
510
buildMockProject,
611
buildMockPackage,
712
createNoopWriteStream,
813
} from '../tests/unit/helpers';
9-
import { determineInitialParameters } from './initial-parameters';
10-
import * as commandLineArgumentsModule from './command-line-arguments';
11-
import * as envModule from './env';
12-
import * as projectModule from './project';
1314

1415
jest.mock('./command-line-arguments');
1516
jest.mock('./env');

src/initial-parameters.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import os from 'os';
22
import path from 'path';
3+
34
import { readCommandLineArguments } from './command-line-arguments';
4-
import { WriteStreamLike } from './fs';
5-
import { readProject, Project } from './project';
5+
import type { WriteStreamLike } from './fs';
6+
import type { Project } from './project';
7+
import { readProject } from './project';
68

79
/**
810
* The type of release being created as determined by the parent release.

src/main.test.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import fs from 'fs';
2-
import { buildMockProject } from '../tests/unit/helpers';
3-
import { main } from './main';
2+
43
import * as initialParametersModule from './initial-parameters';
4+
import { main } from './main';
55
import * as monorepoWorkflowOperations from './monorepo-workflow-operations';
6+
import { buildMockProject } from '../tests/unit/helpers';
67

78
jest.mock('./initial-parameters');
89
jest.mock('./monorepo-workflow-operations');

src/main.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { WriteStream } from 'fs';
2+
23
import { determineInitialParameters } from './initial-parameters';
34
import { followMonorepoWorkflow } from './monorepo-workflow-operations';
45

src/misc-utils.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import * as whichModule from 'which';
21
import * as execaModule from 'execa';
2+
import * as whichModule from 'which';
3+
34
import {
45
isErrorWithCode,
56
isErrorWithMessage,

src/misc-utils.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import which from 'which';
2-
import execa from 'execa';
1+
import { isObject } from '@metamask/utils';
32
import createDebug from 'debug';
3+
import execa from 'execa';
44
import { ErrorWithCause } from 'pony-cause';
5-
import { isObject } from '@metamask/utils';
5+
import which from 'which';
66

77
export { isTruthyString } from '@metamask/action-utils';
88
export { hasProperty, isNullOrUndefined } from '@metamask/utils';
@@ -91,6 +91,7 @@ export function wrapError(message: string, originalError: unknown) {
9191
return error;
9292
}
9393

94+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
9495
return new Error(`${message}: ${originalError}`);
9596
}
9697

@@ -130,7 +131,7 @@ export async function resolveExecutable(
130131
export async function runCommand(
131132
command: string,
132133
args?: readonly string[] | undefined,
133-
options?: execa.Options<string> | undefined,
134+
options?: execa.Options | undefined,
134135
): Promise<void> {
135136
await execa(command, args, options);
136137
}
@@ -149,7 +150,7 @@ export async function runCommand(
149150
export async function getStdoutFromCommand(
150151
command: string,
151152
args?: readonly string[] | undefined,
152-
options?: execa.Options<string> | undefined,
153+
options?: execa.Options | undefined,
153154
): Promise<string> {
154155
return (await execa(command, args, options)).stdout.trim();
155156
}
@@ -167,7 +168,7 @@ export async function getStdoutFromCommand(
167168
export async function getLinesFromCommand(
168169
command: string,
169170
args?: readonly string[] | undefined,
170-
options?: execa.Options<string> | undefined,
171+
options?: execa.Options | undefined,
171172
): Promise<string[]> {
172173
const { stdout } = await execa(command, args, options);
173174
return stdout.split('\n').filter((value) => value !== '');

src/monorepo-workflow-operations.test.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
import fs from 'fs';
2-
import path from 'path';
32
import { when } from 'jest-when';
3+
import path from 'path';
44
import { MockWritable } from 'stdio-mock';
5-
import { withSandbox, Sandbox, isErrorWithCode } from '../tests/helpers';
6-
import { buildMockProject, Require } from '../tests/unit/helpers';
7-
import { followMonorepoWorkflow } from './monorepo-workflow-operations';
5+
86
import * as editorModule from './editor';
97
import type { Editor } from './editor';
10-
import { ReleaseType } from './initial-parameters';
11-
import * as releaseSpecificationModule from './release-specification';
12-
import type { ReleaseSpecification } from './release-specification';
8+
import type { ReleaseType } from './initial-parameters';
9+
import { followMonorepoWorkflow } from './monorepo-workflow-operations';
1310
import * as releasePlanModule from './release-plan';
1411
import type { ReleasePlan } from './release-plan';
12+
import * as releaseSpecificationModule from './release-specification';
13+
import type { ReleaseSpecification } from './release-specification';
1514
import * as repoModule from './repo';
15+
import { withSandbox, isErrorWithCode } from '../tests/helpers';
16+
import type { Sandbox } from '../tests/helpers';
17+
import { buildMockProject } from '../tests/unit/helpers';
18+
import type { Require } from '../tests/unit/helpers';
1619

1720
jest.mock('./editor');
1821
jest.mock('./release-plan');

src/monorepo-workflow-operations.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
import type { WriteStream } from 'fs';
22
import path from 'path';
3+
4+
import { determineEditor } from './editor';
35
import {
46
ensureDirectoryPathExists,
57
fileExists,
68
removeFile,
79
writeFile,
810
} from './fs';
9-
import { determineEditor } from './editor';
10-
import { ReleaseType } from './initial-parameters';
11-
import { Project } from './project';
11+
import type { ReleaseType } from './initial-parameters';
12+
import type { Project } from './project';
1213
import { planRelease, executeReleasePlan } from './release-plan';
13-
import { captureChangesInReleaseBranch } from './repo';
1414
import {
1515
generateReleaseSpecificationTemplateForMonorepo,
1616
waitForUserToEditReleaseSpecification,
1717
validateReleaseSpecification,
1818
} from './release-specification';
19+
import { captureChangesInReleaseBranch } from './repo';
1920

2021
/**
2122
* For a monorepo, the process works like this:

src/package-manifest.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import fs from 'fs';
22
import path from 'path';
33
import { SemVer } from 'semver';
4-
import { withSandbox } from '../tests/helpers';
4+
55
import { readPackageManifest } from './package-manifest';
6+
import { withSandbox } from '../tests/helpers';
67

78
describe('package-manifest', () => {
89
describe('readPackageManifest', () => {

src/package-manifest.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import path from 'path';
21
import {
32
ManifestFieldNames as PackageManifestFieldNames,
43
ManifestDependencyFieldNames as PackageManifestDependenciesFieldNames,
54
} from '@metamask/action-utils';
5+
import path from 'path';
6+
67
import { readJsonObjectFile } from './fs';
78
import { isTruthyString } from './misc-utils';
89
import { isValidSemver, SemVer } from './semver';

src/package.test.ts

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1+
import * as autoChangelog from '@metamask/auto-changelog';
12
import fs from 'fs';
2-
import path from 'path';
33
import { when } from 'jest-when';
4-
import * as autoChangelog from '@metamask/auto-changelog';
4+
import path from 'path';
55
import { SemVer } from 'semver';
66
import { MockWritable } from 'stdio-mock';
7-
import { withSandbox } from '../tests/helpers';
8-
import {
9-
buildMockPackage,
10-
buildMockProject,
11-
buildMockManifest,
12-
createNoopWriteStream,
13-
} from '../tests/unit/helpers';
7+
8+
import * as fsModule from './fs';
149
import {
1510
readMonorepoRootPackage,
1611
readMonorepoWorkspacePackage,
1712
updatePackage,
1813
} from './package';
19-
import * as fsModule from './fs';
2014
import * as packageManifestModule from './package-manifest';
2115
import * as repoModule from './repo';
16+
import { withSandbox } from '../tests/helpers';
17+
import {
18+
buildMockPackage,
19+
buildMockProject,
20+
buildMockManifest,
21+
createNoopWriteStream,
22+
} from '../tests/unit/helpers';
2223

2324
jest.mock('@metamask/auto-changelog');
2425
jest.mock('./package-manifest');

src/package.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
import fs, { WriteStream } from 'fs';
1+
import { updateChangelog } from '@metamask/auto-changelog';
2+
import type { WriteStream } from 'fs';
3+
import fs from 'fs';
24
import path from 'path';
35
import { format } from 'util';
4-
import { updateChangelog } from '@metamask/auto-changelog';
5-
import { WriteStreamLike, readFile, writeFile, writeJsonFile } from './fs';
6+
7+
import type { WriteStreamLike } from './fs';
8+
import { readFile, writeFile, writeJsonFile } from './fs';
69
import { isErrorWithCode } from './misc-utils';
7-
import {
8-
readPackageManifest,
10+
import type {
911
UnvalidatedPackageManifest,
1012
ValidatedPackageManifest,
1113
} from './package-manifest';
12-
import { Project } from './project';
13-
import { PackageReleasePlan } from './release-plan';
14+
import { readPackageManifest } from './package-manifest';
15+
import type { Project } from './project';
16+
import type { PackageReleasePlan } from './release-plan';
1417
import { hasChangesInDirectorySinceGitTag } from './repo';
15-
import { SemVer } from './semver';
18+
import type { SemVer } from './semver';
1619

1720
const MANIFEST_FILE_NAME = 'package.json';
1821
const CHANGELOG_FILE_NAME = 'CHANGELOG.md';

src/project.test.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
import * as actionUtils from '@metamask/action-utils';
12
import fs from 'fs';
2-
import path from 'path';
33
import { when } from 'jest-when';
4+
import path from 'path';
45
import { SemVer } from 'semver';
5-
import * as actionUtils from '@metamask/action-utils';
6-
import { withSandbox } from '../tests/helpers';
7-
import { buildMockPackage, createNoopWriteStream } from '../tests/unit/helpers';
8-
import { readProject } from './project';
6+
97
import * as packageModule from './package';
8+
import { readProject } from './project';
109
import * as repoModule from './repo';
10+
import { withSandbox } from '../tests/helpers';
11+
import { buildMockPackage, createNoopWriteStream } from '../tests/unit/helpers';
1112

1213
jest.mock('./package');
1314
jest.mock('./repo');

src/project.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
import { resolve } from 'path';
21
import { getWorkspaceLocations } from '@metamask/action-utils';
3-
import { WriteStreamLike } from './fs';
2+
import { resolve } from 'path';
3+
4+
import type { WriteStreamLike } from './fs';
5+
import type { Package } from './package';
46
import {
5-
Package,
67
readMonorepoRootPackage,
78
readMonorepoWorkspacePackage,
89
} from './package';
9-
import { getRepositoryHttpsUrl, getTagNames } from './repo';
10-
import { SemVer } from './semver';
1110
import { PackageManifestFieldNames } from './package-manifest';
11+
import { getRepositoryHttpsUrl, getTagNames } from './repo';
12+
import type { SemVer } from './semver';
1213

1314
/**
1415
* The release version of the root package of a monorepo extracted from its
@@ -110,9 +111,9 @@ export async function readProject(
110111
});
111112
}),
112113
)
113-
).reduce((obj, pkg) => {
114+
).reduce<Record<string, Package>>((obj, pkg) => {
114115
return { ...obj, [pkg.validatedManifest.name]: pkg };
115-
}, {} as Record<string, Package>);
116+
}, {});
116117

117118
const isMonorepo = Object.keys(workspacePackages).length > 0;
118119

src/release-plan.test.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import fs from 'fs';
22
import { SemVer } from 'semver';
3-
import { buildMockProject, buildMockPackage } from '../tests/unit/helpers';
3+
4+
import * as packageUtils from './package';
45
import { planRelease, executeReleasePlan } from './release-plan';
56
import { IncrementableVersionParts } from './release-specification';
6-
import * as packageUtils from './package';
7+
import { buildMockProject, buildMockPackage } from '../tests/unit/helpers';
78

89
jest.mock('./package');
910

0 commit comments

Comments
 (0)