Skip to content

Commit

Permalink
style(core): change prettier configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMason committed Jan 19, 2020
1 parent c7b46a6 commit f580fd8
Show file tree
Hide file tree
Showing 27 changed files with 156 additions and 155 deletions.
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"arrowParens": "always",
"printWidth": 80,
"proseWrap": "always",
"singleQuote": true
"singleQuote": true,
"trailingComma": "all"
}
20 changes: 10 additions & 10 deletions src/bin-fix-mismatches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ program.description(
version, so that every package requires eg. react@16.4.2, instead of a
combination of react@16.4.2, react@0.15.9, and react@16.0.0.`.replace(
/^\n/,
''
)
'',
),
);

program.on('--help', () => {
Expand All @@ -22,12 +22,12 @@ program.on('--help', () => {
${chalk.grey('# uses packages defined by --source when provided')}
syncpack fix-mismatches --source ${chalk.yellow('"apps/*/package.json"')}
${chalk.grey(
'# uses dependencies regular expression defined by --filter when provided'
'# uses dependencies regular expression defined by --filter when provided',
)}
syncpack fix-mismatches --filter ${chalk.yellow('"typescript|tslint"')}
${chalk.grey('# multiple globs can be provided like this')}
syncpack fix-mismatches --source ${chalk.yellow(
'"apps/*/package.json"'
'"apps/*/package.json"',
)} --source ${chalk.yellow('"core/*/package.json"')}
${chalk.grey('# only fix "devDependencies"')}
syncpack fix-mismatches --dev
Expand All @@ -39,24 +39,24 @@ program.on('--help', () => {
console.log(`Resolving Packages:
1. If ${chalk.yellow(`--source`)} globs are provided, use those.
2. If using Yarn Workspaces, read ${chalk.yellow(
`workspaces`
`workspaces`,
)} from ${chalk.yellow(`package.json`)}.
3. If using Lerna, read ${chalk.yellow(`packages`)} from ${chalk.yellow(
`lerna.json`
`lerna.json`,
)}.
4. Default to ${chalk.yellow(`"package.json"`)} and ${chalk.yellow(
`"packages/*/package.json"`
`"packages/*/package.json"`,
)}.
`);
console.log(`Reference:
globs ${chalk.blue.underline(
'https://github.com/isaacs/node-glob#glob-primer'
'https://github.com/isaacs/node-glob#glob-primer',
)}
lerna.json ${chalk.blue.underline(
'https://github.com/lerna/lerna#lernajson'
'https://github.com/lerna/lerna#lernajson',
)}
Yarn Workspaces ${chalk.blue.underline(
'https://yarnpkg.com/lang/en/docs/workspaces'
'https://yarnpkg.com/lang/en/docs/workspaces',
)}`);
});

Expand Down
16 changes: 8 additions & 8 deletions src/bin-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ program.description(
Organise package.json files according to a conventional format, where fields
appear in a predictable order and nested fields are ordered alphabetically.
Shorthand properties are used where available, such as the "repository" and
"bugs" fields.`.replace(/^\n/, '')
"bugs" fields.`.replace(/^\n/, ''),
);

program.on('--help', () => {
Expand All @@ -21,32 +21,32 @@ program.on('--help', () => {
syncpack format --source ${chalk.yellow('"apps/*/package.json"')}
${chalk.grey('# multiple globs can be provided like this')}
syncpack format --source ${chalk.yellow(
'"apps/*/package.json"'
'"apps/*/package.json"',
)} --source ${chalk.yellow('"core/*/package.json"')}
${chalk.grey('# indent package.json with 4 spaces instead of 2')}
syncpack format --indent ${chalk.yellow('" "')}
`);
console.log(`Resolving Packages:
1. If ${chalk.yellow(`--source`)} globs are provided, use those.
2. If using Yarn Workspaces, read ${chalk.yellow(
`workspaces`
`workspaces`,
)} from ${chalk.yellow(`package.json`)}.
3. If using Lerna, read ${chalk.yellow(`packages`)} from ${chalk.yellow(
`lerna.json`
`lerna.json`,
)}.
4. Default to ${chalk.yellow(`"package.json"`)} and ${chalk.yellow(
`"packages/*/package.json"`
`"packages/*/package.json"`,
)}.
`);
console.log(`Reference:
globs ${chalk.blue.underline(
'https://github.com/isaacs/node-glob#glob-primer'
'https://github.com/isaacs/node-glob#glob-primer',
)}
lerna.json ${chalk.blue.underline(
'https://github.com/lerna/lerna#lernajson'
'https://github.com/lerna/lerna#lernajson',
)}
Yarn Workspaces ${chalk.blue.underline(
'https://yarnpkg.com/lang/en/docs/workspaces'
'https://yarnpkg.com/lang/en/docs/workspaces',
)}`);
});

