Skip to content

Commit

Permalink
chore: use BiomeJS to format our code (#3496)
Browse files Browse the repository at this point in the history
* chore: add biomejs and config to monorepo

* chore: vscode settings for biomejs

* chore: update ci and package.json scripts

* chore: update internal docs

* chore: format everything with biome

* chore: remove unused tools script

* chore: fix usage of reserved word

* chore: fix import order with biomejs

* chore: adjust formatter to use double quotes in JS

* chore: format code with double quotes

* chore: prettier should use double quotes too

* chore: fix biome.json

* chore: remove faiss_index files
  • Loading branch information
TheSisb authored Sep 29, 2023
1 parent b49762c commit 266222e
Show file tree
Hide file tree
Showing 1,945 changed files with 46,195 additions and 35,386 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": ["@changesets/changelog-github", {"repo": "twilio-labs/paste"}],
"changelog": ["@changesets/changelog-github", { "repo": "twilio-labs/paste" }],
"commit": false,
"linked": [],
"access": "public",
Expand Down
76 changes: 38 additions & 38 deletions .danger/__tests__/changesets-that-need-core-check.spec.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
import changesetsThatNeedCoreCheck, {
shouldFlagChangeset,
getChangesetsNotTaggingCore,
} from '../changesets-that-need-core-check';
shouldFlagChangeset,
} from "../changesets-that-need-core-check";

declare const global: any;

