-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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(eslint): migrate to flat config and simplify #2912
base: main
Are you sure you want to change the base?
chore(eslint): migrate to flat config and simplify #2912
Conversation
… eslint.config.js
…ate script for eslint.config.js
…js to eslint.config.js
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Open in Stackblitz • demo • starter
commit: |
This is nice! I wasn't sure when all plugins are ready. They weren't when I last tried. |
@dai-shi i checked all plugins. if it's not i will keep my eyes on this, i migrated with no additions and removals |
Do you mean to keep using eslint 8? |
@dbritto-dev IMHO, Tools like |
I wouldn't put much effort on eslint is pretty slow and now are better options, apart from that biome is ready for production. This change just make it more complex to maintain and add another dependency to make it work I do not think that worth it. |
Our ecosystem still depends on eslint plugins. Maybe, eslint-plugin-react-compiler is one of the biggest hurdles. Let's stick with eslint. |
@dai-shi do we need this change to support |
yeah |
react-compiler is already included. eslint 8 will no longer be supported. This change is what I wanted to do when eslint 9 was released, but at that point something wasn't ready. |
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.
Let's do some practices that I learned with jotaijs/jotai-valtio#11.
The primary goal is to simplify configs and prefer defaults.
- Use
"lint": "eslint ."
in package.json and move linter configs to config file - Remove
eslint-config-prettier
package - Can we use
eslint-import-resolver-typescript
package to simplify eslint.config.js? - Can we use
eslint.config.mjs
and use ESM syntax? - Let's remove
globals
packages. The added commend inexamples/demo/src/utils/copy-to-clipboard.js
seems good. - Remove
examples/*/eslint.config.*
and eslint packages fromexamples/*/package.json
- No need to use
eslint-plugin-prettier
package, as we don't configure stylistic rules. - Remove some custom rules that don't cause "errors" in the current zustand/jotai/valtio code. (we keep import order rules.)
@dai-shi I'll do it step by step 🙋🏻♂️ |
@dai-shi I gonna do this ASAP |
… ensure clearer usage.
@dai-shi Done! |
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.
Thanks for working on it! Looks much better.
@dai-shi I think we're ready to merge! |
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.
Other than the comment, it looks good to me. Thanks so much for your continued effort!
(I still wonder if we should have eslint for demo, but let's put it aside for this one.)
Can you update Jotai and Valtio PRs too?
"eslint": "eslint --no-eslintrc --c .eslintrc.json --fix '*.{js,ts}' '{src,tests}/**/*.{ts,tsx}'", | ||
"eslint": "eslint '*.{js,mjs,ts}' '{src,tests}/**/*.{ts,tsx}' --fix ", | ||
"test": "pnpm run '/^test:.*/'", | ||
"test:format": "prettier '*.{js,json,md}' '{examples,src,tests,docs}/**/*.{js,jsx,ts,tsx,md,mdx}' --list-different", | ||
"test:types": "tsc --noEmit", | ||
"test:lint": "eslint --no-eslintrc --c .eslintrc.json '*.{js,ts}' '{src,tests}/**/*.{ts,tsx}'", | ||
"test:lint": "eslint '*.{js,mjs,ts}' '{src,tests}/**/*.{ts,tsx}'", |
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.
I would like "eslint ."
here too, and also for --fix
above.
Summary
.eslintrc
toeslint.config.js
Check List
pnpm run prettier
for formatting code and docs