Expand Down
18 changes: 9 additions & 9 deletions src/bin-list-mismatches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { run } from './list-mismatches';
program.description(
`
List dependencies which are required by multiple packages, where the version
is not the same across every package.`.replace(/^\n/, '')
is not the same across every package.`.replace(/^\n/, ''),
);

program.on('--help', () => {
Expand All @@ -19,10 +19,10 @@ program.on('--help', () => {
syncpack list-mismatches --source ${chalk.yellow('"apps/*/package.json"')}
${chalk.grey('# multiple globs can be provided like this')}
syncpack list-mismatches --source ${chalk.yellow(
'"apps/*/package.json"'
'"apps/*/package.json"',
)} --source ${chalk.yellow('"core/*/package.json"')}
${chalk.grey(
'# uses dependencies regular expression defined by --filter when provided'
'# uses dependencies regular expression defined by --filter when provided',
)}
syncpack list-mismatches --filter ${chalk.yellow('"typescript|tslint"')}
${chalk.grey('# only list "devDependencies"')}
Expand All @@ -33,24 +33,24 @@ program.on('--help', () => {
console.log(`Resolving Packages:
1. If ${chalk.yellow(`--source`)} globs are provided, use those.
2. If using Yarn Workspaces, read ${chalk.yellow(
`workspaces`
`workspaces`,
)} from ${chalk.yellow(`package.json`)}.
3. If using Lerna, read ${chalk.yellow(`packages`)} from ${chalk.yellow(
`lerna.json`
`lerna.json`,
)}.
4. Default to ${chalk.yellow(`"package.json"`)} and ${chalk.yellow(
`"packages/*/package.json"`
`"packages/*/package.json"`,
)}.
`);
console.log(`Reference:
globs ${chalk.blue.underline(
'https://github.com/isaacs/node-glob#glob-primer'
'https://github.com/isaacs/node-glob#glob-primer',
)}
lerna.json ${chalk.blue.underline(
'https://github.com/lerna/lerna#lernajson'
'https://github.com/lerna/lerna#lernajson',
)}
Yarn Workspaces ${chalk.blue.underline(
'https://yarnpkg.com/lang/en/docs/workspaces'
'https://yarnpkg.com/lang/en/docs/workspaces',
)}`);
});

Expand Down
18 changes: 9 additions & 9 deletions src/bin-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { run } from './list';

program.description(
`
List all dependencies required by your packages.`.replace(/^\n/, '')
List all dependencies required by your packages.`.replace(/^\n/, ''),
);

