Skip to content

Commit

Permalink
Add eslint-plugin-react-refresh to react config (#293)
Browse files Browse the repository at this point in the history
* feat: use eslint-plugin-react-refresh

* Create rude-knives-cross.md

Signed-off-by: Kentaro Suzuki <[email protected]>

* chore: update snapshot (github-actions)

---------

Signed-off-by: Kentaro Suzuki <[email protected]>
Co-authored-by: actions-miku[bot] <185786754+actions-miku[bot]@users.noreply.github.com>
  • Loading branch information
sushichan044 and actions-miku[bot] authored Oct 31, 2024
1 parent fd1ac74 commit 917a98f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-knives-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@virtual-live-lab/eslint-config": patch
---

Add eslint-plugin-react-refresh to react config
1 change: 1 addition & 0 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"@types/node": "20.17.1",
"@virtual-live-lab/tsconfig": "workspace:^",
"@vitest/coverage-istanbul": "2.1.3",
"eslint-plugin-react-refresh": "^0.4.14",
"tsup": "8.3.5",
"vitest": "2.1.3"
},
Expand Down
9 changes: 9 additions & 0 deletions packages/eslint-config/src/base/react.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import react from "eslint-plugin-react";
// @ts-expect-error eslint-plugin-react-refresh is not typed
import reactRefresh from "eslint-plugin-react-refresh";
import globals from "globals";
import tseslint from "typescript-eslint";

Expand All @@ -20,6 +22,10 @@ const reactConfig = tseslint.config({
},
},
name: "@virtual-live-lab/eslint-config/react",
plugins: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
"react-refresh": reactRefresh,
},
rules: {
"react/button-has-type": "error",
"react/iframe-missing-sandbox": "error",
Expand All @@ -28,6 +34,9 @@ const reactConfig = tseslint.config({
"react/jsx-no-target-blank": ["error", { allowReferrer: true }],
"react/prop-types": "off",
"react/self-closing-comp": "error",
// TODO: 引数から option を受け取る api に変わったら, allowexportnames を設定できるようにする
// ref: https://github.com/ArnaudBarre/eslint-plugin-react-refresh?tab=readme-ov-file#allowexportnames-v044
"react-refresh/only-export-components": "warn",
},
settings: {
react: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4526,6 +4526,7 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`]
"@stylistic/ts",
"react",
"react-hooks",
"react-refresh",
"jsx-a11y:[email protected]",
],
"processor": undefined,
Expand Down Expand Up @@ -5511,6 +5512,9 @@ exports[`Test ESLint config with snapshot > react preset > matches snapshot 1`]
"react-hooks/rules-of-hooks": [
2,
],
"react-refresh/only-export-components": [
1,
],
"react/button-has-type": [
2,
],
Expand Down
35 changes: 13 additions & 22 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 917a98f

Please sign in to comment.