Skip to content

Commit

Permalink
chore: uprade eslint to v9 (#3373)
Browse files Browse the repository at this point in the history
This change is going to upgrade eslint to the current latest version of
`9.17.0` and related modules to their latest version. This is the first
part and more efforts will follow to further simplify and cleanup the
config in favor of recommended rules.
I also took the chance to move eslint related modules to the dependency
list of `@kumhq/config` (`@typescript-eslint/eslint-plugin`,
`@typescript-eslint/parser`).

- Some `@typescript-eslint` rules have been moved to `@stylistic` to
move maintenance efforts to the community (e.g. `@stylistic/indent`)
- I've started to group related configs:
- `@vue/eslint-config-typescript` enables [the essential rules for Vue
3](https://eslint.vuejs.org/rules/#priority-a-essential-error-prevention)
and [the recommended rules for
TypeScript](https://typescript-eslint.io/rules/?=recommended). So there
is no need to add `@typescript-eslint` rules separately. We are using
`flat/recommended` ruleset, which includes `base`, `essential` and
`strongly-recommended` rulesets.
  - `eslint-plugin-import` recommended rules
  - `eslint-plugin-json-schema-validator` recommended rules
- `@stylistic/eslint-plugin` recommended stylistic rules and custom
config
  - custom rules that we can revisit and decide to keep or remove them

I've compared the rulesets and although we already have most of the
rules applied, it looks like by adding the recommended rules we are more
strict.

---

I had to disable certain rules to stay in the scope of this PR. The
issues will be fixed separately. The rules are the following
- `@typescript-eslint/no-explicit-any`
- `@typescript-eslint/ban-ts-comment`
- `@typescript-eslint/no-empty-object-type`

---

Initially I wanted to move our config files over to esm, but reverted
that for now. The reason is that [`eslint.config.ts` (TypeScript) is not
fully supported
yet](https://eslint.org/docs/latest/use/configure/configuration-files#typescript-configuration-files)
and we would have to stay with `eslint.config.js`. As our config module
entry file is a `.ts`file, it can't be used for imports in a `.js` file.
Therefore I added eslint support for `.cjs` files.

Closes #2879

---------

Signed-off-by: schogges <[email protected]>
  • Loading branch information
schogges authored Jan 9, 2025
1 parent b0f698c commit ce5d67f
Show file tree
Hide file tree
Showing 32 changed files with 1,200 additions and 763 deletions.
1,340 changes: 854 additions & 486 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
},
"dependencies": {
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.4",
"@vue/eslint-config-typescript": "^13.0.0",
"@stylistic/eslint-plugin": "^2.12.1",
"@typescript-eslint/eslint-plugin": "^8.19.1",
"@typescript-eslint/parser": "^8.19.1",
"@vue/eslint-config-typescript": "^14.2.0",
"esbuild": "^0.24.2",
"eslint-config-standard": "^17.1.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-import-resolver-typescript": "^3.7.0",
"eslint-plugin-import": "^2.31.0",
Expand All @@ -33,7 +35,7 @@
"cypress": "^13.15.2",
"cypress-fail-fast": "^7.1.1",
"cypress-terminal-report": "^7.0.4",
"eslint": "^8.57.1",
"eslint": "^9",
"stylelint": "^16.10.0"
}
}
Loading

0 comments on commit ce5d67f

Please sign in to comment.