program.on('--help', () => {
Expand All @@ -17,12 +17,12 @@ program.on('--help', () => {
${chalk.grey('# uses packages defined by --source when provided')}
syncpack list --source ${chalk.yellow('"apps/*/package.json"')}
${chalk.grey(
'# uses dependencies regular expression defined by --filter when provided'
'# uses dependencies regular expression defined by --filter when provided',
)}
syncpack list --filter ${chalk.yellow('"typescript|tslint"')}
${chalk.grey('# multiple globs can be provided like this')}
syncpack list --source ${chalk.yellow(
'"apps/*/package.json"'
'"apps/*/package.json"',
)} --source ${chalk.yellow('"core/*/package.json"')}
${chalk.grey('# only inspect "devDependencies"')}
syncpack list --dev
Expand All @@ -32,24 +32,24 @@ program.on('--help', () => {
console.log(`Resolving Packages:
1. If ${chalk.yellow(`--source`)} globs are provided, use those.
2. If using Yarn Workspaces, read ${chalk.yellow(
`workspaces`
`workspaces`,
)} from ${chalk.yellow(`package.json`)}.
3. If using Lerna, read ${chalk.yellow(`packages`)} from ${chalk.yellow(
`lerna.json`
`lerna.json`,
)}.
4. Default to ${chalk.yellow(`"package.json"`)} and ${chalk.yellow(
`"packages/*/package.json"`
`"packages/*/package.json"`,
)}.
`);
console.log(`Reference:
globs ${chalk.blue.underline(
'https://github.com/isaacs/node-glob#glob-primer'
'https://github.com/isaacs/node-glob#glob-primer',
)}
lerna.json ${chalk.blue.underline(
'https://github.com/lerna/lerna#lernajson'
'https://github.com/lerna/lerna#lernajson',
)}
Yarn Workspaces ${chalk.blue.underline(
'https://yarnpkg.com/lang/en/docs/workspaces'
'https://yarnpkg.com/lang/en/docs/workspaces',
)}`);
});

Expand Down
16 changes: 8 additions & 8 deletions src/bin-set-semver-ranges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { run } from './set-semver-ranges';
program.description(
`
Ensure dependency versions used within "dependencies", "devDependencies", and
"peerDependencies" follow a consistent format.`.replace(/^\n/, '')
"peerDependencies" follow a consistent format.`.replace(/^\n/, ''),
);

program.on('--help', () => {
Expand All @@ -19,7 +19,7 @@ program.on('--help', () => {
syncpack set-semver-ranges --source ${chalk.yellow('"apps/*/package.json"')}
${chalk.grey('# multiple globs can be provided like this')}
syncpack set-semver-ranges --source ${chalk.yellow(
'"apps/*/package.json"'
'"apps/*/package.json"',
)} --source ${chalk.yellow('"core/*/package.json"')}
${chalk.grey('# use ~ range instead of default ""')}
syncpack set-semver-ranges --semver-range ~
Expand All @@ -43,24 +43,24 @@ program.on('--help', () => {
console.log(`Resolving Packages:
1. If ${chalk.yellow(`--source`)} globs are provided, use those.
2. If using Yarn Workspaces, read ${chalk.yellow(
`workspaces`
`workspaces`,
)} from ${chalk.yellow(`package.json`)}.
3. If using Lerna, read ${chalk.yellow(`packages`)} from ${chalk.yellow(
`lerna.json`
`lerna.json`,
)}.
4. Default to ${chalk.yellow(`"package.json"`)} and ${chalk.yellow(
`"packages/*/package.json"`
`"packages/*/package.json"`,
)}.
`);
console.log(`Reference:
globs ${chalk.blue.underline(
'https://github.com/isaacs/node-glob#glob-primer'
'https://github.com/isaacs/node-glob#glob-primer',
)}
lerna.json ${chalk.blue.underline(
'https://github.com/lerna/lerna#lernajson'
'https://github.com/lerna/lerna#lernajson',
)}
Yarn Workspaces ${chalk.blue.underline(
'https://yarnpkg.com/lang/en/docs/workspaces'
'https://yarnpkg.com/lang/en/docs/workspaces',
)}`);
});

Expand Down
30 changes: 15 additions & 15 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IManifestKey } from './typings';
export const DEPENDENCY_TYPES: IManifestKey[] = [
'dependencies',
'devDependencies',
'peerDependencies'
'peerDependencies',
];

export const SORT_AZ = [
Expand All @@ -13,7 +13,7 @@ export const SORT_AZ = [
'files',
'keywords',
'peerDependencies',
'scripts'
'scripts',
];

export const SORT_FIRST = ['name', 'description', 'version', 'author'];
Expand All @@ -39,7 +39,7 @@ export const SEMVER_ORDER = [
RANGE_MINOR,
RANGE_GTE,
RANGE_GT,
RANGE_ANY
RANGE_ANY,
];

const DEFAULT_INDENT = ' ';
Expand All @@ -51,66 +51,66 @@ const ALL_PATTERNS = [MONOREPO_PATTERN, PACKAGES_PATTERN];
export const FIX_MISMATCHES = {
command: 'fix-mismatches',
description:
'set dependencies used with different versions to the same version'
'set dependencies used with different versions to the same version',
};

export const FORMAT = {
command: 'format',
description: 'sort and shorten properties according to a convention'
description: 'sort and shorten properties according to a convention',
};

export const LIST = {
command: 'list',
description: 'list every dependency used in your packages'
description: 'list every dependency used in your packages',
};

export const LIST_MISMATCHES = {
command: 'list-mismatches',
description:
'list every dependency used with different versions in your packages'
'list every dependency used with different versions in your packages',
};

export const SET_SEMVER_RANGES = {
command: 'set-semver-ranges',
description: 'set semver ranges to the given format'
description: 'set semver ranges to the given format',
};

export const OPTION_SEMVER_RANGE = {
default: DEFAULT_SEMVER_RANGE,
description:
`${RANGE_LT}, ${RANGE_LTE}, "${RANGE_EXACT}", ${RANGE_PATCH}, ${RANGE_MINOR}, ` +
`${RANGE_GTE}, ${RANGE_GT}, or ${RANGE_ANY}. defaults to "${DEFAULT_SEMVER_RANGE}"`,
spec: '-r, --semver-range <range>'
spec: '-r, --semver-range <range>',
};

export const OPTION_SOURCES = {
default: ALL_PATTERNS,
description: 'glob pattern for package.json files to read from',
spec: '-s, --source [pattern]'
spec: '-s, --source [pattern]',
};

export const OPTIONS_PROD = {
description: 'include dependencies',
spec: '-p, --prod'
spec: '-p, --prod',
};

export const OPTIONS_DEV = {
description: 'include devDependencies',
spec: '-d, --dev'
spec: '-d, --dev',
};

export const OPTIONS_PEER = {
description: 'include peerDependencies',
spec: '-P, --peer'
spec: '-P, --peer',
};

export const OPTIONS_FILTER_DEPENDENCIES = {
description: 'regex for depdendency filter',
spec: '-f, --filter [pattern]'
spec: '-f, --filter [pattern]',
};

export const OPTION_INDENT = {
default: DEFAULT_INDENT,
description: `override indentation. defaults to "${DEFAULT_INDENT}"`,
spec: '-i, --indent [value]'
spec: '-i, --indent [value]',
};

0 comments on commit f580fd8

Please sign in to comment.