Skip to content

Commit

Permalink
prettier -w .
Browse files Browse the repository at this point in the history
  • Loading branch information
octogonz committed May 23, 2024
1 parent c44f066 commit 7d87045
Show file tree
Hide file tree
Showing 39 changed files with 107 additions and 117 deletions.
2 changes: 1 addition & 1 deletion apps/api-documenter/bin/api-documenter
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env node
require('../lib/start.js')
require('../lib/start.js');
12 changes: 6 additions & 6 deletions apps/api-documenter/src/documenters/YamlDocumenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -943,12 +943,12 @@ export class YamlDocumenter {
spec.fullName = apiItem
? apiItem.getScopedNameWithinPackage()
: token.canonicalReference
? token.canonicalReference
.withSource(undefined)
.withMeaning(undefined)
.withOverloadIndex(undefined)
.toString()
: token.text;
? token.canonicalReference
.withSource(undefined)
.withMeaning(undefined)
.withOverloadIndex(undefined)
.toString()
: token.text;
specs.push(spec);
} else {
specs.push({
Expand Down
2 changes: 1 addition & 1 deletion apps/api-extractor/bin/api-extractor
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env node
require('../lib/start.js')
require('../lib/start.js');
4 changes: 2 additions & 2 deletions apps/api-extractor/src/analyzer/AstImport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ export class AstImport extends AstSyntheticEntity {
const subKey: string = !options.exportName
? '*' // Equivalent to StarImport
: options.exportName.includes('.') // Equivalent to a named export
? options.exportName.split('.')[0]
: options.exportName;
? options.exportName.split('.')[0]
: options.exportName;
return `${options.modulePath}:${subKey}`;
}
default:
Expand Down
5 changes: 2 additions & 3 deletions apps/heft/src/cli/HeftActionRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,8 @@ async function _startLifecycleAsync(this: void, internalHeftSession: InternalHef

// Delete all temp folders for tasks by default
for (const pluginDefinition of lifecycle.pluginDefinitions) {
const lifecycleSession: IHeftLifecycleSession = await lifecycle.getSessionForPluginDefinitionAsync(
pluginDefinition
);
const lifecycleSession: IHeftLifecycleSession =
await lifecycle.getSessionForPluginDefinitionAsync(pluginDefinition);
deleteOperations.push({ sourcePath: lifecycleSession.tempFolderPath });
}

Expand Down
10 changes: 4 additions & 6 deletions apps/heft/src/utilities/GitUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,8 @@ export class GitUtilities {
let currentPath: string = normalizedWorkingDirectory;
while (currentPath.length >= gitRepoRootPath.length) {
const gitIgnoreFilePath: string = `${currentPath}/.gitignore`;
const gitIgnorePatterns: string[] | undefined = await this._tryReadGitIgnoreFileAsync(
gitIgnoreFilePath
);
const gitIgnorePatterns: string[] | undefined =
await this._tryReadGitIgnoreFileAsync(gitIgnoreFilePath);
if (gitIgnorePatterns) {
rawIgnorePatternsByGitignoreFolder.set(currentPath, gitIgnorePatterns);
}
Expand All @@ -201,9 +200,8 @@ export class GitUtilities {
const gitignoreRelativeFilePaths: string[] = await this._findUnignoredFilesAsync('*.gitignore');
for (const gitignoreRelativeFilePath of gitignoreRelativeFilePaths) {
const gitignoreFilePath: string = `${normalizedWorkingDirectory}/${gitignoreRelativeFilePath}`;
const gitIgnorePatterns: string[] | undefined = await this._tryReadGitIgnoreFileAsync(
gitignoreFilePath
);
const gitIgnorePatterns: string[] | undefined =
await this._tryReadGitIgnoreFileAsync(gitignoreFilePath);
if (gitIgnorePatterns) {
const parentPath: string = gitignoreFilePath.slice(0, gitignoreFilePath.lastIndexOf('/'));
rawIgnorePatternsByGitignoreFolder.set(parentPath, gitIgnorePatterns);
Expand Down
2 changes: 1 addition & 1 deletion apps/lockfile-explorer-web/assets/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
7 changes: 3 additions & 4 deletions apps/lockfile-explorer/src/commandLine.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@ import { parseCommandLine } from './commandLine';
describe('commandLine', () => {
describe('parseCommandLine()', () => {
it('sets showHelp when --help specified', async () => {
const result = parseCommandLine(['--help'])
const result = parseCommandLine(['--help']);
expect(result).toHaveProperty('showedHelp', true);
});

it('sets subspace when --subspace specified', async () => {
const result = parseCommandLine(['--subspace', 'wallet'])
const result = parseCommandLine(['--subspace', 'wallet']);
expect(result).toHaveProperty('subspace', 'wallet');
});

it('sets error when --subspace value not missing', async () => {
const result = parseCommandLine(['--subspace'])
const result = parseCommandLine(['--subspace']);
expect(result).toHaveProperty('error', 'Expecting argument after "--subspace"');
});
});
});

11 changes: 3 additions & 8 deletions apps/rush/src/RushVersionSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,9 @@ export class RushVersionSelector {
require(path.join(expectedRushPath, 'node_modules', '@microsoft', 'rush', 'lib', 'start'));
} else {
// For newer rush-lib, RushCommandSelector can test whether "rushx" is supported or not
const rushCliEntrypoint: {} = require(path.join(
expectedRushPath,
'node_modules',
'@microsoft',
'rush-lib',
'lib',
'index'
));
const rushCliEntrypoint: {} = require(
path.join(expectedRushPath, 'node_modules', '@microsoft', 'rush-lib', 'lib', 'index')
);
RushCommandSelector.execute(this._currentPackageVersion, rushCliEntrypoint, executeOptions);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
2 changes: 1 addition & 1 deletion build-tests/heft-sass-test/assets/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
6 changes: 3 additions & 3 deletions eslint/eslint-bulk/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ function findPatchPath(): string {
if (eslintPackageJsonPath) {
eslintPackageJsonPath = eslintPackageJsonPath.replace(/\\/g, '/');
const packagePath: string = eslintPackageJsonPath.substring(0, eslintPackageJsonPath.lastIndexOf('/'));
const {
bin: { eslint: relativeEslintBinPath } = {}
}: { bin?: Record<string, string> } = require(eslintPackageJsonPath);
const { bin: { eslint: relativeEslintBinPath } = {} }: { bin?: Record<string, string> } = require(
eslintPackageJsonPath
);
if (relativeEslintBinPath) {
eslintBinPath = `${packagePath}/${relativeEslintBinPath}`;
} else {
Expand Down
16 changes: 8 additions & 8 deletions eslint/eslint-patch/src/_patch-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let namingPath: string | undefined = undefined;
let eslintFolder: string | undefined = undefined;

// Probe for the ESLint >=8.0.0 layout:
for (let currentModule: NodeModule = module; ;) {
for (let currentModule: NodeModule = module; ; ) {
if (!eslintrcBundlePath) {
if (currentModule.filename.endsWith('eslintrc.cjs')) {
// For ESLint >=8.0.0, all @eslint/eslintrc code is bundled at this path:
Expand Down Expand Up @@ -93,7 +93,7 @@ for (let currentModule: NodeModule = module; ;) {

if (!eslintFolder) {
// Probe for the ESLint >=7.12.0 layout:
for (let currentModule: NodeModule = module; ;) {
for (let currentModule: NodeModule = module; ; ) {
if (!configArrayFactoryPath) {
// For ESLint >=7.12.0, config-array-factory.js is at this path:
// .../@eslint/eslintrc/lib/config-array-factory.js
Expand Down Expand Up @@ -154,7 +154,7 @@ if (!eslintFolder) {

if (!eslintFolder) {
// Probe for the <7.12.0 layout:
for (let currentModule: NodeModule = module; ;) {
for (let currentModule: NodeModule = module; ; ) {
// For ESLint <7.12.0, config-array-factory.js was at this path:
// .../eslint/lib/cli-engine/config-array-factory.js
if (/[\\/]eslint[\\/]lib[\\/]cli-engine[\\/]config-array-factory\.js$/i.test(currentModule.filename)) {
Expand Down Expand Up @@ -185,8 +185,8 @@ if (!eslintFolder) {
// This was tested with ESLint 6.1.0 .. 7.12.1.
throw new Error(
'Failed to patch ESLint because the calling module was not recognized.\n' +
'If you are using a newer ESLint version that may be unsupported, please create a GitHub issue:\n' +
'https://github.com/microsoft/rushstack/issues'
'If you are using a newer ESLint version that may be unsupported, please create a GitHub issue:\n' +
'https://github.com/microsoft/rushstack/issues'
);
}
currentModule = currentModule.parent;
Expand All @@ -207,9 +207,9 @@ if (isNaN(ESLINT_MAJOR_VERSION)) {
if (!(ESLINT_MAJOR_VERSION >= 6 && ESLINT_MAJOR_VERSION <= 9)) {
throw new Error(
'The ESLint patch script has only been tested with ESLint version 6.x, 7.x, 8.x, and 9.x.' +
` (Your version: ${eslintPackageVersion})\n` +
'Consider reporting a GitHub issue:\n' +
'https://github.com/microsoft/rushstack/issues'
` (Your version: ${eslintPackageVersion})\n` +
'Consider reporting a GitHub issue:\n' +
'https://github.com/microsoft/rushstack/issues'
);
}

Expand Down
12 changes: 6 additions & 6 deletions libraries/operation-graph/src/OperationExecutionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ export class OperationExecutionManager {
const finishedLoggingWord: string = groupRecord.hasFailures
? 'encountered an error'
: groupRecord.hasCancellations
? 'cancelled'
: 'finished';
? 'cancelled'
: 'finished';
terminal.writeLine(
` ---- ${groupRecord.name} ${finishedLoggingWord} (${groupRecord.duration.toFixed(3)}s) ---- `
);
Expand Down Expand Up @@ -199,10 +199,10 @@ export class OperationExecutionManager {
this._trackedOperationCount === 0
? OperationStatus.NoOp
: abortSignal.aborted
? OperationStatus.Aborted
: hasReportedFailures
? OperationStatus.Failure
: OperationStatus.Success;
? OperationStatus.Aborted
: hasReportedFailures
? OperationStatus.Failure
: OperationStatus.Success;

return finalStatus;
}
Expand Down
5 changes: 2 additions & 3 deletions libraries/package-extractor/src/PackageExtractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1094,9 +1094,8 @@ export class PackageExtractor {
);

if (linkedBinPackageNames.length && state.archiver) {
const binFolderItems: string[] = await FileSystem.readFolderItemNamesAsync(
extractedProjectBinFolder
);
const binFolderItems: string[] =
await FileSystem.readFolderItemNamesAsync(extractedProjectBinFolder);
for (const binFolderItem of binFolderItems) {
const binFilePath: string = path.join(extractedProjectBinFolder, binFolderItem);
await state.archiver.addToArchiveAsync({
Expand Down
5 changes: 2 additions & 3 deletions libraries/rig-package/src/test/RigConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,8 @@ describe(RigConfig.name, () => {

expect(rigConfig.rigFound).toBe(true);

const resolvedPath: string | undefined = await rigConfig.tryResolveConfigFilePathAsync(
'example-config.json'
);
const resolvedPath: string | undefined =
await rigConfig.tryResolveConfigFilePathAsync('example-config.json');

expect(resolvedPath).toBeDefined();
expectEqualPaths(
Expand Down
27 changes: 11 additions & 16 deletions libraries/rush-lib/src/api/test/RushProjectConfiguration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function validateConfiguration(rushProjectConfiguration: RushProjectConfiguratio
try {
rushProjectConfiguration.validatePhaseConfiguration(
Array.from(rushProjectConfiguration.operationSettingsByOperationName.keys()).map(
(phaseName) => ({ name: phaseName } as IPhase)
(phaseName) => ({ name: phaseName }) as IPhase
),
terminal
);
Expand Down Expand Up @@ -104,9 +104,8 @@ describe(RushProjectConfiguration.name, () => {

describe(RushProjectConfiguration.prototype.getCacheDisabledReason.name, () => {
it('Indicates if the build cache is completely disabled', async () => {
const config: RushProjectConfiguration | undefined = await loadProjectConfigurationAsync(
'test-project-a'
);
const config: RushProjectConfiguration | undefined =
await loadProjectConfigurationAsync('test-project-a');

if (!config) {
throw new Error('Failed to load config');
Expand All @@ -117,9 +116,8 @@ describe(RushProjectConfiguration.name, () => {
});

it('Indicates if the phase behavior is not defined', async () => {
const config: RushProjectConfiguration | undefined = await loadProjectConfigurationAsync(
'test-project-c'
);
const config: RushProjectConfiguration | undefined =
await loadProjectConfigurationAsync('test-project-c');

if (!config) {
throw new Error('Failed to load config');
Expand All @@ -130,9 +128,8 @@ describe(RushProjectConfiguration.name, () => {
});

it('Indicates if the phase has disabled the cache', async () => {
const config: RushProjectConfiguration | undefined = await loadProjectConfigurationAsync(
'test-project-c'
);
const config: RushProjectConfiguration | undefined =
await loadProjectConfigurationAsync('test-project-c');

if (!config) {
throw new Error('Failed to load config');
Expand All @@ -143,9 +140,8 @@ describe(RushProjectConfiguration.name, () => {
});

it('Indicates if tracked files are outputs of the phase', async () => {
const config: RushProjectConfiguration | undefined = await loadProjectConfigurationAsync(
'test-project-c'
);
const config: RushProjectConfiguration | undefined =
await loadProjectConfigurationAsync('test-project-c');

if (!config) {
throw new Error('Failed to load config');
Expand All @@ -159,9 +155,8 @@ describe(RushProjectConfiguration.name, () => {
});

it('returns undefined if the config is safe', async () => {
const config: RushProjectConfiguration | undefined = await loadProjectConfigurationAsync(
'test-project-c'
);
const config: RushProjectConfiguration | undefined =
await loadProjectConfigurationAsync('test-project-c');

if (!config) {
throw new Error('Failed to load config');
Expand Down
4 changes: 2 additions & 2 deletions libraries/rush-lib/src/cli/RushStartupBanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export class RushStartupBanner {
const nodeReleaseLabel: string = NodeJsCompatibility.isOddNumberedVersion
? 'unstable'
: NodeJsCompatibility.isLtsVersion
? 'LTS'
: 'pre-LTS';
? 'LTS'
: 'pre-LTS';
return `${nodeVersion} (${nodeReleaseLabel})`;
}

Expand Down
4 changes: 2 additions & 2 deletions libraries/rush-lib/src/cli/actions/AddAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ export class AddAction extends BaseAddAndRemoveAction {
rangeStyle = this._caretFlag.value
? SemVerStyle.Caret
: this._exactFlag.value
? SemVerStyle.Exact
: SemVerStyle.Tilde;
? SemVerStyle.Exact
: SemVerStyle.Tilde;
}

packagesToAdd.push({ packageName, version, rangeStyle });
Expand Down
5 changes: 2 additions & 3 deletions libraries/rush-lib/src/cli/actions/ListAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ export class ListAction extends BaseRushAction {

protected async runAsync(): Promise<void> {
const terminal: Terminal = new Terminal(new ConsoleTerminalProvider());
const selection: Set<RushConfigurationProject> = await this._selectionParameters.getSelectedProjectsAsync(
terminal
);
const selection: Set<RushConfigurationProject> =
await this._selectionParameters.getSelectedProjectsAsync(terminal);
Sort.sortSetBy(selection, (x: RushConfigurationProject) => x.packageName);
if (this._jsonFlag.value && this._detailedFlag.value) {
throw new Error(`The parameters "--json" and "--detailed" cannot be used together.`);
Expand Down
2 changes: 1 addition & 1 deletion libraries/rush-lib/src/cli/actions/test/AddAction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe(AddAction.name, () => {
jest.spyOn(process, 'exit').mockImplementation();

// Suppress "Another Rush command is already running" error
jest.spyOn(LockFile, 'tryAcquire').mockImplementation(() => ({} as LockFile));
jest.spyOn(LockFile, 'tryAcquire').mockImplementation(() => ({}) as LockFile);

oldExitCode = process.exitCode;
oldArgs = process.argv;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe(RemoveAction.name, () => {
jest.spyOn(process, 'exit').mockImplementation();

// Suppress "Another Rush command is already running" error
jest.spyOn(LockFile, 'tryAcquire').mockImplementation(() => ({} as LockFile));
jest.spyOn(LockFile, 'tryAcquire').mockImplementation(() => ({}) as LockFile);

oldExitCode = process.exitCode;
oldArgs = process.argv;
Expand Down
10 changes: 4 additions & 6 deletions libraries/rush-lib/src/logic/InteractiveUpgrader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ export class InteractiveUpgrader {
public async upgradeAsync(): Promise<IUpgradeInteractiveDeps> {
const rushProject: RushConfigurationProject = await this._getUserSelectedProjectForUpgradeAsync();

const dependenciesState: NpmCheck.INpmCheckPackage[] = await this._getPackageDependenciesStatusAsync(
rushProject
);
const dependenciesState: NpmCheck.INpmCheckPackage[] =
await this._getPackageDependenciesStatusAsync(rushProject);

const depsToUpgrade: IDepsToUpgradeAnswers = await this._getUserSelectedDependenciesToUpgradeAsync(
dependenciesState
);
const depsToUpgrade: IDepsToUpgradeAnswers =
await this._getUserSelectedDependenciesToUpgradeAsync(dependenciesState);
return { projects: [rushProject], depsToUpgrade };
}

Expand Down
Loading

0 comments on commit 7d87045

Please sign in to comment.