@yoshinani/style-guide 0.1.9 → 0.2.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/eslint/next.mjs +4 -0
- package/eslint/react-internal.mjs +5 -7
- package/eslint/rules/react-hooks.mjs +13 -0
- package/eslint/rules/react.mjs +20 -0
- package/package.json +1 -1
package/eslint/next.mjs
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import base from "./base.mjs";
|
|
4
4
|
import globals from "globals";
|
|
5
|
+
import react from "./rules/react.mjs";
|
|
6
|
+
import reactHooks from "./rules/react-hooks.mjs";
|
|
5
7
|
|
|
6
8
|
const eslintConfig = [
|
|
7
9
|
...base,
|
|
10
|
+
react,
|
|
11
|
+
reactHooks,
|
|
8
12
|
{
|
|
9
13
|
languageOptions: {
|
|
10
14
|
globals: {
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
3
|
import base from "./base.mjs";
|
|
4
|
+
import react from "./rules/react.mjs";
|
|
5
|
+
import reactHooks from "./rules/react-hooks.mjs";
|
|
4
6
|
import globals from "globals";
|
|
5
|
-
import react from "eslint-plugin-react";
|
|
6
|
-
import reactHooks from "eslint-plugin-react-hooks";
|
|
7
7
|
|
|
8
8
|
const eslintConfig = [
|
|
9
9
|
...base,
|
|
10
|
+
react,
|
|
11
|
+
reactHooks,
|
|
10
12
|
{
|
|
13
|
+
name: "global-definitions",
|
|
11
14
|
languageOptions: {
|
|
12
15
|
globals: {
|
|
13
16
|
...globals.serviceworker,
|
|
@@ -16,11 +19,6 @@ const eslintConfig = [
|
|
|
16
19
|
},
|
|
17
20
|
ignores: ["node_modules/", "dist/", "*.js"],
|
|
18
21
|
},
|
|
19
|
-
{
|
|
20
|
-
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
|
|
21
|
-
...react.configs.flat.recommended,
|
|
22
|
-
...reactHooks.configs["recommended-latest"],
|
|
23
|
-
},
|
|
24
22
|
];
|
|
25
23
|
|
|
26
24
|
export default eslintConfig;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import react from "eslint-plugin-react";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
name: "react",
|
|
7
|
+
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
|
|
8
|
+
plugins: {
|
|
9
|
+
react,
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
...react.configs.flat.recommended.rules,
|
|
13
|
+
// コンポーネント名はPascalCaseで記載する
|
|
14
|
+
"react/jsx-pascal-case": "error",
|
|
15
|
+
// 空のFragmentは記載しない
|
|
16
|
+
"react/jsx-no-useless-fragment": "error",
|
|
17
|
+
// import React from "react"を記載しない
|
|
18
|
+
"react/react-in-jsx-scope": "off",
|
|
19
|
+
},
|
|
20
|
+
};
|