From fbabaa3017d0827e93b3d64a844622b9e189da32 Mon Sep 17 00:00:00 2001 From: xaviergonz Date: Sat, 16 Mar 2024 16:11:21 +0100 Subject: [PATCH] Add ESLint React and React Hooks plugins --- .eslintrc.js | 2 + .../examples/clientServer/appInstance.tsx | 2 +- apps/site/docs/examples/todoList/logs.tsx | 4 +- package.json | 1 - yarn.lock | 49 +------------------ 5 files changed, 6 insertions(+), 52 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index db875219..9446e2a4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -35,6 +35,8 @@ module.exports = { "plugin:import/errors", "plugin:import/warnings", "plugin:import/typescript", + "plugin:react/recommended", + "plugin:react-hooks/recommended", ], rules: { diff --git a/apps/site/docs/examples/clientServer/appInstance.tsx b/apps/site/docs/examples/clientServer/appInstance.tsx index 14ac65b9..278c7b77 100644 --- a/apps/site/docs/examples/clientServer/appInstance.tsx +++ b/apps/site/docs/examples/clientServer/appInstance.tsx @@ -22,7 +22,7 @@ function initAppInstance() { let serverAction = false const runServerActionLocally = (actionCall: SerializedActionCallWithModelIdOverrides) => { - let wasServerAction = serverAction + const wasServerAction = serverAction serverAction = true try { // in clients we use the sync new model ids version to make sure that diff --git a/apps/site/docs/examples/todoList/logs.tsx b/apps/site/docs/examples/todoList/logs.tsx index 6e4f823a..2da15c9c 100644 --- a/apps/site/docs/examples/todoList/logs.tsx +++ b/apps/site/docs/examples/todoList/logs.tsx @@ -35,7 +35,7 @@ export const LogsView = observer((props: { rootStore: TodoList }) => { }, }) return disposer - }, [props.rootStore]) + }, [data, props.rootStore]) useEffect(() => { // also it is possible to get a list of changes in the form of patches, @@ -76,7 +76,7 @@ function ActionCallToText(props: { actionCall: ExtendedActionCall }) { const args = actionCall.args.map((arg) => JSON.stringify(arg)).join(", ") const path = actionCall.targetPath.join("/") - let text = `[${path}] ${actionCall.actionName}(${args})` + const text = `[${path}] ${actionCall.actionName}(${args})` if (actionCall.cancelled) { return ( <> diff --git a/package.json b/package.json index e3b61626..6640e189 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.29.1", - "eslint-plugin-prettier": "^5.1.3", "eslint-plugin-react": "^7.34.1", "eslint-plugin-react-hooks": "^4.6.0", "netlify-cli": "^17.19.3", diff --git a/yarn.lock b/yarn.lock index 38ff8fab..857edf3a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4410,13 +4410,6 @@ __metadata: languageName: node linkType: hard -"@pkgr/core@npm:^0.1.0": - version: 0.1.1 - resolution: "@pkgr/core@npm:0.1.1" - checksum: 10c0/3f7536bc7f57320ab2cf96f8973664bef624710c403357429fbf680a5c3b4843c1dbd389bb43daa6b1f6f1f007bb082f5abcb76bb2b5dc9f421647743b71d3d8 - languageName: node - linkType: hard - "@pnpm/config.env-replace@npm:^1.1.0": version: 1.1.0 resolution: "@pnpm/config.env-replace@npm:1.1.0" @@ -10228,26 +10221,6 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-prettier@npm:^5.1.3": - version: 5.1.3 - resolution: "eslint-plugin-prettier@npm:5.1.3" - dependencies: - prettier-linter-helpers: "npm:^1.0.0" - synckit: "npm:^0.8.6" - peerDependencies: - "@types/eslint": ">=8.0.0" - eslint: ">=8.0.0" - eslint-config-prettier: "*" - prettier: ">=3.0.0" - peerDependenciesMeta: - "@types/eslint": - optional: true - eslint-config-prettier: - optional: true - checksum: 10c0/f45d5fc1fcfec6b0cf038a7a65ddd10a25df4fe3f9e1f6b7f0d5100e66f046a26a2492e69ee765dddf461b93c114cf2e1eb18d4970aafa6f385448985c136e09 - languageName: node - linkType: hard - "eslint-plugin-react-hooks@npm:^4.6.0": version: 4.6.0 resolution: "eslint-plugin-react-hooks@npm:4.6.0" @@ -10805,7 +10778,7 @@ __metadata: languageName: node linkType: hard -"fast-diff@npm:^1.1.2, fast-diff@npm:^1.2.0": +"fast-diff@npm:^1.2.0": version: 1.3.0 resolution: "fast-diff@npm:1.3.0" checksum: 10c0/5c19af237edb5d5effda008c891a18a585f74bf12953be57923f17a3a4d0979565fc64dbc73b9e20926b9d895f5b690c618cbb969af0cf022e3222471220ad29 @@ -18505,15 +18478,6 @@ __metadata: languageName: node linkType: hard -"prettier-linter-helpers@npm:^1.0.0": - version: 1.0.0 - resolution: "prettier-linter-helpers@npm:1.0.0" - dependencies: - fast-diff: "npm:^1.1.2" - checksum: 10c0/81e0027d731b7b3697ccd2129470ed9913ecb111e4ec175a12f0fcfab0096516373bf0af2fef132af50cafb0a905b74ff57996d615f59512bb9ac7378fcc64ab - languageName: node - linkType: hard - "prettier-plugin-organize-imports@npm:^3.2.4": version: 3.2.4 resolution: "prettier-plugin-organize-imports@npm:3.2.4" @@ -19856,7 +19820,6 @@ __metadata: eslint: "npm:^8.57.0" eslint-config-prettier: "npm:^9.1.0" eslint-plugin-import: "npm:^2.29.1" - eslint-plugin-prettier: "npm:^5.1.3" eslint-plugin-react: "npm:^7.34.1" eslint-plugin-react-hooks: "npm:^4.6.0" mobx: "npm:^6.12.0" @@ -21349,16 +21312,6 @@ __metadata: languageName: node linkType: hard -"synckit@npm:^0.8.6": - version: 0.8.8 - resolution: "synckit@npm:0.8.8" - dependencies: - "@pkgr/core": "npm:^0.1.0" - tslib: "npm:^2.6.2" - checksum: 10c0/c3d3aa8e284f3f84f2f868b960c9f49239b364e35f6d20825a448449a3e9c8f49fe36cdd5196b30615682f007830d46f2ea354003954c7336723cb821e4b6519 - languageName: node - linkType: hard - "system-architecture@npm:^0.1.0": version: 0.1.0 resolution: "system-architecture@npm:0.1.0"