@yoshinani/style-guide 0.10.3 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -4
- package/biome/base.jsonc +45 -0
- package/cspell/words.txt +1 -0
- package/eslint/base.mjs +3 -3
- package/eslint/library.mjs +2 -1
- package/eslint/next.mjs +2 -1
- package/eslint/react-internal.mjs +2 -1
- package/package.json +6 -4
- package/biome.jsonc +0 -21
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
以下の設定が利用可能で、組み合わせて使うことを想定しています。
|
|
10
10
|
|
|
11
|
-
- [Prettier](#prettier)
|
|
11
|
+
- [Prettier](#prettier) または [Biome](#biome)
|
|
12
12
|
- [ESLint](#eslint)
|
|
13
13
|
- [TypeScript](#typescript)
|
|
14
14
|
- [commitlint](#commitlint)
|
|
@@ -45,15 +45,29 @@ yarn add --dev @yoshinani/style-guide
|
|
|
45
45
|
|
|
46
46
|
## Biome
|
|
47
47
|
|
|
48
|
+
現在、この設定ではBiomeのフォーマッター機能のみを有効にしています。リンターとしては、別途 [ESLint](#eslint) を設定してください。
|
|
49
|
+
|
|
50
|
+
まず、プロジェクトルートにBiomeをインストールします。
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
pnpm add -w -D @biomejs/biome
|
|
54
|
+
```
|
|
55
|
+
|
|
48
56
|
共有のBiome設定を利用するには、`biome.jsonc` を作成して、以下のように `extends` を設定します。
|
|
49
57
|
|
|
50
58
|
```jsonc
|
|
51
59
|
{
|
|
52
|
-
"
|
|
60
|
+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
|
61
|
+
"extends": ["@yoshinani/style-guide/biome"],
|
|
62
|
+
"files": {
|
|
63
|
+
"includes": ["**", "!**/.next", "!**/.turbo"]
|
|
64
|
+
}
|
|
53
65
|
}
|
|
54
66
|
```
|
|
55
67
|
|
|
56
|
-
VSCodeでフォーマッターとしてBiome
|
|
68
|
+
VSCodeでフォーマッターとしてBiomeを利用する場合は、まず[Biomeの拡張機能](https://marketplace.visualstudio.com/items?itemName=biomejs.biome)をインストールしてください。
|
|
69
|
+
|
|
70
|
+
次に、`.vscode/settings.json` に以下の設定を追加します。
|
|
57
71
|
|
|
58
72
|
```json
|
|
59
73
|
{
|
|
@@ -63,6 +77,16 @@ VSCodeでフォーマッターとしてBiomeを利用する場合は、 `.vscode
|
|
|
63
77
|
}
|
|
64
78
|
```
|
|
65
79
|
|
|
80
|
+
プロジェクトの推奨拡張機能として設定するために、`.vscode/extensions.json`を作成し、以下の内容を追加することをお勧めします。
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"recommendations": [
|
|
85
|
+
"biomejs.biome"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
66
90
|
## ESLint
|
|
67
91
|
|
|
68
92
|
利用できる設定は以下の通りです。
|
|
@@ -157,7 +181,7 @@ export default {
|
|
|
157
181
|
}
|
|
158
182
|
```
|
|
159
183
|
|
|
160
|
-
|
|
184
|
+
2. vscode拡張での設定
|
|
161
185
|
|
|
162
186
|
```json
|
|
163
187
|
{
|
package/biome/base.jsonc
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../node_modules/@biomejs/biome/configuration_schema.json",
|
|
3
|
+
"formatter": {
|
|
4
|
+
"enabled": true,
|
|
5
|
+
"indentStyle": "space"
|
|
6
|
+
},
|
|
7
|
+
"javascript": {
|
|
8
|
+
"formatter": {
|
|
9
|
+
"semicolons": "asNeeded",
|
|
10
|
+
"quoteStyle": "double"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"linter": {
|
|
14
|
+
"enabled": false
|
|
15
|
+
},
|
|
16
|
+
"html": { "formatter": { "selfCloseVoidElements": "always" } },
|
|
17
|
+
"assist": {
|
|
18
|
+
"enabled": false,
|
|
19
|
+
"actions": {
|
|
20
|
+
"source": {
|
|
21
|
+
"organizeImports": {
|
|
22
|
+
"level": "on",
|
|
23
|
+
"options": {
|
|
24
|
+
"groups": [
|
|
25
|
+
// 標準ライブラリ・DenoのURLインポート('node:path' など)
|
|
26
|
+
[":NODE:", ":BUN:", ":URL:"],
|
|
27
|
+
":BLANK_LINE:",
|
|
28
|
+
// 外部のパッケージ('react' など)
|
|
29
|
+
[":PACKAGE:", ":PACKAGE_WITH_PROTOCOL:", "!@repo/**"],
|
|
30
|
+
":BLANK_LINE:",
|
|
31
|
+
// モノレポのパッケージ('@repo/ui' など)
|
|
32
|
+
"@repo/**",
|
|
33
|
+
":BLANK_LINE:",
|
|
34
|
+
// エイリアス('~/lib/firebase' など)
|
|
35
|
+
":ALIAS:",
|
|
36
|
+
":BLANK_LINE:",
|
|
37
|
+
// パス('./components/nav-bar' など)
|
|
38
|
+
":PATH:"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
package/cspell/words.txt
CHANGED
package/eslint/base.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
3
|
import eslint from "@eslint/js"
|
|
4
|
-
import tseslint from "typescript-eslint"
|
|
5
|
-
import * as importPlugin from "eslint-plugin-import"
|
|
6
4
|
import comments from "@eslint-community/eslint-plugin-eslint-comments"
|
|
7
|
-
import functional from "eslint-plugin-functional"
|
|
8
5
|
import eslintConfigPrettier from "eslint-config-prettier/flat"
|
|
6
|
+
import functional from "eslint-plugin-functional"
|
|
7
|
+
import * as importPlugin from "eslint-plugin-import"
|
|
8
|
+
import tseslint from "typescript-eslint"
|
|
9
9
|
|
|
10
10
|
export default tseslint.config(
|
|
11
11
|
eslint.configs.recommended,
|
package/eslint/library.mjs
CHANGED
package/eslint/next.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoshinani/style-guide",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Yoshinani's Style Guide",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"publishConfig": {
|
|
7
8
|
"access": "public",
|
|
8
9
|
"provenance": true
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
"url": "https://github.com/yoshinani-dev/style-guide.git"
|
|
17
18
|
},
|
|
18
19
|
"exports": {
|
|
19
|
-
"./biome": "./biome.jsonc",
|
|
20
|
+
"./biome": "./biome/base.jsonc",
|
|
20
21
|
"./commitlint": "./commitlint/commitlint.config.mjs",
|
|
21
22
|
"./eslint/*": "./eslint/*.mjs",
|
|
22
23
|
"./prettier": "./prettier/prettier.config.cjs",
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
"./typescript/react-library": "./typescript/react-library.json"
|
|
26
27
|
},
|
|
27
28
|
"files": [
|
|
28
|
-
"biome
|
|
29
|
+
"biome",
|
|
29
30
|
"commitlint",
|
|
30
31
|
"cspell",
|
|
31
32
|
"eslint",
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
},
|
|
60
61
|
"scripts": {
|
|
61
62
|
"release": "changeset publish",
|
|
62
|
-
"
|
|
63
|
+
"check": "biome check .",
|
|
64
|
+
"check:fix": "biome check --write ."
|
|
63
65
|
}
|
|
64
66
|
}
|
package/biome.jsonc
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
|
3
|
-
"formatter": {
|
|
4
|
-
"enabled": true,
|
|
5
|
-
"indentStyle": "space"
|
|
6
|
-
},
|
|
7
|
-
"javascript": {
|
|
8
|
-
"formatter": {
|
|
9
|
-
"semicolons": "asNeeded",
|
|
10
|
-
"quoteStyle": "double"
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"linter": {
|
|
14
|
-
"enabled": false
|
|
15
|
-
},
|
|
16
|
-
"html": { "formatter": { "selfCloseVoidElements": "always" } },
|
|
17
|
-
"assist": {
|
|
18
|
-
"enabled": true,
|
|
19
|
-
"actions": { "source": { "organizeImports": "off" } }
|
|
20
|
-
}
|
|
21
|
-
}
|