Skip to content
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 .eslintrc to eslint.config.js #2912

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

sukvvon
Copy link
Contributor

@sukvvon sukvvon commented Dec 18, 2024

Summary

  • mirgate legacy .eslintrc style to eslint.config.js

Check List

  • pnpm run prettier for formatting code and docs

Copy link

vercel bot commented Dec 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
zustand-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 25, 2024 1:08am

Copy link

codesandbox-ci bot commented Dec 18, 2024

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.

Copy link

pkg-pr-new bot commented Dec 18, 2024

Open in Stackblitzdemo

npm i https://pkg.pr.new/zustand@2912

commit: bb02a1b

@dai-shi
Copy link
Member

dai-shi commented Dec 18, 2024

This is nice! I wasn't sure when all plugins are ready. They weren't when I last tried.
Are you sure all configs are migrated? No additions or removals?

@sukvvon
Copy link
Contributor Author

sukvvon commented Dec 18, 2024

This is nice! I wasn't sure when all plugins are ready. They weren't when I last tried. Are you sure all configs are migrated? No additions or removals?

@dai-shi i checked all plugins. if it's not i will keep my eyes on this, i migrated with no additions and removals

@dbritto-dev
Copy link
Collaborator

dbritto-dev commented Dec 18, 2024

@dai-shi @sukvvon IMHO, I prefer no config or simple config instead of complex config. In this case I'll keep the current config. We can use something else like OXC lint or Biome and simplify the config.

@dai-shi
Copy link
Member

dai-shi commented Dec 18, 2024

I'll keep the current config.

Do you mean to keep using eslint 8?

@sukvvon
Copy link
Contributor Author

sukvvon commented Dec 18, 2024

@dbritto-dev IMHO, Tools like oxc and biome could be considered as alternatives, but since they are still under development, it might be too early to use them. I believe eslint is still more practical at this point, with abundant references, widespread adoption, and ease of application. For now, as we are currently using eslint, it would be better to focus on supporting eslint and consider simplifying later.

@dbritto-dev
Copy link
Collaborator

dbritto-dev commented Dec 18, 2024

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.

@dai-shi
Copy link
Member

dai-shi commented Dec 18, 2024

Our ecosystem still depends on eslint plugins. Maybe, eslint-plugin-react-compiler is one of the biggest hurdles. Let's stick with eslint.

@dbritto-dev
Copy link
Collaborator

@dai-shi do we need this change to support react-compiler plugin?

@dbritto-dev
Copy link
Collaborator

I'll keep the current config.

Do you mean to keep using eslint 8?

yeah

@dai-shi
Copy link
Member

dai-shi commented Dec 18, 2024

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.

Copy link
Member

@dai-shi dai-shi left a 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 in examples/demo/src/utils/copy-to-clipboard.js seems good.
  • Remove examples/*/eslint.config.* and eslint packages from examples/*/package.json
  • No need to useeslint-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.)

@sukvvon
Copy link
Contributor Author

sukvvon commented Dec 23, 2024

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 in examples/demo/src/utils/copy-to-clipboard.js seems good.
  • Remove examples/*/eslint.config.* and eslint packages from examples/*/package.json
  • No need to useeslint-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 🙋🏻‍♂️

@sukvvon
Copy link
Contributor Author

sukvvon commented Dec 23, 2024

Are you suggesting that we don’t integrate ESLint and Prettier?

Yes.

I wasn't sure if we need eslint-config-prettier, but as I read the docs, recommended rules don't have stylistic rules, so I assume we don't need eslint-config-pretiter. I might be wrong, but we can disable stylistic rules selectively if we find any issues.

@dai-shi

Are you referring to the recommended configuration of eslint-plugin-prettier?

Are you suggesting removing eslint-config-prettier and keeping only eslint-plugin-prettier, or are you suggesting removing both eslint-config-prettier and eslint-plugin-prettier?

@dai-shi
Copy link
Member

dai-shi commented Dec 23, 2024

Are you referring to the recommended configuration of eslint-plugin-prettier?

Are you suggesting removing eslint-config-prettier and keeping only eslint-plugin-prettier, or are you suggesting removing both eslint-config-prettier and eslint-plugin-prettier?

Sorry for the confusion. Let's remove both eslint-config-prettier and eslint-plugin-prettier. I'm pretty sure we don't need them.

@dbritto-dev
Copy link
Collaborator

At this point biome seems a good option 😅

@dai-shi
Copy link
Member

dai-shi commented Dec 23, 2024

At this point biome seems a good option 😅

We don't use biome now whatever you say 😄 , but I'm curious how you can configure eslint-plugin-react-compiler with biome. I might use it in my other projects, if that's fairly easy.

@sukvvon
Copy link
Contributor Author

sukvvon commented Dec 23, 2024

image

I think when we remove eslint-plugin-prettier and eslint-config-prettier, tslib also remove

@sukvvon
Copy link
Contributor Author

sukvvon commented Dec 23, 2024

I will roll back to the version where it was removed, only in the eslint.config.mjs.

@sukvvon sukvvon force-pushed the chore/migrate-eslintrc-to-eslint-config branch from a7edcd4 to f8cef86 Compare December 23, 2024 14:18
@dai-shi
Copy link
Member

dai-shi commented Dec 23, 2024

tslib seems a peer dependency of @rollup/plugin-typescript, so we need to install it explicitly after removing eslint-*-prettier.

@dbritto-dev
Copy link
Collaborator

At this point biome seems a good option 😅

We don't use biome now whatever you say 😄 , but I'm curious how you can configure eslint-plugin-react-compiler with biome. I might use it in my other projects, if that's fairly easy.

@dai-shi sure, I'll create a PR for that so we can compare them (eslint vs biome)

@dai-shi
Copy link
Member

dai-shi commented Dec 23, 2024

@dbritto-dev You don't need to create a PR. I just need to see how it can be configured. Maybe one of your projects?

@dbritto-dev
Copy link
Collaborator

@dai-shi sure

@sukvvon
Copy link
Contributor Author

sukvvon commented Dec 24, 2024

  • 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 in examples/demo/src/utils/copy-to-clipboard.js seems good.
  • Remove examples/*/eslint.config.* and eslint packages from examples/*/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 think we almost done!

@sukvvon
Copy link
Contributor Author

sukvvon commented Dec 24, 2024

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 this step by step

@sukvvon
Copy link
Contributor Author

sukvvon commented Dec 25, 2024

Remove some custom rules that don't cause "errors" in the current zustand/jotai/valtio code. (we keep import order rules.)

@dai-shi I gonna do this until today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants