Skip to content

Commit

Permalink
Update prettier (#560)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecraig12345 authored Jul 22, 2021
1 parent d8057ac commit 45d18e5
Show file tree
Hide file tree
Showing 23 changed files with 140 additions and 52 deletions.
7 changes: 3 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@

# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: "daily"
interval: 'daily'
# Disable version updates for npm dependencies
open-pull-requests-limit: 0
12 changes: 11 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
CHANGELOG.md
*.snap
*.styl
*.svg
.*ignore
.nojekyll
docs/.vuepress/dist
change
CHANGELOG.*
lib
LICENSE
node_modules
yarn.lock
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"trailingComma": "es5",
"tabWidth": 2,
"singleQuote": true,
"printWidth": 120
"printWidth": 120,
"arrowParens": "avoid"
}
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

# Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.microsoft.com.

Expand Down
7 changes: 7 additions & 0 deletions change/beachball-20e181e7-8452-4431-8b81-3ae32cf7090c.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Update prettier",
"packageName": "beachball",
"email": "[email protected]",
"dependentChangeType": "none"
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"checkchange": "node ./lib/cli.js check",
"docs": "vuepress dev docs --host localhost",
"docs:build": "vuepress build docs",
"prettier": "prettier --write --config ../../.prettierrc --ignore-path ../../.prettierignore 'src/**/*'",
"format": "prettier --write '**/*'",
"pub": "node ./lib/cli.js publish",
"release": "node ./lib/cli.js publish -y",
"release:docs": "yarn docs:build && yarn gh-pages -d docs/.vuepress/dist --dotfiles",
Expand Down Expand Up @@ -67,7 +67,7 @@
"gh-pages": "^3.1.0",
"jest": "^24.8.0",
"ncp": "^2.0.0",
"prettier": "^1.19.0",
"prettier": "~2.3.2",
"rimraf": "^3.0.0",
"tmp": "^0.1.0",
"ts-jest": "^24.0.2",
Expand Down
23 changes: 19 additions & 4 deletions src/__e2e__/bump.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,11 @@ describe('version bumping', () => {

git(['push', 'origin', 'master'], { cwd: repo.rootPath });

await bump({ path: repo.rootPath, bumpDeps: false, fromRef: revParseOutput.stdout } as BeachballOptions);
await bump({
path: repo.rootPath,
bumpDeps: false,
fromRef: revParseOutput.stdout,
} as BeachballOptions);

const packageInfos = getPackageInfos(repo.rootPath);

Expand Down Expand Up @@ -335,7 +339,10 @@ describe('version bumping', () => {

git(['push', 'origin', 'master'], { cwd: repo.rootPath });

await bump({ path: repo.rootPath, groups: [{ include: 'packages/*', name: 'testgroup' }] } as BeachballOptions);
await bump({
path: repo.rootPath,
groups: [{ include: 'packages/*', name: 'testgroup' }],
} as BeachballOptions);

const packageInfos = getPackageInfos(repo.rootPath);

Expand Down Expand Up @@ -461,7 +468,11 @@ describe('version bumping', () => {

git(['push', 'origin', 'master'], { cwd: repo.rootPath });

await bump({ path: repo.rootPath, bumpDeps: true, scope: ['!packages/foo'] } as BeachballOptions);
await bump({
path: repo.rootPath,
bumpDeps: true,
scope: ['!packages/foo'],
} as BeachballOptions);

const packageInfos = getPackageInfos(repo.rootPath);
expect(packageInfos['foo'].version).toBe('1.0.0');
Expand Down Expand Up @@ -491,7 +502,11 @@ describe('version bumping', () => {

git(['push', 'origin', 'master'], { cwd: repo.rootPath });

await bump({ path: repo.rootPath, bumpDeps: true, scope: ['!packages/foo'] } as BeachballOptions);
await bump({
path: repo.rootPath,
bumpDeps: true,
scope: ['!packages/foo'],
} as BeachballOptions);

const packageInfos = getPackageInfos(repo.rootPath);
expect(packageInfos['foo'].version).toBe('1.0.0');
Expand Down
2 changes: 1 addition & 1 deletion src/__e2e__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ it('--config overrides configuration path', async () => {
const repo = await repositoryFactory.cloneRepository();
const config = await inDirectory(repo.root!, async () => {
await writeConfig('module.exports = { branch: "origin/main" };');
await writeFileAsync('alternate.config.js', 'module.exports = { branch: "origin/foo" };')
await writeFileAsync('alternate.config.js', 'module.exports = { branch: "origin/foo" };');
return getOptions([...baseArgv, '--config', 'alternate.config.js']);
});
expect(config.branch).toEqual('origin/foo');
Expand Down
14 changes: 12 additions & 2 deletions src/__e2e__/packageManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ describe('packageManager', () => {
it('publish package with defaultNpmTag publishes as defaultNpmTag', () => {
const testPackageInfoWithDefaultNpmTag = {
...testPackageInfo,
combinedOptions: { gitTags: true, tag: null, defaultNpmTag: testTag, disallowedChangeTypes: null },
combinedOptions: {
gitTags: true,
tag: null,
defaultNpmTag: testTag,
disallowedChangeTypes: null,
},
};
const publishResult = packagePublish(testPackageInfoWithDefaultNpmTag, registry.getUrl(), '', '');
expect(publishResult.success).toBeTruthy();
Expand All @@ -83,7 +88,12 @@ describe('packageManager', () => {
it('publish with specified tag overrides defaultNpmTag', () => {
const testPackageInfoWithDefaultNpmTag = {
...testPackageInfo,
combinedOptions: { gitTags: true, tag: testTag, defaultNpmTag: 'thisShouldNotBeUsed', disallowedChangeTypes: null },
combinedOptions: {
gitTags: true,
tag: testTag,
defaultNpmTag: 'thisShouldNotBeUsed',
disallowedChangeTypes: null,
},
};
const publishResult = packagePublish(testPackageInfoWithDefaultNpmTag, registry.getUrl(), '', '');
expect(publishResult.success).toBeTruthy();
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/bump/updateRelatedChangeType.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import _ from 'lodash';
import { ChangeInfo } from '../../types/ChangeInfo';

describe('updateRelatedChangeType', () => {
const bumpInfoFixture: BumpInfo = ({
const bumpInfoFixture: BumpInfo = {
changeFileChangeInfos: new Map(),
dependents: {},
calculatedChangeInfos: {},
Expand All @@ -30,7 +30,7 @@ describe('updateRelatedChangeType', () => {
newPackages: new Set(),
packageGroups: {},
groupOptions: {},
} as unknown) as BumpInfo;
} as unknown as BumpInfo;

const changeInfoFixture: ChangeInfo = {
dependentChangeType: 'none',
Expand Down
10 changes: 8 additions & 2 deletions src/__tests__/changelog/mergeChangelogs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ describe('mergeChangelogs', () => {
},
];

const mergedChangelog = mergeChangelogs(changelogs, { name: 'master', version: '1.2.3' } as PackageInfo);
const mergedChangelog = mergeChangelogs(changelogs, {
name: 'master',
version: '1.2.3',
} as PackageInfo);
expect(mergedChangelog).toBeDefined();
expect(mergedChangelog!.name).toBe('master');
expect(mergedChangelog!.version).toBe('1.2.3');
Expand Down Expand Up @@ -72,7 +75,10 @@ describe('mergeChangelogs', () => {
},
];

const mergedChangelog = mergeChangelogs(changelogs, { name: 'master', version: '1.2.3' } as PackageInfo);
const mergedChangelog = mergeChangelogs(changelogs, {
name: 'master',
version: '1.2.3',
} as PackageInfo);
expect(mergedChangelog).toBeDefined();
expect(mergedChangelog!.name).toBe('master');
expect(mergedChangelog!.version).toBe('1.2.3');
Expand Down
14 changes: 12 additions & 2 deletions src/__tests__/changelog/renderChangelog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,18 @@ describe('renderChangelog', () => {
comments: {
major: [],
minor: [
{ comment: 'Awesome change', author: '[email protected]', commit: 'sha1', package: 'foo' },
{ comment: 'Boring change', author: '[email protected]', commit: 'sha2', package: 'foo' },
{
comment: 'Awesome change',
author: '[email protected]',
commit: 'sha1',
package: 'foo',
},
{
comment: 'Boring change',
author: '[email protected]',
commit: 'sha2',
package: 'foo',
},
],
patch: [
{ comment: 'Fix', author: '[email protected]', commit: 'sha3', package: 'foo' },
Expand Down
14 changes: 12 additions & 2 deletions src/__tests__/changelog/renderPackageChangelog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,18 @@ describe('changelog renderers -', () => {
comments: {
major: [],
minor: [
{ comment: 'Awesome change', author: '[email protected]', commit: 'sha1', package: 'foo' },
{ comment: 'Boring change', author: '[email protected]', commit: 'sha2', package: 'foo' },
{
comment: 'Awesome change',
author: '[email protected]',
commit: 'sha1',
package: 'foo',
},
{
comment: 'Boring change',
author: '[email protected]',
commit: 'sha2',
package: 'foo',
},
],
patch: [
{ comment: 'Fix', author: '[email protected]', commit: 'sha3', package: 'foo' },
Expand Down
7 changes: 6 additions & 1 deletion src/__tests__/publish/performPublishConfigOverrides.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ describe('perform publishConfig overrides', () => {

const packageInfos: PackageInfos = {
foo: {
combinedOptions: { defaultNpmTag: 'latest', disallowedChangeTypes: [], gitTags: true, tag: 'latest' },
combinedOptions: {
defaultNpmTag: 'latest',
disallowedChangeTypes: [],
gitTags: true,
tag: 'latest',
},
name: 'foo',
packageJsonPath: path.join(tmpDir, 'package.json'),
packageOptions: {},
Expand Down
8 changes: 4 additions & 4 deletions src/__tests__/publish/tagPackages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const createTagParameters = (tag: string, cwd: string) => {
return [['tag', '-a', '-f', tag, '-m', tag], { cwd }];
};

const noTagBumpInfo = ({
const noTagBumpInfo = {
calculatedChangeInfos: {
foo: 'minor',
bar: 'major',
Expand All @@ -34,9 +34,9 @@ const noTagBumpInfo = ({
},
modifiedPackages: new Set(['foo', 'bar']),
newPackages: new Set(),
} as unknown) as BumpInfo;
} as unknown as BumpInfo;

const oneTagBumpInfo = ({
const oneTagBumpInfo = {
calculatedChangeInfos: {
foo: 'minor',
bar: 'major',
Expand All @@ -59,7 +59,7 @@ const oneTagBumpInfo = ({
},
modifiedPackages: new Set(['foo', 'bar']),
newPackages: new Set(),
} as unknown) as BumpInfo;
} as unknown as BumpInfo;

beforeEach(() => {
(gitFailFast as jest.Mock).mockReset();
Expand Down
18 changes: 9 additions & 9 deletions src/__tests__/publish/toposortPackages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('toposortPackages', () => {
});

it('sort packages with dependencies', () => {
const packageInfos = ({
const packageInfos = {
foo: {
dependencies: {
foo3: '1.0.0',
Expand All @@ -25,13 +25,13 @@ describe('toposortPackages', () => {
},
},
foo2: {},
} as any) as PackageInfos;
} as any as PackageInfos;

expect(toposortPackages(['foo', 'foo2', 'foo3'], packageInfos)).toEqual(['foo2', 'foo3', 'foo']);
});

it('sort packages with different kinds of dependencies', () => {
const packageInfos = ({
const packageInfos = {
foo: {
dependencies: {
foo3: '1.0.0',
Expand All @@ -54,13 +54,13 @@ describe('toposortPackages', () => {
foo2: '1.0.0',
},
},
} as any) as PackageInfos;
} as any as PackageInfos;

expect(toposortPackages(['foo', 'foo2', 'foo3', 'foo4'], packageInfos)).toEqual(['foo2', 'foo3', 'foo4', 'foo']);
});

it('do not sort packages if it is not included', () => {
const packageInfos = ({
const packageInfos = {
foo: {
dependencies: {
foo3: '1.0.0',
Expand All @@ -73,13 +73,13 @@ describe('toposortPackages', () => {
foo2: '1.0.0',
},
},
} as any) as PackageInfos;
} as any as PackageInfos;

expect(toposortPackages(['foo', 'foo3'], packageInfos)).toEqual(['foo3', 'foo']);
});

it('throws if contains circular dependencies', () => {
const packageInfos = ({
const packageInfos = {
foo: {
dependencies: {
bar: '1.0.0',
Expand All @@ -91,15 +91,15 @@ describe('toposortPackages', () => {
foo: '1.0.0',
},
},
} as any) as PackageInfos;
} as any as PackageInfos;

expect(() => {
toposortPackages(['foo', 'bar'], packageInfos);
}).toThrow();
});

it('throws if package info is missing', () => {
const packageInfos = ({} as any) as PackageInfos;
const packageInfos = {} as any as PackageInfos;

expect(() => {
toposortPackages(['foo'], packageInfos);
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/publish/validatePackageDependencies.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BumpInfo } from '../../types/BumpInfo';
import _ from 'lodash';

describe('validatePackageDependencies', () => {
const bumpInfoFixture = ({
const bumpInfoFixture = {
changes: new Map(),
dependents: {},
calculatedChangeInfos: {},
Expand All @@ -23,7 +23,7 @@ describe('validatePackageDependencies', () => {
scopedPackages: new Set(['foo', 'bar']),
packageGroups: {},
groupOptions: {},
} as unknown) as BumpInfo;
} as unknown as BumpInfo;

it('invalid when dependencies contains private package', () => {
const bumpInfo = _.merge(_.cloneDeep(bumpInfoFixture), {
Expand Down
Loading

0 comments on commit 45d18e5

Please sign in to comment.