Skip to content

Commit e892d85

Browse files
erunionkanadgupta
andauthored
feat(biome): new package for a shared config (#1004)
* feat(biome): new package for a shared Biome config * Update packages/biome-config/README.md Co-authored-by: Kanad Gupta <git@kanad.dev> * Update packages/biome-config/biome.jsonc Co-authored-by: Kanad Gupta <git@kanad.dev> * fix: renaming this new package to `standards` * fix: making the standards package ESM * fix: biome config not working * fix: dropping CJS syntax * Update package.json Co-authored-by: Kanad Gupta <git@kanad.dev> * Update README.md Co-authored-by: Kanad Gupta <git@kanad.dev> * Update README.md Co-authored-by: Kanad Gupta <git@kanad.dev> * Update README.md Co-authored-by: Kanad Gupta <git@kanad.dev> --------- Co-authored-by: Kanad Gupta <git@kanad.dev>
1 parent bc29338 commit e892d85

File tree

6 files changed

+360
-0
lines changed

6 files changed

+360
-0
lines changed

package-lock.json

Lines changed: 183 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/standards/LICENSE

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Copyright 2025 ReadMe
2+
3+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
4+
5+
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

packages/standards/README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# @readme/standards
2+
3+
Core coding standards for ReadMe projects.
4+
5+
[![](https://raw.githubusercontent.com/readmeio/.github/main/oss-header.png)](https://readme.io)
6+
7+
[![npm](https://img.shields.io/npm/v/@readme/standards)](https://npm.im/@readme/standards) [![Build](https://github.com/readmeio/standards/workflows/CI/badge.svg)](https://github.com/readmeio/standards)
8+
9+
## Configs
10+
11+
<!-- prettier-ignore -->
12+
| Config | Description |
13+
| :-- | :--- |
14+
| `@readme/standards/biome` | For projects that use [Biome](https://biomejs.dev/). |
15+
| `@readme/standards/prettier` | For projects that use [Prettier](https://prettier.io/). |
16+
17+
### Biome
18+
19+
### Installation
20+
21+
```sh
22+
npm install --save-dev @biomejs/biome @readme/standards
23+
```
24+
25+
### Usage
26+
27+
Create a `biome.jsonc` file with the following contents:
28+
29+
```json
30+
{
31+
"extends": ["@readme/standards/biome"]
32+
}
33+
```
34+
35+
By default this config does **not** enable auto-formatting. If you need that enabled you will have to turn it on with:
36+
37+
```json
38+
{
39+
"formatter": {
40+
"enabled": true
41+
}
42+
}
43+
```
44+
45+
> [!NOTE]
46+
> If you do use auto-formatting with Biome we recommend **not** also using `@readme/standards/prettier` as they two may collide.
47+
48+
### Prettier
49+
50+
### Installation
51+
52+
```sh
53+
npm install --save-dev prettier @readme/standards
54+
```
55+
56+
### Usage
57+
58+
Add the following into your `package.json`:
59+
60+
```json
61+
"prettier": "@readme/standards/prettier"
62+
```
63+
64+
> [!NOTE]
65+
> If you use Biome and Prettier we recommend disabling Biome's auto-formatting by setting `formatter.enabled` to `false` as the two may collide.

packages/standards/biome.jsonc

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3+
"formatter": {
4+
"enabled": false,
5+
"indentStyle": "space",
6+
"lineWidth": 120,
7+
},
8+
"linter": {
9+
"enabled": true,
10+
"domains": {
11+
"project": "all",
12+
"test": "all",
13+
},
14+
"rules": {
15+
"recommended": true,
16+
"correctness": {
17+
"noUnusedFunctionParameters": "off",
18+
"noUnusedVariables": {
19+
// Disabling this for now because we have a lot of unused variables in `catch` statements
20+
// and Biome doesn't yet have an option for ignoring these.
21+
"level": "off",
22+
"options": {
23+
"ignoreRestSiblings": true,
24+
},
25+
},
26+
},
27+
"nursery": {
28+
// Biome's docs say that this is enabled in the `project` domain but that doesn't seem to
29+
// be the case. https://biomejs.dev/linter/domains/#project-rules
30+
"noFloatingPromises": "error",
31+
},
32+
"style": {
33+
"noParameterAssign": "error",
34+
},
35+
},
36+
},
37+
"javascript": {
38+
"formatter": {
39+
"arrowParentheses": "asNeeded",
40+
"quoteStyle": "single",
41+
},
42+
},
43+
"assist": {
44+
"enabled": true,
45+
"actions": {
46+
"source": {
47+
"organizeImports": {
48+
"level": "on",
49+
"options": {
50+
// Import order: `type` -> Node builtins -> URL -> Package -> Local paths
51+
"groups": [
52+
{ "type": true, "source": null },
53+
":BLANK_LINE:", // We add blank lines between the groups to improve readability.
54+
{ "type": null, "source": [":BUN:", ":NODE:"] },
55+
":BLANK_LINE:",
56+
{
57+
"type": null,
58+
"source": [":URL", ":PACKAGE:", ":PACKAGE_WITH_PROTOCOL:"],
59+
},
60+
":BLANK_LINE:",
61+
":PATH:",
62+
],
63+
},
64+
},
65+
},
66+
},
67+
},
68+
}

packages/standards/package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "@readme/standards",
3+
"version": "1.0.0",
4+
"description": "ReadMe coding standards",
5+
"author": "Jon Ursenbach <jon@ursenba.ch>",
6+
"type": "module",
7+
"exports": {
8+
"./biome": "./biome.jsonc",
9+
"./prettier": "./prettier.js"
10+
},
11+
"license": "ISC",
12+
"repository": {
13+
"type": "git",
14+
"url": "git@github.com:readmeio/standards.git"
15+
},
16+
"bugs": {
17+
"url": "https://github.com/readmeio/standards/issues"
18+
},
19+
"homepage": "https://github.com/readmeio/standards#readme",
20+
"scripts": {
21+
"lint": "biome check",
22+
"lint:fix": "biome check --write ."
23+
},
24+
"optionalDependencies": {
25+
"@biomejs/biome": "^2.1.1",
26+
"prettier": "^3.6.2"
27+
},
28+
"devDependencies": {
29+
"@biomejs/biome": "^2.1.1"
30+
}
31+
}

packages/standards/prettier.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/** @type {import("prettier").Config} */
2+
const config = {
3+
arrowParens: 'avoid',
4+
printWidth: 120,
5+
singleQuote: true,
6+
};
7+
8+
export default config;

0 commit comments

Comments
 (0)