-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: migrate to eslint 9 #142
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
import typescriptEslint from "@typescript-eslint/eslint-plugin"; | ||
import typescriptParser from "@typescript-eslint/parser"; | ||
import pluginJsxA11y from "eslint-plugin-jsx-a11y"; | ||
import pluginPrettierRecommended from "eslint-plugin-prettier/recommended"; | ||
import pluginReact from "eslint-plugin-react"; | ||
import pluginReactHooks from "eslint-plugin-react-hooks"; | ||
import pluginSimpleImportSort from "eslint-plugin-simple-import-sort"; | ||
import pluginTestingLibrary from "eslint-plugin-testing-library"; | ||
// import vitest from "eslint-plugin-vitest"; | ||
import pluginWorkspaces from "eslint-plugin-workspaces"; | ||
|
||
export default [ | ||
{ | ||
ignores: ["**/coverage", "**/dist/**", "**/build/**", "**/storybook-static", "**/*.ejs.js"] | ||
}, | ||
{ | ||
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"], | ||
...pluginReact.configs.flat.recommended, | ||
settings: { | ||
react: { | ||
version: "detect" | ||
} | ||
}, | ||
languageOptions: { | ||
...pluginReact.configs.flat.recommended.languageOptions | ||
// globals: { | ||
// ...globals.serviceworker, | ||
// ...globals.browser | ||
// } | ||
}, | ||
rules: { | ||
...pluginReact.configs.flat.recommended.rules, | ||
"react/no-unescaped-entities": "off", | ||
"react/react-in-jsx-scope": "off", | ||
"react/prop-types": "off", | ||
"react/display-name": "warn" | ||
} | ||
}, | ||
{ | ||
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"], | ||
languageOptions: { | ||
ecmaVersion: "latest", | ||
sourceType: "module", | ||
parser: typescriptParser, | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true | ||
}, | ||
ecmaVersion: "latest", | ||
sourceType: "module" | ||
} | ||
// globals: { | ||
// ...globals.browser | ||
// } | ||
}, | ||
plugins: { | ||
"@typescript-eslint": typescriptEslint | ||
}, | ||
rules: { | ||
"@typescript-eslint/no-unused-vars": "error" | ||
} | ||
}, | ||
pluginJsxA11y.flatConfigs.recommended, | ||
{ | ||
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"], | ||
languageOptions: { | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true | ||
} | ||
} | ||
}, | ||
plugins: { | ||
"react-hooks": pluginReactHooks, | ||
"simple-import-sort": pluginSimpleImportSort, | ||
workspaces: pluginWorkspaces | ||
}, | ||
rules: { | ||
"simple-import-sort/imports": "error", | ||
"simple-import-sort/exports": "error", | ||
"workspaces/no-absolute-imports": "error", | ||
"react-hooks/rules-of-hooks": "error", // Checks rules of Hooks | ||
"react-hooks/exhaustive-deps": "warn" // Checks effect dependencies | ||
} | ||
}, | ||
// { | ||
// files: ["**/*.spec.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"], | ||
// plugins: { | ||
// vitest | ||
// }, | ||
// rules: { | ||
// ...vitest.configs.recommended.rules | ||
// } | ||
// }, | ||
// { | ||
// files: ["**/*.spec.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"], // or any other pattern | ||
// plugins: { | ||
// vitest | ||
// }, | ||
// rules: { | ||
// ...vitest.configs.recommended.rules, // you can also use vitest.configs.all.rules to enable all rules | ||
// "vitest/consistent-test-it": [ | ||
// "error", | ||
// { fn: "it", withinDescribe: "it" } | ||
// ], | ||
// "vitest/no-alias-methods": "error" | ||
// } | ||
// }, | ||
{ | ||
files: ["**/*.spec.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"], | ||
plugins: { | ||
"testing-library": pluginTestingLibrary | ||
}, | ||
rules: { | ||
"testing-library/await-async-events": ["error", { eventModule: "userEvent" }], | ||
"testing-library/await-async-queries": "error", | ||
"testing-library/await-async-utils": "error", | ||
"testing-library/no-await-sync-events": ["error", { eventModules: ["fire-event"] }], | ||
"testing-library/no-await-sync-queries": "error", | ||
"testing-library/no-container": "error", | ||
"testing-library/no-debugging-utils": "warn", | ||
"testing-library/no-dom-import": ["error", "react"], | ||
"testing-library/no-global-regexp-flag-in-query": "error", | ||
"testing-library/no-manual-cleanup": "error", | ||
"testing-library/no-node-access": "warn", | ||
"testing-library/no-promise-in-fire-event": "error", | ||
"testing-library/no-render-in-lifecycle": "error", | ||
"testing-library/no-unnecessary-act": "error", | ||
"testing-library/no-wait-for-multiple-assertions": "error", | ||
"testing-library/no-wait-for-side-effects": "error", | ||
"testing-library/no-wait-for-snapshot": "error", | ||
"testing-library/prefer-find-by": "error", | ||
"testing-library/prefer-presence-queries": "error", | ||
"testing-library/prefer-query-by-disappearance": "error", | ||
"testing-library/prefer-screen-queries": "error", | ||
"testing-library/render-result-naming-convention": "error" | ||
} | ||
}, | ||
pluginPrettierRecommended, | ||
{ | ||
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"], | ||
rules: { | ||
curly: ["error", "all"] | ||
} | ||
} | ||
]; |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -18,9 +18,8 @@ | |||||||||
"configure": "monorepo ci configure", | ||||||||||
"test": "lerna run test --stream", | ||||||||||
"test:coverage:update": "lerna run test:coverage:update --stream", | ||||||||||
"lint": "lerna run lint --stream", | ||||||||||
"lint:fix": "lerna run lint:fix --stream", | ||||||||||
"prettier": "prettier '**/*.{ts,js,json,md,yml,yaml}' --write", | ||||||||||
"lint": "eslint", | ||||||||||
"lint:fix": "eslint", | ||||||||||
Comment on lines
+21
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Lint scripts might be too minimal. The lint scripts have been simplified from using Lerna to direct ESLint calls, but they're missing necessary arguments:
Consider updating the scripts to be more explicit: - "lint": "eslint",
- "lint:fix": "eslint",
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
+ "lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix" 📝 Committable suggestion
Suggested change
|
||||||||||
"build": "monorepo build --verbose", | ||||||||||
"publish": "monorepo publish --dry-run", | ||||||||||
"start": "lerna run start --stream --parallel", | ||||||||||
|
@@ -63,8 +62,8 @@ | |||||||||
}, | ||||||||||
"devDependencies": { | ||||||||||
"@chromatic-com/storybook": "3.2.3", | ||||||||||
"@commitlint/cli": "^17.0.3", | ||||||||||
"@commitlint/config-conventional": "^17.0.3", | ||||||||||
"@commitlint/cli": "19.6.1", | ||||||||||
"@commitlint/config-conventional": "19.6.0", | ||||||||||
"@storybook/addon-a11y": "^8.4.7", | ||||||||||
"@storybook/addon-essentials": "^8.4.7", | ||||||||||
"@storybook/addon-interactions": "^8.4.7", | ||||||||||
|
@@ -90,23 +89,23 @@ | |||||||||
"@types/prop-types": "^15.7.5", | ||||||||||
"@types/react-dnd": "3.0.2", | ||||||||||
"@types/react-dnd-html5-backend": "3.0.2", | ||||||||||
"@typescript-eslint/eslint-plugin": "8.18.2", | ||||||||||
"@typescript-eslint/parser": "8.18.2", | ||||||||||
"@vitejs/plugin-react": "^4.3.4", | ||||||||||
"autoprefixer": "^10.4.7", | ||||||||||
"babel-eslint": "^10.1.0", | ||||||||||
"camelcase": "6.3.0", | ||||||||||
"chromatic": "11.20.2", | ||||||||||
"cross-env": "7.0.3", | ||||||||||
"eslint": "^8.15.0", | ||||||||||
"eslint-config-prettier": "^8.5.0", | ||||||||||
"eslint-config-react-app": "^7.0.1", | ||||||||||
"eslint-plugin-import": "^2.26.0", | ||||||||||
"eslint-plugin-jsx-a11y": "^6.5.1", | ||||||||||
"eslint-plugin-prettier": "^4.2.1", | ||||||||||
"eslint-plugin-react": "^7.30.1", | ||||||||||
"eslint-plugin-react-hooks": "^4.6.0", | ||||||||||
"eslint-plugin-simple-import-sort": "^7.0.0", | ||||||||||
"eslint-plugin-testing-library": "^5.5.1", | ||||||||||
"eslint-plugin-workspaces": "^0.7.0", | ||||||||||
"eslint": "9.17.0", | ||||||||||
"eslint-config-prettier": "9.1.0", | ||||||||||
"eslint-plugin-jsx-a11y": "6.10.2", | ||||||||||
"eslint-plugin-prettier": "5.2.1", | ||||||||||
"eslint-plugin-react": "7.37.3", | ||||||||||
"eslint-plugin-react-hooks": "5.1.0", | ||||||||||
"eslint-plugin-simple-import-sort": "12.1.1", | ||||||||||
"eslint-plugin-storybook": "0.11.1", | ||||||||||
"eslint-plugin-testing-library": "7.1.1", | ||||||||||
"eslint-plugin-workspaces": "0.10.1", | ||||||||||
Comment on lines
+92
to
+108
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification ESLint version needs to be downgraded to 8.57.0 The dependency check reveals an incompatibility in the current setup:
To resolve this, you should downgrade ESLint to version 8.57.0 since:
🔗 Analysis chainVerify ESLint plugin compatibility. The ESLint upgrade to version 9.x comes with several plugin updates. The versions look compatible, but let's verify the peer dependencies. ESLint plugin compatibility issue detected with @typescript-eslint/eslint-plugin The peer dependency check reveals an incompatibility:
Let's verify if there's a newer version of 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Check peer dependency compatibility
npm info [email protected] peerDependencies
npm info @typescript-eslint/[email protected] peerDependencies
npm info [email protected] peerDependencies
npm info [email protected] peerDependencies
Length of output: 503 Script: #!/bin/bash
# Check latest version of @typescript-eslint/eslint-plugin
npm info @typescript-eslint/eslint-plugin dist-tags.latest
Length of output: 67 |
||||||||||
"fs-extra": "10.1.0", | ||||||||||
"husky": "^8.0.1", | ||||||||||
"jest": "^28.1.2", | ||||||||||
|
@@ -121,16 +120,14 @@ | |||||||||
"postcss-normalize": "10.0.1", | ||||||||||
"postcss-preset-env": "7.7.2", | ||||||||||
"postcss-safe-parser": "6.0.0", | ||||||||||
"prettier": "^2.6.2", | ||||||||||
"prettier-eslint": "^14.0.3", | ||||||||||
"prettier": "3.4.2", | ||||||||||
"prop-types": "^15.8.1", | ||||||||||
"react": "^18.2.0", | ||||||||||
"react-dom": "^18.2.0", | ||||||||||
"react-svg": "10.0.23", | ||||||||||
"rimraf": "^3.0.2", | ||||||||||
"semantic-release": "23.0.5", | ||||||||||
"semantic-release-slack-bot": "4.0.2", | ||||||||||
"serve": "^13.0.4", | ||||||||||
"storybook": "^8.4.7", | ||||||||||
"typescript": "4.9.5", | ||||||||||
"vite": "5.1.8", | ||||||||||
|
@@ -161,7 +158,7 @@ | |||||||||
] | ||||||||||
}, | ||||||||||
"lint-staged": { | ||||||||||
"**/*.{ts,js}": [ | ||||||||||
"**/*.{tsx,ts,js,jsx}": [ | ||||||||||
"eslint --fix" | ||||||||||
], | ||||||||||
"**/*.{json,md,yml,yaml}": [ | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Remove unnecessary ESLint directive for hooks rule
The ESLint directive to disable
react-hooks/rules-of-hooks
appears to be unnecessary because:Formio.use()
is a regular method call, not a React HookFormio.use(tailwind)
pattern is used in other files without requiring the ESLint directiveYou can safely remove the
// eslint-disable-next-line react-hooks/rules-of-hooks
comment.🔗 Analysis chain
Verify the necessity of disabling the hooks rule.
The ESLint directive to disable
react-hooks/rules-of-hooks
has been added. However, sinceFormio.use()
is not a React Hook, this directive might be unnecessary. Consider removing it if the ESLint warning is no longer present with the new ESLint configuration.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 120
Script:
Length of output: 564
Script:
Length of output: 636