@yoshinani/style-guide 0.1.9 → 0.2.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/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,13 @@
1
+ // @ts-check
2
+
3
+ import reactHooks from "eslint-plugin-react-hooks";
4
+
5
+ export default {
6
+ name: "react-hooks",
7
+ plugins: {
8
+ "react-hooks": reactHooks,
9
+ },
10
+ rules: {
11
+ ...reactHooks.configs["recommended-latest"].rules,
12
+ },
13
+ };
@@ -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
+ // 論理値はtrue/falseで記載する
16
+ "react/jsx-boolean-value": ["error", "always"],
17
+ // 空のFragmentは記載しない
18
+ "react/jsx-no-useless-fragment": "error",
19
+ },
20
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoshinani/style-guide",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "description": "Yoshinani's Style Guide",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/yoshinani-dev/style-guide#readme",