From 78cb0c7322f5939775ca31c4971791c544828f54 Mon Sep 17 00:00:00 2001 From: sushichan044 Date: Tue, 22 Oct 2024 02:19:47 +0900 Subject: [PATCH 1/7] fix: react rule --- packages/eslint-config/src/base/react.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/eslint-config/src/base/react.ts b/packages/eslint-config/src/base/react.ts index c57148b0..39c73baf 100644 --- a/packages/eslint-config/src/base/react.ts +++ b/packages/eslint-config/src/base/react.ts @@ -21,10 +21,13 @@ const reactConfig = tseslint.config({ }, name: "@virtual-live-lab/eslint-config/react", rules: { - "react/jsx-boolean-value": "warn", - "react/jsx-curly-brace-presence": "error", - "react/jsx-no-target-blank": "warn", + "react/button-has-type": "error", + "react/iframe-missing-sandbox": "error", + "react/jsx-boolean-value": "error", + "react/jsx-curly-brace-presence": ["error", "never"], + "react/jsx-no-target-blank": ["error", { allowReferer: true }], "react/prop-types": "off", + "react/self-closing-comp": "error", }, settings: { react: { From 73a536b1f20132f212e56d0704f1690f41dacb71 Mon Sep 17 00:00:00 2001 From: sushichan044 Date: Tue, 22 Oct 2024 02:19:54 +0900 Subject: [PATCH 2/7] fix: perfectionist rules --- packages/eslint-config/src/base/stylistic.ts | 18 ++++++++++++++++++ packages/eslint-config/src/base/typescript.ts | 1 + 2 files changed, 19 insertions(+) diff --git a/packages/eslint-config/src/base/stylistic.ts b/packages/eslint-config/src/base/stylistic.ts index 253259d1..64f63d44 100644 --- a/packages/eslint-config/src/base/stylistic.ts +++ b/packages/eslint-config/src/base/stylistic.ts @@ -12,7 +12,9 @@ const stylisticConfig = tseslint.config({ "perfectionist/sort-object-types": [ "error", { + ignoreCase: true, order: "asc", + partitionByComment: true, partitionByNewLine: true, type: "natural", }, @@ -20,7 +22,9 @@ const stylisticConfig = tseslint.config({ "perfectionist/sort-objects": [ "error", { + ignoreCase: true, order: "asc", + partitionByComment: true, partitionByNewLine: true, type: "natural", }, @@ -28,6 +32,20 @@ const stylisticConfig = tseslint.config({ "perfectionist/sort-union-types": [ "error", { + groups: [ + "conditional", + "function", + "import", + "intersection", + "keyword", + "literal", + "named", + "object", + "operator", + "tuple", + "union", + "nullish", + ], order: "asc", type: "natural", }, diff --git a/packages/eslint-config/src/base/typescript.ts b/packages/eslint-config/src/base/typescript.ts index 88ed7109..28198098 100644 --- a/packages/eslint-config/src/base/typescript.ts +++ b/packages/eslint-config/src/base/typescript.ts @@ -27,6 +27,7 @@ const tsConfig = tseslint.config({ // SEE: https://zenn.dev/cybozu_frontend/articles/ts-eslint-v6-guide // v6 で recommended から削除されたものを有効化 "@stylistic/ts/no-extra-semi": "error", + "@typescript-eslint/adjacent-overload-signatures": "off", // #175 "@typescript-eslint/array-type": [ "error", From a3578c80dbe076907810a99a3686fd2f20e12503 Mon Sep 17 00:00:00 2001 From: sushichan044 Date: Tue, 22 Oct 2024 02:21:23 +0900 Subject: [PATCH 3/7] chore: changeset --- .changeset/calm-rings-wave.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/calm-rings-wave.md diff --git a/.changeset/calm-rings-wave.md b/.changeset/calm-rings-wave.md new file mode 100644 index 00000000..6091499d --- /dev/null +++ b/.changeset/calm-rings-wave.md @@ -0,0 +1,5 @@ +--- +"@virtual-live-lab/eslint-config": patch +--- + +Fix react rule / stylistic rule From 7dd76d90a7658d9ee37aa3de65a897222c3f9a8f Mon Sep 17 00:00:00 2001 From: sushichan044 Date: Tue, 22 Oct 2024 02:27:05 +0900 Subject: [PATCH 4/7] fix: typo --- packages/eslint-config/src/base/react.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-config/src/base/react.ts b/packages/eslint-config/src/base/react.ts index 39c73baf..5775179a 100644 --- a/packages/eslint-config/src/base/react.ts +++ b/packages/eslint-config/src/base/react.ts @@ -25,7 +25,7 @@ const reactConfig = tseslint.config({ "react/iframe-missing-sandbox": "error", "react/jsx-boolean-value": "error", "react/jsx-curly-brace-presence": ["error", "never"], - "react/jsx-no-target-blank": ["error", { allowReferer: true }], + "react/jsx-no-target-blank": ["error", { allowReferrer: true }], "react/prop-types": "off", "react/self-closing-comp": "error", }, From 98a73b90e16c06c6f56adcba418078e6e2e6cf86 Mon Sep 17 00:00:00 2001 From: VLL39 Date: Mon, 21 Oct 2024 17:28:12 +0000 Subject: [PATCH 5/7] chore: update snapshot (github-actions) --- .../test/__snapshots__/snapshot.test.ts.snap | 77 ++++++++++++++++++- 1 file changed, 73 insertions(+), 4 deletions(-) diff --git a/packages/eslint-config/test/__snapshots__/snapshot.test.ts.snap b/packages/eslint-config/test/__snapshots__/snapshot.test.ts.snap index 8a629c96..f28c8d50 100644 --- a/packages/eslint-config/test/__snapshots__/snapshot.test.ts.snap +++ b/packages/eslint-config/test/__snapshots__/snapshot.test.ts.snap @@ -828,7 +828,9 @@ exports[`Test ESLint config with snapshot > js preset > matches snapshot 1`] = ` "perfectionist/sort-object-types": [ 2, { + "ignoreCase": true, "order": "asc", + "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -836,7 +838,9 @@ exports[`Test ESLint config with snapshot > js preset > matches snapshot 1`] = ` "perfectionist/sort-objects": [ 2, { + "ignoreCase": true, "order": "asc", + "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -858,6 +862,20 @@ exports[`Test ESLint config with snapshot > js preset > matches snapshot 1`] = ` "perfectionist/sort-union-types": [ 2, { + "groups": [ + "conditional", + "function", + "import", + "intersection", + "keyword", + "literal", + "named", + "object", + "operator", + "tuple", + "union", + "nullish", + ], "order": "asc", "type": "natural", }, @@ -2313,7 +2331,7 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] 2, ], "@typescript-eslint/adjacent-overload-signatures": [ - 2, + 0, ], "@typescript-eslint/array-type": [ 2, @@ -3192,7 +3210,9 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] "perfectionist/sort-object-types": [ 2, { + "ignoreCase": true, "order": "asc", + "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -3200,7 +3220,9 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] "perfectionist/sort-objects": [ 2, { + "ignoreCase": true, "order": "asc", + "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -3222,6 +3244,20 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] "perfectionist/sort-union-types": [ 2, { + "groups": [ + "conditional", + "function", + "import", + "intersection", + "keyword", + "literal", + "named", + "object", + "operator", + "tuple", + "union", + "nullish", + ], "order": "asc", "type": "natural", }, @@ -3257,11 +3293,17 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] "react-hooks/rules-of-hooks": [ 2, ], + "react/button-has-type": [ + 2, + ], "react/display-name": [ 2, ], + "react/iframe-missing-sandbox": [ + 2, + ], "react/jsx-boolean-value": [ - 1, + 2, ], "react/jsx-child-element-spacing": [ 0, @@ -3274,6 +3316,7 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] ], "react/jsx-curly-brace-presence": [ 2, + "never", ], "react/jsx-curly-newline": [ 0, @@ -3309,7 +3352,12 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] 2, ], "react/jsx-no-target-blank": [ - 1, + 2, + { + "allowReferrer": true, + "forms": false, + "links": true, + }, ], "react/jsx-no-undef": [ 2, @@ -3377,6 +3425,9 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] "react/require-render-return": [ 2, ], + "react/self-closing-comp": [ + 2, + ], "require-await": [ 0, ], @@ -3633,7 +3684,7 @@ exports[`Test ESLint config with snapshot > ts preset > matches snapshot 1`] = ` 2, ], "@typescript-eslint/adjacent-overload-signatures": [ - 2, + 0, ], "@typescript-eslint/array-type": [ 2, @@ -4272,7 +4323,9 @@ exports[`Test ESLint config with snapshot > ts preset > matches snapshot 1`] = ` "perfectionist/sort-object-types": [ 2, { + "ignoreCase": true, "order": "asc", + "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -4280,7 +4333,9 @@ exports[`Test ESLint config with snapshot > ts preset > matches snapshot 1`] = ` "perfectionist/sort-objects": [ 2, { + "ignoreCase": true, "order": "asc", + "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -4302,6 +4357,20 @@ exports[`Test ESLint config with snapshot > ts preset > matches snapshot 1`] = ` "perfectionist/sort-union-types": [ 2, { + "groups": [ + "conditional", + "function", + "import", + "intersection", + "keyword", + "literal", + "named", + "object", + "operator", + "tuple", + "union", + "nullish", + ], "order": "asc", "type": "natural", }, From 86d3a03f7336e387239112359b64dc57303ec56b Mon Sep 17 00:00:00 2001 From: sushichan044 Date: Tue, 22 Oct 2024 02:34:00 +0900 Subject: [PATCH 6/7] Revert "chore: update snapshot (github-actions)" This reverts commit 98a73b90e16c06c6f56adcba418078e6e2e6cf86. --- .../test/__snapshots__/snapshot.test.ts.snap | 77 +------------------ 1 file changed, 4 insertions(+), 73 deletions(-) diff --git a/packages/eslint-config/test/__snapshots__/snapshot.test.ts.snap b/packages/eslint-config/test/__snapshots__/snapshot.test.ts.snap index f28c8d50..8a629c96 100644 --- a/packages/eslint-config/test/__snapshots__/snapshot.test.ts.snap +++ b/packages/eslint-config/test/__snapshots__/snapshot.test.ts.snap @@ -828,9 +828,7 @@ exports[`Test ESLint config with snapshot > js preset > matches snapshot 1`] = ` "perfectionist/sort-object-types": [ 2, { - "ignoreCase": true, "order": "asc", - "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -838,9 +836,7 @@ exports[`Test ESLint config with snapshot > js preset > matches snapshot 1`] = ` "perfectionist/sort-objects": [ 2, { - "ignoreCase": true, "order": "asc", - "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -862,20 +858,6 @@ exports[`Test ESLint config with snapshot > js preset > matches snapshot 1`] = ` "perfectionist/sort-union-types": [ 2, { - "groups": [ - "conditional", - "function", - "import", - "intersection", - "keyword", - "literal", - "named", - "object", - "operator", - "tuple", - "union", - "nullish", - ], "order": "asc", "type": "natural", }, @@ -2331,7 +2313,7 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] 2, ], "@typescript-eslint/adjacent-overload-signatures": [ - 0, + 2, ], "@typescript-eslint/array-type": [ 2, @@ -3210,9 +3192,7 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] "perfectionist/sort-object-types": [ 2, { - "ignoreCase": true, "order": "asc", - "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -3220,9 +3200,7 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] "perfectionist/sort-objects": [ 2, { - "ignoreCase": true, "order": "asc", - "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -3244,20 +3222,6 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] "perfectionist/sort-union-types": [ 2, { - "groups": [ - "conditional", - "function", - "import", - "intersection", - "keyword", - "literal", - "named", - "object", - "operator", - "tuple", - "union", - "nullish", - ], "order": "asc", "type": "natural", }, @@ -3293,17 +3257,11 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] "react-hooks/rules-of-hooks": [ 2, ], - "react/button-has-type": [ - 2, - ], "react/display-name": [ 2, ], - "react/iframe-missing-sandbox": [ - 2, - ], "react/jsx-boolean-value": [ - 2, + 1, ], "react/jsx-child-element-spacing": [ 0, @@ -3316,7 +3274,6 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] ], "react/jsx-curly-brace-presence": [ 2, - "never", ], "react/jsx-curly-newline": [ 0, @@ -3352,12 +3309,7 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] 2, ], "react/jsx-no-target-blank": [ - 2, - { - "allowReferrer": true, - "forms": false, - "links": true, - }, + 1, ], "react/jsx-no-undef": [ 2, @@ -3425,9 +3377,6 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] "react/require-render-return": [ 2, ], - "react/self-closing-comp": [ - 2, - ], "require-await": [ 0, ], @@ -3684,7 +3633,7 @@ exports[`Test ESLint config with snapshot > ts preset > matches snapshot 1`] = ` 2, ], "@typescript-eslint/adjacent-overload-signatures": [ - 0, + 2, ], "@typescript-eslint/array-type": [ 2, @@ -4323,9 +4272,7 @@ exports[`Test ESLint config with snapshot > ts preset > matches snapshot 1`] = ` "perfectionist/sort-object-types": [ 2, { - "ignoreCase": true, "order": "asc", - "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -4333,9 +4280,7 @@ exports[`Test ESLint config with snapshot > ts preset > matches snapshot 1`] = ` "perfectionist/sort-objects": [ 2, { - "ignoreCase": true, "order": "asc", - "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -4357,20 +4302,6 @@ exports[`Test ESLint config with snapshot > ts preset > matches snapshot 1`] = ` "perfectionist/sort-union-types": [ 2, { - "groups": [ - "conditional", - "function", - "import", - "intersection", - "keyword", - "literal", - "named", - "object", - "operator", - "tuple", - "union", - "nullish", - ], "order": "asc", "type": "natural", }, From 181b997444c7b5904ab5b34f2dcc2c4fef4a6fab Mon Sep 17 00:00:00 2001 From: VLL39 Date: Mon, 21 Oct 2024 17:35:39 +0000 Subject: [PATCH 7/7] chore: update snapshot (github-actions) --- .../test/__snapshots__/snapshot.test.ts.snap | 77 ++++++++++++++++++- 1 file changed, 73 insertions(+), 4 deletions(-) diff --git a/packages/eslint-config/test/__snapshots__/snapshot.test.ts.snap b/packages/eslint-config/test/__snapshots__/snapshot.test.ts.snap index 8a629c96..f28c8d50 100644 --- a/packages/eslint-config/test/__snapshots__/snapshot.test.ts.snap +++ b/packages/eslint-config/test/__snapshots__/snapshot.test.ts.snap @@ -828,7 +828,9 @@ exports[`Test ESLint config with snapshot > js preset > matches snapshot 1`] = ` "perfectionist/sort-object-types": [ 2, { + "ignoreCase": true, "order": "asc", + "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -836,7 +838,9 @@ exports[`Test ESLint config with snapshot > js preset > matches snapshot 1`] = ` "perfectionist/sort-objects": [ 2, { + "ignoreCase": true, "order": "asc", + "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -858,6 +862,20 @@ exports[`Test ESLint config with snapshot > js preset > matches snapshot 1`] = ` "perfectionist/sort-union-types": [ 2, { + "groups": [ + "conditional", + "function", + "import", + "intersection", + "keyword", + "literal", + "named", + "object", + "operator", + "tuple", + "union", + "nullish", + ], "order": "asc", "type": "natural", }, @@ -2313,7 +2331,7 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] 2, ], "@typescript-eslint/adjacent-overload-signatures": [ - 2, + 0, ], "@typescript-eslint/array-type": [ 2, @@ -3192,7 +3210,9 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] "perfectionist/sort-object-types": [ 2, { + "ignoreCase": true, "order": "asc", + "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -3200,7 +3220,9 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] "perfectionist/sort-objects": [ 2, { + "ignoreCase": true, "order": "asc", + "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -3222,6 +3244,20 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] "perfectionist/sort-union-types": [ 2, { + "groups": [ + "conditional", + "function", + "import", + "intersection", + "keyword", + "literal", + "named", + "object", + "operator", + "tuple", + "union", + "nullish", + ], "order": "asc", "type": "natural", }, @@ -3257,11 +3293,17 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] "react-hooks/rules-of-hooks": [ 2, ], + "react/button-has-type": [ + 2, + ], "react/display-name": [ 2, ], + "react/iframe-missing-sandbox": [ + 2, + ], "react/jsx-boolean-value": [ - 1, + 2, ], "react/jsx-child-element-spacing": [ 0, @@ -3274,6 +3316,7 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] ], "react/jsx-curly-brace-presence": [ 2, + "never", ], "react/jsx-curly-newline": [ 0, @@ -3309,7 +3352,12 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] 2, ], "react/jsx-no-target-blank": [ - 1, + 2, + { + "allowReferrer": true, + "forms": false, + "links": true, + }, ], "react/jsx-no-undef": [ 2, @@ -3377,6 +3425,9 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`] "react/require-render-return": [ 2, ], + "react/self-closing-comp": [ + 2, + ], "require-await": [ 0, ], @@ -3633,7 +3684,7 @@ exports[`Test ESLint config with snapshot > ts preset > matches snapshot 1`] = ` 2, ], "@typescript-eslint/adjacent-overload-signatures": [ - 2, + 0, ], "@typescript-eslint/array-type": [ 2, @@ -4272,7 +4323,9 @@ exports[`Test ESLint config with snapshot > ts preset > matches snapshot 1`] = ` "perfectionist/sort-object-types": [ 2, { + "ignoreCase": true, "order": "asc", + "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -4280,7 +4333,9 @@ exports[`Test ESLint config with snapshot > ts preset > matches snapshot 1`] = ` "perfectionist/sort-objects": [ 2, { + "ignoreCase": true, "order": "asc", + "partitionByComment": true, "partitionByNewLine": true, "type": "natural", }, @@ -4302,6 +4357,20 @@ exports[`Test ESLint config with snapshot > ts preset > matches snapshot 1`] = ` "perfectionist/sort-union-types": [ 2, { + "groups": [ + "conditional", + "function", + "import", + "intersection", + "keyword", + "literal", + "named", + "object", + "operator", + "tuple", + "union", + "nullish", + ], "order": "asc", "type": "natural", },