Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

biome #27

Merged
merged 22 commits into from Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -10,3 +10,6 @@ yarn-error.log
!.yarn/releases
!.yarn/plugins
.pnp.*

# biome
biome-logs/
3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

19 changes: 0 additions & 19 deletions .prettierrc.json

This file was deleted.

8 changes: 8 additions & 0 deletions .vim/coc-settings.json
@@ -0,0 +1,8 @@
{
"[markdown][javascript][typescript][typescriptreact]": {
"coc.preferences.formatOnSave": true
},
"prettier.enable": false,
"eslint.enable": false,
"biome.enable": true
}
7 changes: 1 addition & 6 deletions .vscode/extensions.json
@@ -1,9 +1,4 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": ["runem.lit-plugin"],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"recommendations": ["runem.lit-plugin", "biomejs.biome"],
"unwantedRecommendations": []
}
11 changes: 10 additions & 1 deletion CHANGES.md
Expand Up @@ -13,7 +13,8 @@ Here you can find project-wide changes. For more detailed changes:

- Move to `vite` (#8)
- Minimum Node.js version to v18+ (#12)
- Move from `eslint` to `oxc` (#26)
- Move from `prettier` to `biome` (#27)
- Move from `eslint` to ~`oxc` (#26)~ `biome` (#27)

With eslint:

Expand All @@ -31,6 +32,14 @@ Here you can find project-wide changes. For more detailed changes:
Range (min … max): 5.155 s … 5.476 s 10 runs
```

With biome:

```
Benchmark 1: yarn lint
Time (mean ± σ): 436.9 ms ± 7.7 ms [User: 390.9 ms, System: 137.9 ms]
Range (min … max): 429.6 ms … 455.4 ms 10 runs
```

- Run prettier across full codebase (#9)

- Add docs/ to formatting
Expand Down
28 changes: 28 additions & 0 deletions biome.json
@@ -0,0 +1,28 @@
{
"$schema": "https://biomejs.dev/schemas/1.4.1/schema.json",
"files": {
"ignore": [
".yarn",
"node_modules",
"dist",
"packages/site/static",
"packages/site/.docusaurus",
"yarn-error.log",
"docs"
],
"ignoreUnknown": true
},
"organizeImports": {
"enabled": true
},
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
12 changes: 4 additions & 8 deletions package.json
Expand Up @@ -5,14 +5,13 @@
"build": "yarn workspace @social-embed/lib build && yarn workspace @social-embed/wc build",
"clean": "yarn workspaces run clean",
"distclean": "yarn workspaces run distclean",
"format": "yarn workspaces run format",
"lint": "yarn workspaces run lint",
"format": "biome format .",
"lint": "biome lint .",
"build:watch": "yarn workspaces run build:watch",
"test": "yarn workspaces run test",
"test:watch": "yarn workspaces run test:watch",
"ncu": "yarn run ncu-local -u; yarn workspaces run ncu",
"ncu-local": "ncu",
"prettier": "yarn workspaces run prettier",
"update": "yarn workspaces run update",
"docs": "yarn workspaces run docs",
"docs:gen:watch": "yarn workspaces run docs:gen:watch",
Expand All @@ -36,11 +35,8 @@
"typescript": "^5.3.3"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.1.1",
"cross-env": "^7.0.3",
"oxlint": "^0.0.21",
"prettier": "^3.1.1",
"prettier-plugin-css-order": "^2.0.1"
"@biomejs/biome": "1.4.1",
"cross-env": "^7.0.3"
},
"engines": {
"node": ">=18"
Expand Down
4 changes: 0 additions & 4 deletions packages/lib/.prettierignore

This file was deleted.

3 changes: 2 additions & 1 deletion packages/lib/CHANGES.md
Expand Up @@ -15,7 +15,8 @@ description: Latest updates for the @social-embed URL parsing library.

### Development

- Move from `eslint` to `oxc` (#26)
- Move from `prettier` to `biome` (#27)
- Move from `eslint` to ~`oxc` (#26)~ `biome` (#27)

Faster linting, as it is rust-based.

Expand Down
10 changes: 5 additions & 5 deletions packages/lib/package.json
Expand Up @@ -44,14 +44,14 @@
"prepare": "yarn build",
"bootstrap": "echo 'NOOP'",
"test": "vitest",
"lint": "oxlint",
"lint": "biome lint",
"ncu": "ncu",
"update": "ncu",
"prettier": "prettier",
"format": "yarn run prettier . --write"
"biome": "biome",
"format": "yarn run biome format . --write"
},
"devDependencies": {
"oxlint": "^0.0.21",
"@biomejs/biome": "1.4.1",
"typescript": "^5.3.3",
"vite": "^5.0.10",
"vite-plugin-dts": "^3.6.4",
Expand All @@ -60,4 +60,4 @@
"engines": {
"node": ">=18"
}
}
}
3 changes: 1 addition & 2 deletions packages/lib/src/utils.ts
Expand Up @@ -49,8 +49,7 @@ export const ProviderIdFunctionMap: {
};

type ProviderIdFn = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[P in ValueOfProvider]: (id: string, ...args: any[]) => string;
[P in ValueOfProvider]: (id: string, ...args: unknown[]) => string;
};

export const ProviderIdUrlFunctionMap: ProviderIdFn = {
Expand Down
4 changes: 2 additions & 2 deletions packages/lib/test/index.test.ts
Expand Up @@ -150,7 +150,7 @@ describe("convertUrlToEmbedUrl", () => {
});

it("edpuzzle", () => {
const edPuzzleId = `606b413369971e424ec6021e`;
const edPuzzleId = "606b413369971e424ec6021e";
const expectedEmbeddableUrl = `https://edpuzzle.com/embed/media/${edPuzzleId}`;

expect(
Expand Down Expand Up @@ -179,7 +179,7 @@ describe("convertUrlToEmbedUrl", () => {
});

it("wistia", () => {
const wistiaId = `26sk4lmiix`;
const wistiaId = "26sk4lmiix";
const expectedEmbeddableUrl = `https://fast.wistia.net/embed/iframe/${wistiaId}`;

expect(
Expand Down
10 changes: 5 additions & 5 deletions packages/site/package.json
Expand Up @@ -19,9 +19,9 @@
"prebuild": "yarn docs:oembed",
"prestart": "yarn docs:oembed",
"docs:oembed": "yarn workspace @social-embed/wc build && mkdir -p static/js && cp ../wc/dist/OEmbedElement.umd.cjs static/js/o-embed.bundled.js",
"lint": "echo 'NOOP'",
"prettier": "prettier",
"format": "yarn run prettier . --write",
"lint": "biome lint .",
"biome": "biome",
"format": "yarn run biome format . --write",
"test": "echo 'NOOP'"
},
"dependencies": {
Expand All @@ -35,10 +35,10 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@biomejs/biome": "1.4.1",
"@docusaurus/module-type-aliases": "3.0.1",
"@docusaurus/tsconfig": "^3.0.1",
"@docusaurus/types": "3.0.1",
"oxlint": "^0.0.21",
"typescript": "^5.3.3"
},
"browserslist": {
Expand All @@ -56,4 +56,4 @@
"engines": {
"node": ">=18"
}
}
}
22 changes: 10 additions & 12 deletions packages/site/plugins/more-mdx-paths/index.js
@@ -1,15 +1,13 @@
// credit: @slorber
// https://github.com/facebook/docusaurus/issues/3272#issuecomment-688409489
// This lets us resolve symlinks from outside (root-level repo, packages/*/CHANGES.md)
module.exports = function (context, options) {
return {
name: "more-mdx-paths",
configureWebpack(config, isServer, utils) {
return {
resolve: {
symlinks: false,
},
};
},
};
};
module.exports = (context, options) => ({
name: "more-mdx-paths",
configureWebpack(config, isServer, utils) {
return {
resolve: {
symlinks: false,
},
};
},
});
2 changes: 1 addition & 1 deletion packages/site/src/pages/index.tsx
Expand Up @@ -132,7 +132,7 @@ export default function Home() {
<div className="container">
<div className="row">
{features.map((props, idx) => (
<Feature key={idx} {...props} />
<Feature key={`feature-${idx}`} {...props} />
))}
</div>
</div>
Expand Down
3 changes: 0 additions & 3 deletions packages/wc/.prettierignore

This file was deleted.

3 changes: 2 additions & 1 deletion packages/wc/CHANGES.md
Expand Up @@ -37,7 +37,8 @@ description: Latest updates for the @social-embed web component.
- https://github.com/vitejs/vite/blob/v5.0.0/packages/vite/CHANGELOG.md
- https://github.com/vitejs/vite/blob/531d3cb/packages/vite/CHANGELOG.md

- Move from `eslint` to `oxc` (#26)
- Move from `prettier` to `biome` (#27)
- Move from `eslint` to ~`oxlint` (#26)~ `biome` (#27)

Faster linting, as it is rust-based.

Expand Down
12 changes: 6 additions & 6 deletions packages/wc/package.json
Expand Up @@ -21,11 +21,11 @@
"clean": "rimraf dist/",
"ncu": "ncu",
"update": "ncu",
"lint": "npm run lint:lit-analyzer && npm run lint:oxlint",
"lint:oxlint": "oxlint",
"lint": "npm run lint:lit-analyzer && npm run lint:biome",
"lint:biome": "biome lint .",
"lint:lit-analyzer": "lit-analyzer -- --rules.no-boolean-in-attribute-binding off --rules.no-incompatible-type-binding off --rules.no-unknown-attribute off",
"prettier": "prettier",
"format": "yarn run prettier . --write",
"biome": "biome",
"format": "yarn run biome format . --write",
"analyze": "wca analyze \"src/**/*.ts\" --outFile ../site/custom-elements.json",
"serve": "vite preview",
"pretest": "yarn workspace @social-embed/lib build",
Expand Down Expand Up @@ -57,6 +57,7 @@
"lit": "^3.1.0"
},
"devDependencies": {
"@biomejs/biome": "1.4.1",
"@open-wc/testing": "^4.0.0",
"@web/dev-server-esbuild": "^1.0.1",
"@web/dev-server-import-maps": "^0.2.0",
Expand All @@ -65,7 +66,6 @@
"chai": "^4.3.10",
"deepmerge": "^4.3.1",
"lit-analyzer": "^2.0.2",
"oxlint": "^0.0.21",
"rimraf": "^5.0.5",
"typescript": "^5.3.3",
"vite": "^5.0.10",
Expand All @@ -75,4 +75,4 @@
"engines": {
"node": ">=18"
}
}
}