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

Upgrade eslint-config-preact to ESLint v9 #33

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

brianrodri
Copy link

@brianrodri brianrodri commented Jan 21, 2025

Fixes #28

Hey folks, I've been working on this for a while and have finally gotten something worth sharing.

Usage Notes

import eslintConfigPreact from "eslint-config-preact";

// ...

/** @type {require("eslint").Linter.Config[]} */
export default [
    ...eslintConfigPreact.flat,

    // ...
];

Important Notes

Changes to exported type

index.js's export type is still LegacyConfig, as before, but it now includes an additional property: flat. This property holds the "modern" Config for users to put in their ESLint >= 9.0.0 configuration files.

Consequently, there will now be a maintenance burden in supporting both LegacyConfig (< 9.0.0) and Config (>= 9.0.0) for future updates.

Added dependencies:

Updated dependencies:

Added devDependencies:

Updated devDependencies:

Removed devDependencies:

Testing Notes

Miscellaneous Notes

  • The ESLint configuration in package.json has been migrated to ./eslint.config.js
  • The ./test/fixtures/.eslintrc.json test file has been replaced by ./test/eslint.config.js, and the unit test now references it via configOverrideFile.

@rschristian
Copy link
Member

Sorry, but dropping support for older versions I think is a no-go, as is switching to "type": "module".

This is a massive diff that I don't think is really called for or necessary here?

@brianrodri brianrodri force-pushed the eslint-v9 branch 2 times, most recently from d7b9069 to 5cfbef6 Compare January 22, 2025 18:34
@brianrodri
Copy link
Author

brianrodri commented Jan 22, 2025

OK, I've made changes so that old versions are supported AND "type": "module" is removed.

index.js returns the LegacyConfig as before, but now with an additional property: flat
This property holds the "modern" Config for users to put in their ESLint >= 9.0.0 configuration files.

Consequently, there will now be a maintenance burden in supporting both LegacyConfig (< 9.0.0) and Config (>= 9.0.0) for future updates.

To help with this, I've extracted common options into standalone objects. However, since not everything can be shared, there will still be some burden in confirming feature parity. For now, only V9's flat config is being tested by the unit tests. I haven't seen a way to unit test both legacy and modern configs, but I can try looking into that if you decide it's a blocker for merging.

Let me know if there's anything else I can explain/provide, thanks!

Copy link
Member

@rschristian rschristian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind providing some documentation as for why this all is necessary? It's a huge diff, touching tons of deps that don't seem to be required for bumping a peer dependency.

As for the "maintenance burden", no problem, don't worry about it. It's not exactly a high-traffic repo.

package.json Outdated Show resolved Hide resolved
@brianrodri
Copy link
Author

brianrodri commented Jan 23, 2025

Sure! I initially used npx npm-check-updates -u to do the updates, but I can scope it to the required packages.

Also, to be clear, these changes aren't just bumping a peer dependency; it upgrades the config itself to v9.

Added dependencies:

Updated dependencies:

Added devDependencies:

Updated devDependencies:

Removed devDependencies:

@brianrodri brianrodri changed the title Migrate config to ESLint v9 Upgrade eslint-config-preact to ESLint v9 Jan 26, 2025
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.

Support for ESLint v9?
2 participants