@yoshinani/style-guide 0.18.1 → 1.0.1
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 +1 -11
- package/biome/base.jsonc +1 -1
- package/eslint/base.mjs +5 -22
- package/eslint/library.mjs +3 -4
- package/eslint/next.mjs +3 -4
- package/eslint/react-internal.mjs +3 -4
- package/eslint/rules/react-hooks.mjs +2 -2
- package/eslint/rules/react.mjs +2 -2
- package/package.json +19 -17
- package/prettier/prettier.config.cjs +0 -17
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
以下の設定が利用可能で、組み合わせて使うことを想定しています。
|
|
10
10
|
|
|
11
|
-
- [
|
|
11
|
+
- [Biome](#biome)
|
|
12
12
|
- [ESLint](#eslint)
|
|
13
13
|
- [TypeScript](#typescript)
|
|
14
14
|
- [commitlint](#commitlint)
|
|
@@ -33,16 +33,6 @@ pnpm i --save-dev @yoshinani/style-guide
|
|
|
33
33
|
yarn add --dev @yoshinani/style-guide
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
## Prettier
|
|
37
|
-
|
|
38
|
-
共有 Prettier 設定を使うには、`package.json` に以下を追加してください。
|
|
39
|
-
|
|
40
|
-
```json
|
|
41
|
-
{
|
|
42
|
-
"prettier": "@yoshinani/style-guide/prettier"
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
36
|
## Biome
|
|
47
37
|
|
|
48
38
|
現在、この設定ではBiomeのフォーマッター機能のみを有効にしています。リンターとしては、別途 [ESLint](#eslint) を設定してください。
|
package/biome/base.jsonc
CHANGED
package/eslint/base.mjs
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import eslint from "@eslint/js"
|
|
4
4
|
import comments from "@eslint-community/eslint-plugin-eslint-comments"
|
|
5
|
+
import { defineConfig } from "eslint/config"
|
|
5
6
|
import eslintConfigPrettier from "eslint-config-prettier/flat"
|
|
6
7
|
import functional from "eslint-plugin-functional"
|
|
7
8
|
import * as importPlugin from "eslint-plugin-import"
|
|
8
9
|
import noBarrelFiles from "eslint-plugin-no-barrel-files"
|
|
9
10
|
import tseslint from "typescript-eslint"
|
|
10
11
|
|
|
11
|
-
export default
|
|
12
|
+
export default defineConfig(
|
|
12
13
|
eslint.configs.recommended,
|
|
13
14
|
tseslint.configs.recommendedTypeChecked,
|
|
14
15
|
eslintConfigPrettier,
|
|
@@ -22,7 +23,9 @@ export default tseslint.config(
|
|
|
22
23
|
import: importPlugin,
|
|
23
24
|
functional,
|
|
24
25
|
"@eslint-community/eslint-comments": comments,
|
|
25
|
-
"no-barrel-files":
|
|
26
|
+
"no-barrel-files": /** @type {import("eslint").ESLint.Plugin} */ (
|
|
27
|
+
noBarrelFiles
|
|
28
|
+
),
|
|
26
29
|
},
|
|
27
30
|
languageOptions: {
|
|
28
31
|
parserOptions: {
|
|
@@ -32,8 +35,6 @@ export default tseslint.config(
|
|
|
32
35
|
},
|
|
33
36
|
rules: {
|
|
34
37
|
"functional/immutable-data": "error",
|
|
35
|
-
// [barrel exportを禁止](https://github.com/art0rz/eslint-plugin-no-barrel-files)
|
|
36
|
-
"no-barrel-files/no-barrel-files": "error",
|
|
37
38
|
// [比較演算子禁止](https://www.notion.so/yoshinani-note/1dff5577f5838145acfcca9176913b79)
|
|
38
39
|
eqeqeq: [
|
|
39
40
|
"error",
|
|
@@ -83,24 +84,6 @@ export default tseslint.config(
|
|
|
83
84
|
"error",
|
|
84
85
|
{ ignore: [] },
|
|
85
86
|
],
|
|
86
|
-
// sort import statements
|
|
87
|
-
"import/order": [
|
|
88
|
-
"warn",
|
|
89
|
-
{
|
|
90
|
-
groups: [
|
|
91
|
-
"builtin",
|
|
92
|
-
"external",
|
|
93
|
-
"internal",
|
|
94
|
-
"parent",
|
|
95
|
-
"sibling",
|
|
96
|
-
"index",
|
|
97
|
-
],
|
|
98
|
-
"newlines-between": "always",
|
|
99
|
-
alphabetize: { order: "asc" },
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
// sort named imports within an import statement
|
|
103
|
-
"sort-imports": ["warn", { ignoreDeclarationSort: true }],
|
|
104
87
|
"no-restricted-syntax": [
|
|
105
88
|
"error",
|
|
106
89
|
{
|
package/eslint/library.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
+
import { defineConfig } from "eslint/config"
|
|
3
4
|
import globals from "globals"
|
|
4
5
|
|
|
5
6
|
import base from "./base.mjs"
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
export default defineConfig([
|
|
8
9
|
...base,
|
|
9
10
|
{
|
|
10
11
|
languageOptions: {
|
|
@@ -15,6 +16,4 @@ const eslintConfig = [
|
|
|
15
16
|
},
|
|
16
17
|
ignores: ["node_modules/", "dist/", "*.js"],
|
|
17
18
|
},
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
export default eslintConfig
|
|
19
|
+
])
|
package/eslint/next.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
+
import { defineConfig } from "eslint/config"
|
|
3
4
|
import globals from "globals"
|
|
4
5
|
|
|
5
6
|
import base from "./base.mjs"
|
|
6
7
|
import react from "./rules/react.mjs"
|
|
7
8
|
import reactHooks from "./rules/react-hooks.mjs"
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
export default defineConfig([
|
|
10
11
|
...base,
|
|
11
12
|
react,
|
|
12
13
|
reactHooks,
|
|
@@ -20,6 +21,4 @@ const eslintConfig = [
|
|
|
20
21
|
},
|
|
21
22
|
ignores: ["node_modules/", "dist/"],
|
|
22
23
|
},
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
export default eslintConfig
|
|
24
|
+
])
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
+
import { defineConfig } from "eslint/config"
|
|
3
4
|
import globals from "globals"
|
|
4
5
|
|
|
5
6
|
import base from "./base.mjs"
|
|
6
7
|
import react from "./rules/react.mjs"
|
|
7
8
|
import reactHooks from "./rules/react-hooks.mjs"
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
export default defineConfig([
|
|
10
11
|
...base,
|
|
11
12
|
react,
|
|
12
13
|
reactHooks,
|
|
@@ -20,6 +21,4 @@ const eslintConfig = [
|
|
|
20
21
|
},
|
|
21
22
|
ignores: ["node_modules/", "dist/", "*.js"],
|
|
22
23
|
},
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
export default eslintConfig
|
|
24
|
+
])
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import reactHooks from "eslint-plugin-react-hooks"
|
|
4
4
|
|
|
5
|
-
export default {
|
|
5
|
+
export default /** @type {import("eslint").Linter.Config} */ ({
|
|
6
6
|
name: "react-hooks",
|
|
7
7
|
plugins: {
|
|
8
8
|
"react-hooks": reactHooks,
|
|
@@ -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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import react from "eslint-plugin-react"
|
|
4
4
|
|
|
5
|
-
export default {
|
|
5
|
+
export default /** @type {import("eslint").Linter.Config} */ ({
|
|
6
6
|
name: "react",
|
|
7
7
|
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
|
|
8
8
|
settings: {
|
|
@@ -24,4 +24,4 @@ export default {
|
|
|
24
24
|
// prop-typesを使用しない
|
|
25
25
|
"react/prop-types": "off",
|
|
26
26
|
},
|
|
27
|
-
}
|
|
27
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoshinani/style-guide",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "YOSHINANI's Style Guide",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"./biome": "./biome/base.jsonc",
|
|
25
25
|
"./commitlint": "./commitlint/commitlint.config.mjs",
|
|
26
26
|
"./eslint/*": "./eslint/*.mjs",
|
|
27
|
-
"./prettier": "./prettier/prettier.config.cjs",
|
|
28
27
|
"./typescript": "./typescript/base.json",
|
|
29
28
|
"./typescript/nextjs": "./typescript/nextjs.json",
|
|
30
29
|
"./typescript/react-library": "./typescript/react-library.json"
|
|
@@ -34,40 +33,43 @@
|
|
|
34
33
|
"commitlint",
|
|
35
34
|
"cspell",
|
|
36
35
|
"eslint",
|
|
37
|
-
"prettier",
|
|
38
36
|
"typescript"
|
|
39
37
|
],
|
|
40
38
|
"dependencies": {
|
|
41
|
-
"@commitlint/config-conventional": "^20.3
|
|
42
|
-
"@eslint-community/eslint-plugin-eslint-comments": "^4.
|
|
43
|
-
"@eslint/js": "^9.
|
|
39
|
+
"@commitlint/config-conventional": "^20.5.3",
|
|
40
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
|
|
41
|
+
"@eslint/js": "^9.39.4",
|
|
44
42
|
"eslint-config-prettier": "^10.1.8",
|
|
45
|
-
"eslint-import-resolver-typescript": "^3.
|
|
46
|
-
"eslint-plugin-better-tailwindcss": "^3.
|
|
47
|
-
"eslint-plugin-functional": "^9.0.
|
|
43
|
+
"eslint-import-resolver-typescript": "^3.10.1",
|
|
44
|
+
"eslint-plugin-better-tailwindcss": "^3.8.0",
|
|
45
|
+
"eslint-plugin-functional": "^9.0.5",
|
|
48
46
|
"eslint-plugin-import": "^2.32.0",
|
|
49
47
|
"eslint-plugin-no-barrel-files": "^1.3.1",
|
|
50
48
|
"eslint-plugin-react": "^7.37.5",
|
|
51
49
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
52
|
-
"globals": "^16.
|
|
53
|
-
"typescript-eslint": "^8.
|
|
50
|
+
"globals": "^16.5.0",
|
|
51
|
+
"typescript-eslint": "^8.61.0"
|
|
54
52
|
},
|
|
55
53
|
"devDependencies": {
|
|
56
|
-
"@biomejs/biome": "^2.
|
|
57
|
-
"@changesets/cli": "^2.
|
|
58
|
-
"@commitlint/cli": "^20.3
|
|
59
|
-
"
|
|
54
|
+
"@biomejs/biome": "^2.4.16",
|
|
55
|
+
"@changesets/cli": "^2.31.0",
|
|
56
|
+
"@commitlint/cli": "^20.5.3",
|
|
57
|
+
"eslint": "9.31.0",
|
|
58
|
+
"husky": "^9.1.7",
|
|
59
|
+
"typescript": "5.9.3",
|
|
60
|
+
"vitest": "3.2.6"
|
|
60
61
|
},
|
|
61
62
|
"peerDependencies": {
|
|
62
63
|
"@biomejs/biome": "^2",
|
|
63
64
|
"@commitlint/cli": "^20",
|
|
64
65
|
"eslint": "^9",
|
|
65
|
-
"prettier": "^3",
|
|
66
66
|
"typescript": "^5"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"release": "changeset publish",
|
|
70
70
|
"check": "biome check .",
|
|
71
|
-
"check:fix": "biome check --write ."
|
|
71
|
+
"check:fix": "biome check --write .",
|
|
72
|
+
"test": "vitest run",
|
|
73
|
+
"typecheck": "tsc --noEmit"
|
|
72
74
|
}
|
|
73
75
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @see https://prettier.io/docs/configuration
|
|
5
|
-
* @type {import("prettier").Config}
|
|
6
|
-
*/
|
|
7
|
-
const config = {
|
|
8
|
-
endOfLine: "lf",
|
|
9
|
-
tabWidth: 2,
|
|
10
|
-
printWidth: 80,
|
|
11
|
-
useTabs: false,
|
|
12
|
-
singleQuote: false,
|
|
13
|
-
semi: false,
|
|
14
|
-
trailingComma: "all",
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
module.exports = config
|