-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Bug?]: yarn rw lint
fails using local eslint config with typed linting rules after RW 8 upgrade
#11735
Comments
yarn rw lint
fails with customizedyarn rw lint
fails using local eslint config with typed linting rules
yarn rw lint
fails using local eslint config with typed linting rules yarn rw lint
fails using local eslint config with typed linting rules after RW 8 upgrade
So i found a different workaround to get rid of the error
… without changing the parser for the project. Any So, when upgrading to v8, any {
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": ["@redwoodjs/eslint-config"],
+ "overrides": [
+ {
+ "files": ["*.ts", "*.tsx"],
+ "rules": {
+ "@typescript-eslint/consistent-type-imports": [
+ "error", {
+ "prefer": "type-imports"
+ }
+ ]
+ }
+ }
+ ],
"root": true,
"rules": {
"sort-imports": [
"error",
{
"ignoreDeclarationSort": true,
"allowSeparatedGroups": true
}
],
- "@typescript-eslint/consistent-type-imports": [
- "error",
- {
- "prefer": "type-imports"
- }
- ]
}
} While i'm happy to have found a workaround that works w/o altering the main parser, i still would have loved to understand what exactly is the root-cause of this, i suspect it's some change in v7 or v8 that just is not obvious to me. In order to close this ticket, i'm wondering if there's anything that can be done to the eslint-config to make it work without any adjustments? If not, and this adjustment simply is a necessity now, i believe we should include it in the upgrade guide and also the eslint-config README.md |
I also wish I understood the eslint stuff better. There's the RW framework vs RW project split. There's the new "flat config" stuff. There's typed linting. I just don't have a good understanding of the full picture right now 🙁 |
I just added the rule So i started to investigate – this issue in the typescript repo (which had a fix for it shipped with v8.4.0) says the error shouldn't be thrown in the first place for a similar rule than the offending I will check if this maybe is fixed with #11878 and if it isn't will probably open an issue over at https://github.com/typescript-eslint/typescript-eslint as helpful information on the error at hand is still hard to come by. |
I did another test against Occurred while linting ./web/src/i18n.js So getting rid of the last *.js file in the web side also makes the error go away. Strangely, i still have many *.js files in the api side, which it does lint correctly, but doesn't throw the error. So it must probably be something in |
What's not working?
We recently added an
eslintrc.json
to our project as described here. We did that b/c we like to have our named imports sorted (sort-imports
) and enforce types to be explicitly imported as such (@typescript-eslint/consistent-type-imports
).Now after the upgrade from RW 7 to 8.4.1 running
yarn rw lint
throws:I tried all kinds of settings for
parserOptions
mentioned in the typed linting docs to no avail. However, addingto our
.eslintrc.json
makes the error go away – however i'm not sure this is really intended by@redwoodjs/eslint-config
, as i would assume the Redwood team wants to employ@babel/eslint-parser
here for a good reason, which probably was brought in via either #10911 or #11235.How do we reproduce the bug?
Have any custom eslint config (js/cjs/json/whathaveyou) in your project that includes the rule
@typescript-eslint/consistent-type-imports
, for example, our.eslintrc.json
looks as follows:What's your environment? (If it applies)
Are you interested in working on this?
The text was updated successfully, but these errors were encountered: