Skip to content

Commit

Permalink
chore(prettier): ran format
Browse files Browse the repository at this point in the history
  • Loading branch information
webdeveric committed Jul 27, 2024
1 parent a79035d commit 4730ec6
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: "pnpm"
cache: 'pnpm'
- name: Installing dependencies
run: pnpm install
- name: Linting
Expand Down
7 changes: 4 additions & 3 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ try {
const { json, info, packages, ...options } = getCliArguments();

const resolvedPackages: PackageJsonPath[] = await Readable.from(packages)
.map(packagePath => resolvePackageJson(packagePath), { concurrency: options.concurrency })
.map((packagePath) => resolvePackageJson(packagePath), { concurrency: options.concurrency })
.toArray();

const results: Result[] = [];
Expand All @@ -31,7 +31,7 @@ try {
setMaxListeners(100, controller.signal);

// Create a `Validator` for each `package.json`
const validators = resolvedPackages.map(path => {
const validators = resolvedPackages.map((path) => {
const validator = new Validator({
...options,
package: path,
Expand All @@ -46,6 +46,7 @@ try {
try {
// Sequentially process each `package.json` file.
for (const validator of validators) {
// eslint-disable-next-line no-await-in-loop
await validator.run();
}
} catch (error) {
Expand All @@ -66,7 +67,7 @@ try {
if (json) {
process.stdout.write(
JSON.stringify(
results.filter(result => info || result.code === ResultCode.Error),
results.filter((result) => info || result.code === ResultCode.Error),
null,
2,
),
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Logger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('Logger', () => {
LogLevel.Notice,
LogLevel.Info,
LogLevel.Debug,
])('emergency() logs for LogLevel: %d', logLevel => {
])('emergency() logs for LogLevel: %d', (logLevel) => {
logger.logLevel = logLevel;

logger.emergency('test');
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('Logger', () => {

it.each(['warn', 'warning'] satisfies (keyof Logger)[])(
'warn() is only used when level >= LogLevel.Warning',
method => {
(method) => {
logger.logLevel = LogLevel.Critical;

logger[method]('test');
Expand Down
8 changes: 4 additions & 4 deletions src/lib/Validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class Validator extends EventEmitter {
}

protected processResults(results: Result | Result[]): void {
[results].flat().forEach(result => this.processResult(result));
[results].flat().forEach((result) => this.processResult(result));
}

protected async checkFilesExist(entryPoints: EntryPoint[]): Promise<Result[]> {
Expand All @@ -70,7 +70,7 @@ export class Validator extends EventEmitter {
}

protected async checkSyntax(entryPoints: EntryPoint[]): Promise<Result[]> {
const jsEntryPoints = entryPoints.filter(entryPoint => /\.[cm]?js$/i.test(entryPoint.resolvedPath));
const jsEntryPoints = entryPoints.filter((entryPoint) => /\.[cm]?js$/i.test(entryPoint.resolvedPath));

return await Readable.from(jsEntryPoints)
.map(
Expand Down Expand Up @@ -157,15 +157,15 @@ export class Validator extends EventEmitter {
const entryPointsWithErrors = new Set<EntryPoint>();

const recordErrors = (results: Result[]): void => {
results.forEach(result => {
results.forEach((result) => {
if (result.code === ResultCode.Error) {
entryPointsWithErrors.add(result.entryPoint);
}
});
};

const getNextEntryPoints = (entryPoints: EntryPoint[]): EntryPoint[] => {
return entryPoints.filter(entryPoint => !entryPointsWithErrors.has(entryPoint));
return entryPoints.filter((entryPoint) => !entryPointsWithErrors.has(entryPoint));
};

// Always check to see if the file exists.
Expand Down
4 changes: 2 additions & 2 deletions src/utils/getCliArguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ export function getCliArguments(args?: NodeJS.Process['argv']): CliArguments {
return {
packages: positionals.length ? positionals : ['./package.json'],
concurrency: parseConcurrency(values.concurrency),
bail: noBail ? false : values.bail ?? config.options.bail.default,
bail: noBail ? false : (values.bail ?? config.options.bail.default),
check: values.check ?? config.options.check.default,
verify: values.verify ?? config.options.verify.default,
json: values.json ?? config.options.verify.default,
info: noInfo ? false : values.info ?? config.options.info.default,
info: noInfo ? false : (values.info ?? config.options.info.default),
};
}
2 changes: 1 addition & 1 deletion src/utils/getEntryPointsFromTypes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { describe, expect, it } from 'vitest';
import { getEntryPointsFromTypes } from './getEntryPointsFromTypes.js';

describe('getEntryPointsFromTypes()', () => {
it.each(['types', 'typings'])('types property %s: yields EntryPoint objects', typesProperty => {
it.each(['types', 'typings'])('types property %s: yields EntryPoint objects', (typesProperty) => {
expect(
Array.from(
getEntryPointsFromTypes(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/getPacklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export async function getPacklist(directory: string): Promise<string[]> {
const tree = await arborist.loadActual();
const files = await packlist(tree);

return files.map(file => fixSlash(file));
return files.map((file) => fixSlash(file));
}
2 changes: 1 addition & 1 deletion src/utils/parseConcurrency.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('parseConcurrency()', () => {

it.each(['bad input', undefined, true, false, null, {}, []])(
'Defaults to availableParallelism() when given "%s"',
value => {
(value) => {
const defaultValue = availableParallelism();

expect(parseConcurrency(value)).toEqual(defaultValue);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/parseLogLevel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('parseLogLevel()', () => {

it.each(['bad input', Number.MAX_SAFE_INTEGER, undefined, true, false, null, [], {}])(
'Returns default value when given "%s"',
value => {
(value) => {
expect(parseLogLevel(value, LogLevel.Alert)).toEqual(LogLevel.Alert);
},
);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/type-predicate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const isPackageBrowserRecord = (input: unknown): input is PackageBrowserR
return (
isObject(input) &&
Object.entries(input).every(
entry => typeof entry[0] === 'string' && (typeof entry[1] === 'string' || typeof entry[1] === 'boolean'),
(entry) => typeof entry[0] === 'string' && (typeof entry[1] === 'string' || typeof entry[1] === 'boolean'),
)
);
};
Expand Down

0 comments on commit 4730ec6

Please sign in to comment.