@yoshinani/style-guide 0.2.4 → 0.4.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 +7 -7
- package/commitlint/commitlint.config.mjs +31 -31
- package/cspell/words.txt +4 -2
- package/eslint/base.mjs +90 -10
- package/eslint/library.mjs +4 -4
- package/eslint/next.mjs +6 -6
- package/eslint/react-internal.mjs +6 -6
- package/eslint/rules/react-hooks.mjs +2 -2
- package/eslint/rules/react.mjs +2 -2
- package/package.json +11 -9
- package/prettier/prettier.config.cjs +2 -2
- package/typescript/base.json +20 -21
- package/typescript/nextjs.json +11 -14
- package/typescript/react-library.json +5 -6
package/README.md
CHANGED
|
@@ -66,11 +66,11 @@ export default eslintConfig
|
|
|
66
66
|
|
|
67
67
|
このスタイルガイドは複数の TypeScript 設定を提供しています。利用可能な設定は以下の通りです。
|
|
68
68
|
|
|
69
|
-
| 種類
|
|
70
|
-
|
|
|
71
|
-
| base
|
|
72
|
-
| nextjs
|
|
73
|
-
| react-library
|
|
69
|
+
| 種類 | 設定パッケージ名 |
|
|
70
|
+
| ------------- | ------------------------------------------------- |
|
|
71
|
+
| base | `@yoshinani/style-guide/typescript/base` |
|
|
72
|
+
| nextjs | `@yoshinani/style-guide/typescript/nextjs` |
|
|
73
|
+
| react-library | `@yoshinani/style-guide/typescript/react-library` |
|
|
74
74
|
|
|
75
75
|
共有 TypeScript 設定を使うには、`tsconfig.json` に以下のように記載します。
|
|
76
76
|
|
|
@@ -147,6 +147,6 @@ export default {
|
|
|
147
147
|
"path": "${workspaceFolder}/node_modules/@yoshinani/style-guide/cspell/words.txt",
|
|
148
148
|
"addWords": false
|
|
149
149
|
}
|
|
150
|
-
}
|
|
150
|
+
}
|
|
151
151
|
}
|
|
152
|
-
```
|
|
152
|
+
```
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
],
|
|
2
|
+
extends: ["@commitlint/config-conventional"],
|
|
3
|
+
rules: {
|
|
4
|
+
"type-enum": [
|
|
5
|
+
2,
|
|
6
|
+
"always",
|
|
7
|
+
[
|
|
8
|
+
// ビルドシステムや依存関係のみの変更
|
|
9
|
+
"build",
|
|
10
|
+
// CIワークフローの変更
|
|
11
|
+
"ci",
|
|
12
|
+
// ドキュメントのみの変更
|
|
13
|
+
"docs",
|
|
14
|
+
// 新機能
|
|
15
|
+
"feat",
|
|
16
|
+
// バグ修正
|
|
17
|
+
"fix",
|
|
18
|
+
// パフォーマンス向上のためのコード変更
|
|
19
|
+
"perf",
|
|
20
|
+
// バグ修正や新機能追加以外のコード変更
|
|
21
|
+
"refactor",
|
|
22
|
+
// 以前のコミットの取り消し
|
|
23
|
+
"revert",
|
|
24
|
+
// コードの意味に影響しない変更
|
|
25
|
+
"style",
|
|
26
|
+
// テストの追加や既存テストの修正
|
|
27
|
+
"test",
|
|
28
|
+
// 自動リリース専用
|
|
29
|
+
"release",
|
|
31
30
|
],
|
|
32
|
-
|
|
33
|
-
}
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
}
|
package/cspell/words.txt
CHANGED
package/eslint/base.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
import eslint from "@eslint/js"
|
|
4
|
-
import tseslint from "typescript-eslint"
|
|
5
|
-
import * as importPlugin from "eslint-plugin-import"
|
|
6
|
-
import comments from "@eslint-community/eslint-plugin-eslint-comments"
|
|
7
|
-
import functional from "eslint-plugin-functional"
|
|
8
|
-
import eslintConfigPrettier from "eslint-config-prettier/flat"
|
|
3
|
+
import eslint from "@eslint/js"
|
|
4
|
+
import tseslint from "typescript-eslint"
|
|
5
|
+
import * as importPlugin from "eslint-plugin-import"
|
|
6
|
+
import comments from "@eslint-community/eslint-plugin-eslint-comments"
|
|
7
|
+
import functional from "eslint-plugin-functional"
|
|
8
|
+
import eslintConfigPrettier from "eslint-config-prettier/flat"
|
|
9
9
|
|
|
10
10
|
export default tseslint.config(
|
|
11
11
|
eslint.configs.recommended,
|
|
@@ -132,20 +132,100 @@ export default tseslint.config(
|
|
|
132
132
|
{
|
|
133
133
|
paths: [
|
|
134
134
|
{
|
|
135
|
-
name: "
|
|
135
|
+
name: "@material-tailwind/react",
|
|
136
|
+
message: "shadcn/uiを使用してください。",
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "ajv",
|
|
136
140
|
message: "valibotを使用してください。",
|
|
137
141
|
},
|
|
138
142
|
{
|
|
139
|
-
name: "
|
|
143
|
+
name: "axios",
|
|
144
|
+
message: "Web標準のfetchを使用してください。",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "class-validator",
|
|
148
|
+
message: "valibotを使用してください。",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "daisyui",
|
|
140
152
|
message: "shadcn/uiを使用してください。",
|
|
141
153
|
},
|
|
142
154
|
{
|
|
143
155
|
name: "dayjs",
|
|
144
156
|
message: "date-fnsを使用してください。",
|
|
145
157
|
},
|
|
158
|
+
{
|
|
159
|
+
name: "express",
|
|
160
|
+
message: "Next.jsのAPI RoutesまたはHonoを使用してください。",
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: "formik",
|
|
164
|
+
message: "react-hook-formを使用してください。",
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: "jest",
|
|
168
|
+
message: "vitestを使用してください。",
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "joi",
|
|
172
|
+
message: "valibotを使用してください。",
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "lodash",
|
|
176
|
+
message: "remedaを使用してください。",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: "moment",
|
|
180
|
+
message: "date-fnsを使用してください。",
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: "react-charts",
|
|
184
|
+
message: "rechartsを使用してください。",
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: "react-final-form",
|
|
188
|
+
message: "react-hook-formを使用してください。",
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: "recoil",
|
|
192
|
+
message: "zustandまたはjotaiを使用してください。",
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "redux",
|
|
196
|
+
message: "zustandまたはjotaiを使用してください。",
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: "superstruct",
|
|
200
|
+
message: "valibotを使用してください。",
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
name: "typeorm",
|
|
204
|
+
message: "Prismaを使用してください。",
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
name: "yup",
|
|
208
|
+
message: "valibotを使用してください。",
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: "zod",
|
|
212
|
+
message: "valibotを使用してください。",
|
|
213
|
+
},
|
|
146
214
|
],
|
|
147
215
|
|
|
148
216
|
patterns: [
|
|
217
|
+
{
|
|
218
|
+
group: ["@emotion/*"],
|
|
219
|
+
message: "Tailwind CSSを使用してください。",
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
group: ["@mui/*"],
|
|
223
|
+
message: "shadcn/uiを使用してください。",
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
group: ["@nestjs/*"],
|
|
227
|
+
message: "Next.jsのAPI RoutesまたはHonoを使用してください。",
|
|
228
|
+
},
|
|
149
229
|
{
|
|
150
230
|
group: ["lodash/*"],
|
|
151
231
|
message: "remedaを使用してください。",
|
|
@@ -184,5 +264,5 @@ export default tseslint.config(
|
|
|
184
264
|
rules: {
|
|
185
265
|
"func-names": "off",
|
|
186
266
|
},
|
|
187
|
-
}
|
|
188
|
-
)
|
|
267
|
+
},
|
|
268
|
+
)
|
package/eslint/library.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
import base from "./base.mjs"
|
|
4
|
-
import globals from "globals"
|
|
3
|
+
import base from "./base.mjs"
|
|
4
|
+
import globals from "globals"
|
|
5
5
|
|
|
6
6
|
const eslintConfig = [
|
|
7
7
|
...base,
|
|
@@ -14,6 +14,6 @@ const eslintConfig = [
|
|
|
14
14
|
},
|
|
15
15
|
ignores: ["node_modules/", "dist/", "*.js"],
|
|
16
16
|
},
|
|
17
|
-
]
|
|
17
|
+
]
|
|
18
18
|
|
|
19
|
-
export default eslintConfig
|
|
19
|
+
export default eslintConfig
|
package/eslint/next.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
import base from "./base.mjs"
|
|
4
|
-
import globals from "globals"
|
|
5
|
-
import react from "./rules/react.mjs"
|
|
6
|
-
import reactHooks from "./rules/react-hooks.mjs"
|
|
3
|
+
import base from "./base.mjs"
|
|
4
|
+
import globals from "globals"
|
|
5
|
+
import react from "./rules/react.mjs"
|
|
6
|
+
import reactHooks from "./rules/react-hooks.mjs"
|
|
7
7
|
|
|
8
8
|
const eslintConfig = [
|
|
9
9
|
...base,
|
|
@@ -19,6 +19,6 @@ const eslintConfig = [
|
|
|
19
19
|
},
|
|
20
20
|
ignores: ["node_modules/", "dist/"],
|
|
21
21
|
},
|
|
22
|
-
]
|
|
22
|
+
]
|
|
23
23
|
|
|
24
|
-
export default eslintConfig
|
|
24
|
+
export default eslintConfig
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
import base from "./base.mjs"
|
|
4
|
-
import react from "./rules/react.mjs"
|
|
5
|
-
import reactHooks from "./rules/react-hooks.mjs"
|
|
6
|
-
import globals from "globals"
|
|
3
|
+
import base from "./base.mjs"
|
|
4
|
+
import react from "./rules/react.mjs"
|
|
5
|
+
import reactHooks from "./rules/react-hooks.mjs"
|
|
6
|
+
import globals from "globals"
|
|
7
7
|
|
|
8
8
|
const eslintConfig = [
|
|
9
9
|
...base,
|
|
@@ -19,6 +19,6 @@ const eslintConfig = [
|
|
|
19
19
|
},
|
|
20
20
|
ignores: ["node_modules/", "dist/", "*.js"],
|
|
21
21
|
},
|
|
22
|
-
]
|
|
22
|
+
]
|
|
23
23
|
|
|
24
|
-
export default eslintConfig
|
|
24
|
+
export default eslintConfig
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
import reactHooks from "eslint-plugin-react-hooks"
|
|
3
|
+
import reactHooks from "eslint-plugin-react-hooks"
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
name: "react-hooks",
|
|
@@ -10,4 +10,4 @@ export default {
|
|
|
10
10
|
rules: {
|
|
11
11
|
...reactHooks.configs["recommended-latest"].rules,
|
|
12
12
|
},
|
|
13
|
-
}
|
|
13
|
+
}
|
package/eslint/rules/react.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoshinani/style-guide",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Yoshinani's Style Guide",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/yoshinani-dev/style-guide#readme",
|
|
@@ -27,21 +27,21 @@
|
|
|
27
27
|
"cspell"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@commitlint/config-conventional": "^19",
|
|
30
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
31
31
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
32
|
-
"@eslint/js": "^9.
|
|
33
|
-
"eslint-config-prettier": "^10.1.
|
|
34
|
-
"eslint-plugin-functional": "^9.0.
|
|
32
|
+
"@eslint/js": "^9.28.0",
|
|
33
|
+
"eslint-config-prettier": "^10.1.5",
|
|
34
|
+
"eslint-plugin-functional": "^9.0.2",
|
|
35
35
|
"eslint-plugin-import": "^2.31.0",
|
|
36
36
|
"eslint-plugin-react": "^7.37.5",
|
|
37
37
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
38
38
|
"eslint-plugin-tailwindcss": "^3.18.0",
|
|
39
|
-
"globals": "^16.
|
|
40
|
-
"typescript-eslint": "^8.
|
|
39
|
+
"globals": "^16.2.0",
|
|
40
|
+
"typescript-eslint": "^8.34.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@changesets/cli": "^2.29.4",
|
|
44
|
-
"@commitlint/cli": "^19.8.
|
|
44
|
+
"@commitlint/cli": "^19.8.1",
|
|
45
45
|
"husky": "^9.1.7"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
@@ -53,7 +53,9 @@
|
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
|
+
"prettier": "./prettier/prettier.config.cjs",
|
|
56
57
|
"scripts": {
|
|
57
|
-
"release": "changeset publish"
|
|
58
|
+
"release": "changeset publish",
|
|
59
|
+
"format": "prettier --write ."
|
|
58
60
|
}
|
|
59
61
|
}
|
package/typescript/base.json
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"declarationMap": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"forceConsistentCasingInFileNames": true,
|
|
8
|
+
"incremental": false,
|
|
9
|
+
"isolatedModules": true,
|
|
10
|
+
"lib": ["es2022", "DOM", "DOM.Iterable"],
|
|
11
|
+
"module": "NodeNext",
|
|
12
|
+
"moduleDetection": "force",
|
|
13
|
+
"moduleResolution": "NodeNext",
|
|
14
|
+
"noFallthroughCasesInSwitch": true,
|
|
15
|
+
"noImplicitReturns": true,
|
|
16
|
+
"noUncheckedIndexedAccess": true,
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"skipLibCheck": true,
|
|
19
|
+
"strict": true,
|
|
20
|
+
"target": "ES2022"
|
|
22
21
|
}
|
|
23
|
-
|
|
22
|
+
}
|
package/typescript/nextjs.json
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"vitest/importMeta"
|
|
13
|
-
]
|
|
14
|
-
}
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "./base.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"plugins": [{ "name": "next" }],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "Bundler",
|
|
8
|
+
"allowJs": true,
|
|
9
|
+
"jsx": "preserve",
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"types": ["vitest/importMeta"]
|
|
15
12
|
}
|
|
16
|
-
|
|
13
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "./base.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"jsx": "react-jsx"
|
|
7
6
|
}
|
|
8
|
-
|
|
7
|
+
}
|