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

feat(eslint-plugin): support ESLint v9 (and v8) #4371

Merged
merged 5 commits into from
Jun 5, 2024

Conversation

timdeschryver
Copy link
Member

@timdeschryver timdeschryver commented Jun 1, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[x] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Closes #4365

What is the new behavior?

Does this PR introduce a breaking change?

[x] Yes
[ ] No
BREAKING CHANGE:

The configuration of several rules are changed, making the rules more strict (warnings became errors).
Configuration names are renamed to be more clear and follow the naming convention of other plugins.
For an overview of the configuration rules and available configurations see https://ngrx.io/guide/eslint-plugin.

Other information

After this PR, #4299 can be picked up.
The docs still need to be updated, which is something I plan to do in the next days/weeks.

Some highlights:

Public:

  • Supports ESLint v9 flat config as opt-in (available through @ngrx/eslint-plugin/v9)
const eslint = require("@eslint/js");
const tseslint = require("typescript-eslint");
const angular = require("angular-eslint");
// 👇
const ngrx = require("@ngrx/eslint-plugin/v9");


module.exports = tseslint.config(
  {
    files: ["**/*.ts"],
    extends: [
      eslint.configs.recommended,
      ...tseslint.configs.recommended,
      ...angular.configs.tsRecommended,
      // 👇
      ...ngrx.configs.recommended,
    ],
    processor: angular.processInlineTemplates,
);
  • Still support ESLint v8 syntax
  • Remove requiring-type-checking configurations, instead these are replaced with recommended (without type checking and thus faster) and all (including a few type requiring rules) configurations. This makes the configuration simpler.

Internal:

  • migrate @typescript-eslint/experimental-utils to @typescript-eslint/utils
  • remove eslint-etc: this library has become outdated (and some types were conflicting due to this)
  • update @typescript-eslint
  • reflect changes to types/config in generation scripts (for docs)

It works 🎉
Left: ESLint v9
Right: ESLint v8

image

Copy link

netlify bot commented Jun 1, 2024

Deploy Preview for ngrx-io canceled.

Name Link
🔨 Latest commit 72d12fc
🔍 Latest deploy log https://app.netlify.com/sites/ngrx-io/deploys/6660754b030a2f0008872acc

@timdeschryver timdeschryver force-pushed the upgrade-ts-eslint branch 8 times, most recently from 8eb154c to 9f6a635 Compare June 2, 2024 07:52
Copy link
Member

@brandonroberts brandonroberts left a comment

Choose a reason for hiding this comment

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

👏

Copy link
Member

@markostanimirovic markostanimirovic left a comment

Choose a reason for hiding this comment

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

🚀

@brandonroberts brandonroberts merged commit e8d9ffa into main Jun 5, 2024
5 checks passed
@brandonroberts brandonroberts deleted the upgrade-ts-eslint branch June 5, 2024 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for ESLint v9
3 participants