describe('shouldFlagChangeset', () => {
it('should not flag icon changesets', () => {
expect(shouldFlagChangeset('./.danger/__fixtures__/changeset/heavy-peaches-repeat.md')).toEqual(false);
describe("shouldFlagChangeset", () => {
it("should not flag icon changesets", () => {
expect(shouldFlagChangeset("./.danger/__fixtures__/changeset/heavy-peaches-repeat.md")).toEqual(false);
});

it('should not flag changesets with core in', () => {
expect(shouldFlagChangeset('./.danger/__fixtures__/changeset/pink-masks-walk.md')).toEqual(false);
it("should not flag changesets with core in", () => {
expect(shouldFlagChangeset("./.danger/__fixtures__/changeset/pink-masks-walk.md")).toEqual(false);
});

it('should flag changesets without core in', () => {
expect(shouldFlagChangeset('./.danger/__fixtures__/changeset/popular-cheetahs-punch.md')).toEqual(true);
expect(shouldFlagChangeset('./.danger/__fixtures__/changeset/pretty-cameras-burn.md')).toEqual(true);
it("should flag changesets without core in", () => {
expect(shouldFlagChangeset("./.danger/__fixtures__/changeset/popular-cheetahs-punch.md")).toEqual(true);
expect(shouldFlagChangeset("./.danger/__fixtures__/changeset/pretty-cameras-burn.md")).toEqual(true);
});
});

describe('getChangesetsNotTaggingCore', () => {
it('should return an array of changesets that do not tag core', () => {
describe("getChangesetsNotTaggingCore", () => {
it("should return an array of changesets that do not tag core", () => {
expect(
getChangesetsNotTaggingCore([
'./.danger/__fixtures__/changeset/heavy-peaches-repeat.md',
'./.danger/__fixtures__/changeset/pink-masks-walk.md',
'./.danger/__fixtures__/changeset/popular-cheetahs-punch.md',
'./.danger/__fixtures__/changeset/pretty-cameras-burn.md',
])
"./.danger/__fixtures__/changeset/heavy-peaches-repeat.md",
"./.danger/__fixtures__/changeset/pink-masks-walk.md",
"./.danger/__fixtures__/changeset/popular-cheetahs-punch.md",
"./.danger/__fixtures__/changeset/pretty-cameras-burn.md",
]),
).toEqual([
'./.danger/__fixtures__/changeset/popular-cheetahs-punch.md',
'./.danger/__fixtures__/changeset/pretty-cameras-burn.md',
"./.danger/__fixtures__/changeset/popular-cheetahs-punch.md",
"./.danger/__fixtures__/changeset/pretty-cameras-burn.md",
]);
});
});

describe('changesetsThatNeedCoreCheck()', () => {
describe("changesetsThatNeedCoreCheck()", () => {
beforeEach(() => {
global.warn = jest.fn();
global.message = jest.fn();
Expand All @@ -52,14 +52,14 @@ describe('changesetsThatNeedCoreCheck()', () => {
global.danger = undefined;
});

it('should fail for each modified changeset that does not tag core', () => {
it("should fail for each modified changeset that does not tag core", () => {
global.danger = {
git: {
modified_files: [
'./.danger/__fixtures__/changeset/heavy-peaches-repeat.md',
'./.danger/__fixtures__/changeset/pink-masks-walk.md',
'./.danger/__fixtures__/changeset/popular-cheetahs-punch.md',
'./.danger/__fixtures__/changeset/pretty-cameras-burn.md',
"./.danger/__fixtures__/changeset/heavy-peaches-repeat.md",
"./.danger/__fixtures__/changeset/pink-masks-walk.md",
"./.danger/__fixtures__/changeset/popular-cheetahs-punch.md",
"./.danger/__fixtures__/changeset/pretty-cameras-burn.md",
],
created_files: [],
},
Expand All @@ -68,48 +68,48 @@ describe('changesetsThatNeedCoreCheck()', () => {
expect(global.fail).toHaveBeenCalledTimes(2);
});

it('should fail for each created changeset that does not tag core', () => {
it("should fail for each created changeset that does not tag core", () => {
global.danger = {
git: {
modified_files: [],
created_files: [
'./.danger/__fixtures__/changeset/pink-masks-walk.md',
'./.danger/__fixtures__/changeset/pretty-cameras-burn.md',
"./.danger/__fixtures__/changeset/pink-masks-walk.md",
"./.danger/__fixtures__/changeset/pretty-cameras-burn.md",
],
},
};
changesetsThatNeedCoreCheck();
expect(global.fail).toHaveBeenCalledTimes(1);
});

it('should fail for each modified and created changeset that does not tag core', () => {
it("should fail for each modified and created changeset that does not tag core", () => {
global.danger = {
git: {
modified_files: [
'./.danger/__fixtures__/changeset/heavy-peaches-repeat.md',
'./.danger/__fixtures__/changeset/pink-masks-walk.md',
'./.danger/__fixtures__/changeset/pretty-cameras-burn.md',
"./.danger/__fixtures__/changeset/heavy-peaches-repeat.md",
"./.danger/__fixtures__/changeset/pink-masks-walk.md",
"./.danger/__fixtures__/changeset/pretty-cameras-burn.md",
],
created_files: ['./.danger/__fixtures__/changeset/popular-cheetahs-punch.md'],
created_files: ["./.danger/__fixtures__/changeset/popular-cheetahs-punch.md"],
},
};
changesetsThatNeedCoreCheck();
expect(global.fail).toHaveBeenCalledTimes(2);
});

it('should name the failing changeset that does not tag core', () => {
it("should name the failing changeset that does not tag core", () => {
global.danger = {
git: {
modified_files: [
'./.danger/__fixtures__/changeset/heavy-peaches-repeat.md',
'./.danger/__fixtures__/changeset/pink-masks-walk.md',
"./.danger/__fixtures__/changeset/heavy-peaches-repeat.md",
"./.danger/__fixtures__/changeset/pink-masks-walk.md",
],
created_files: ['./.danger/__fixtures__/changeset/popular-cheetahs-punch.md'],
created_files: ["./.danger/__fixtures__/changeset/popular-cheetahs-punch.md"],
},
};
changesetsThatNeedCoreCheck();
expect(global.fail).toHaveBeenCalledWith(
'Changeset ./.danger/__fixtures__/changeset/popular-cheetahs-punch.md does not mention a change to Paste Core. Please include core with this changeset.'
"Changeset ./.danger/__fixtures__/changeset/popular-cheetahs-punch.md does not mention a change to Paste Core. Please include core with this changeset.",
);
});
});
146 changes: 73 additions & 73 deletions .danger/__tests__/missing-changesets-check.spec.ts
Original file line number Diff line number Diff line change
@@ -1,85 +1,85 @@
import missingChangesetCheck, {getMissingPackagesFromChangesets} from '../missing-changesets-check';
import missingChangesetCheck, { getMissingPackagesFromChangesets } from "../missing-changesets-check";

declare const global: any;

const mockPackList = [
{
name: '@twilio-paste/avatar',
version: '0.0.0',
name: "@twilio-paste/avatar",
version: "0.0.0",
private: false,
location: '/Users/simon/dev/twilio/design-systems/paste/packages/paste-core/components/avatar',
location: "/Users/simon/dev/twilio/design-systems/paste/packages/paste-core/components/avatar",
},

{
name: '@twilio-paste/icons',
version: '0.0.0',
name: "@twilio-paste/icons",
version: "0.0.0",
private: false,
location: '/Users/simon/dev/twilio/design-systems/paste/packages/paste-icons',
location: "/Users/simon/dev/twilio/design-systems/paste/packages/paste-icons",
},

{
name: '@twilio-paste/core',
version: '0.0.0',
name: "@twilio-paste/core",
version: "0.0.0",
private: false,
location: '/Users/simon/dev/twilio/design-systems/paste/packages/paste-core/core-bundle',
location: "/Users/simon/dev/twilio/design-systems/paste/packages/paste-core/core-bundle",
},
{
name: '@twilio-paste/box',
version: '0.0.0',
name: "@twilio-paste/box",
version: "0.0.0",
private: true,
location: '/Users/simon/dev/twilio/design-systems/paste/packages/paste-core/primitives/box',
location: "/Users/simon/dev/twilio/design-systems/paste/packages/paste-core/primitives/box",
},
{
name: '@twilio-paste/design-tokens',
version: '0.0.0',
name: "@twilio-paste/design-tokens",
version: "0.0.0",
private: false,
location: '/Users/simon/dev/twilio/design-systems/paste/packages/paste-design-tokens',
location: "/Users/simon/dev/twilio/design-systems/paste/packages/paste-design-tokens",
},
];

describe('getMissingPackagesFromChangesets()', () => {
it('should not return the names of packages if none are missing from changesets', () => {
describe("getMissingPackagesFromChangesets()", () => {
it("should not return the names of packages if none are missing from changesets", () => {
expect(
getMissingPackagesFromChangesets(
[
'./.danger/__fixtures__/changeset/heavy-peaches-repeat.md',
'./.danger/__fixtures__/changeset/pink-masks-walk.md',
'./.danger/__fixtures__/changeset/popular-cheetahs-punch.md',
'./.danger/__fixtures__/changeset/pretty-cameras-burn.md',
"./.danger/__fixtures__/changeset/heavy-peaches-repeat.md",
"./.danger/__fixtures__/changeset/pink-masks-walk.md",
"./.danger/__fixtures__/changeset/popular-cheetahs-punch.md",
"./.danger/__fixtures__/changeset/pretty-cameras-burn.md",
],
['@twilio-paste/avatar', '@twilio-paste/box', '@twilio-paste/icons', '@twilio-paste/core']
)
["@twilio-paste/avatar", "@twilio-paste/box", "@twilio-paste/icons", "@twilio-paste/core"],
),
).toEqual([]);
});

it('should return the names of packages that are missing from changesets', () => {
it("should return the names of packages that are missing from changesets", () => {
expect(
getMissingPackagesFromChangesets(
[
'./.danger/__fixtures__/changeset/heavy-peaches-repeat.md',
'./.danger/__fixtures__/changeset/popular-cheetahs-punch.md',
'./.danger/__fixtures__/changeset/pretty-cameras-burn.md',
"./.danger/__fixtures__/changeset/heavy-peaches-repeat.md",
"./.danger/__fixtures__/changeset/popular-cheetahs-punch.md",
"./.danger/__fixtures__/changeset/pretty-cameras-burn.md",
],
[
'@twilio-paste/avatar',
'@twilio-paste/box',
'@twilio-paste/icons',
'@twilio-paste/core',
'@twilio-paste/design-tokens',
]
)
).toEqual(['@twilio-paste/core', '@twilio-paste/design-tokens']);
"@twilio-paste/avatar",
"@twilio-paste/box",
"@twilio-paste/icons",
"@twilio-paste/core",
"@twilio-paste/design-tokens",
],
),
).toEqual(["@twilio-paste/core", "@twilio-paste/design-tokens"]);

expect(
getMissingPackagesFromChangesets(
['./.danger/__fixtures__/changeset/pretty-cameras-burn.md'],
['@twilio-paste/avatar', '@twilio-paste/box', '@twilio-paste/icons', '@twilio-paste/core']
)
).toEqual(['@twilio-paste/box', '@twilio-paste/icons', '@twilio-paste/core']);
["./.danger/__fixtures__/changeset/pretty-cameras-burn.md"],
["@twilio-paste/avatar", "@twilio-paste/box", "@twilio-paste/icons", "@twilio-paste/core"],
),
).toEqual(["@twilio-paste/box", "@twilio-paste/icons", "@twilio-paste/core"]);
});
});

describe('missingChangesetCheck()', () => {
describe("missingChangesetCheck()", () => {
beforeEach(() => {
global.warn = jest.fn();
global.message = jest.fn();
Expand All @@ -95,18 +95,18 @@ describe('missingChangesetCheck()', () => {
global.danger = undefined;
});

it('should fail once for a single package that is not in a changeset', () => {
it("should fail once for a single package that is not in a changeset", () => {
global.danger = {
git: {
modified_files: [
'package.json',
'packages/paste-codemods/package.json',
'packages/paste-icons/src/index.tsx',
'packages/paste-core/components/avatar/src/index.tsx',
'packages/paste-core/primitives/box/src/index.tsx',
'packages/paste-design-tokens/tokens/themes/evergreen/global/background-color.yml',
'yarn.lock',
'./.danger/__fixtures__/changeset/pretty-cameras-burn.md',
"package.json",
"packages/paste-codemods/package.json",
"packages/paste-icons/src/index.tsx",
"packages/paste-core/components/avatar/src/index.tsx",
"packages/paste-core/primitives/box/src/index.tsx",
"packages/paste-design-tokens/tokens/themes/evergreen/global/background-color.yml",
"yarn.lock",
"./.danger/__fixtures__/changeset/pretty-cameras-burn.md",
],
created_files: [],
},
Expand All @@ -115,16 +115,16 @@ describe('missingChangesetCheck()', () => {
expect(global.fail).toHaveBeenCalledTimes(2);
});

it('should fail twice for two packages that are not in a changeset', () => {
it("should fail twice for two packages that are not in a changeset", () => {
global.danger = {
git: {
modified_files: [
'package.json',
'packages/paste-codemods/package.json',
'packages/paste-icons/src/index.tsx',
'packages/paste-core/components/avatar/src/index.tsx',
'packages/paste-core/primitives/box/src/index.tsx',
'yarn.lock',
"package.json",
"packages/paste-codemods/package.json",
"packages/paste-icons/src/index.tsx",
"packages/paste-core/components/avatar/src/index.tsx",
"packages/paste-core/primitives/box/src/index.tsx",
"yarn.lock",
],
created_files: [],
},
Expand All @@ -133,20 +133,20 @@ describe('missingChangesetCheck()', () => {
expect(global.fail).toHaveBeenCalledTimes(2);
});

it('should not fail if all packages are covered', () => {
it("should not fail if all packages are covered", () => {
global.danger = {
git: {
modified_files: [
'package.json',
'packages/paste-codemods/package.json',
'packages/paste-icons/src/index.tsx',
'packages/paste-core/components/avatar/src/index.tsx',
'packages/paste-core/primitives/box/src/index.tsx',
'yarn.lock',
'./.danger/__fixtures__/changeset/heavy-peaches-repeat.md',
'./.danger/__fixtures__/changeset/pink-masks-walk.md',
'./.danger/__fixtures__/changeset/popular-cheetahs-punch.md',
'./.danger/__fixtures__/changeset/pretty-cameras-burn.md',
"package.json",
"packages/paste-codemods/package.json",
"packages/paste-icons/src/index.tsx",
"packages/paste-core/components/avatar/src/index.tsx",
"packages/paste-core/primitives/box/src/index.tsx",
"yarn.lock",
"./.danger/__fixtures__/changeset/heavy-peaches-repeat.md",
"./.danger/__fixtures__/changeset/pink-masks-walk.md",
"./.danger/__fixtures__/changeset/popular-cheetahs-punch.md",
"./.danger/__fixtures__/changeset/pretty-cameras-burn.md",
],
created_files: [],
},
Expand All @@ -155,20 +155,20 @@ describe('missingChangesetCheck()', () => {
expect(global.fail).toHaveBeenCalledTimes(0);
});

it('should be called with an fail message that lists the missing package that is not in a changeset', () => {
it("should be called with an fail message that lists the missing package that is not in a changeset", () => {
global.danger = {
git: {
modified_files: [
'packages/paste-icons/src/index.tsx',
'packages/paste-core/components/avatar/src/index.tsx',
'./.danger/__fixtures__/changeset/pretty-cameras-burn.md',
"packages/paste-icons/src/index.tsx",
"packages/paste-core/components/avatar/src/index.tsx",
"./.danger/__fixtures__/changeset/pretty-cameras-burn.md",
],
created_files: [],
},
};
missingChangesetCheck(mockPackList);
expect(global.fail).toHaveBeenCalledWith(
'Looks like @twilio-paste/icons was not included in a changeset - *edit an existing changeset or run `yarn changeset` to create one*'
"Looks like @twilio-paste/icons was not included in a changeset - *edit an existing changeset or run `yarn changeset` to create one*",
);
});
});
Loading

0 comments on commit 266222e

Please sign in to comment.