Can't add typescript-eslint as it is a dependency of eslint-config-next?
Unanswered
Blue-gray Gnatcatcher posted this in #help-forum
Blue-gray GnatcatcherOP
Hello all, I'm trying to add more Typescript linting with typescript-eslint, but following the instructions in their official documentation (https://typescript-eslint.io/getting-started/legacy-eslint-setup) results in an
npm error because eslint-config-next also depends on typescript-eslint. I'm guessing there is some sort of way to enable an extended ruleset without having to install typescript-eslint plugins twice, however the NextJS docs don't really specify how to do that. Any ideas?16 Replies
Blue-gray GnatcatcherOP
In fact, the default ruleset provided by NextJS seems to be broken with Typescript. For example, the parser seems to think the project is plain JS instead of TS, and flags enums as "unused variables" with the
no-unused-vars rule.Blue-gray GnatcatcherOP
Bump
Mugimaki Flycatcher
bump
Having lots of problems with
This issue is solved when I extend
also #Hey, having strange issue with eslint/prettier setup can't extend
I am confused 😕
eslint in next.js for example as mentioned above eslint ignores typescriptThis issue is solved when I extend
typescript-eslint but it breaks the build and linting processesalso #Hey, having strange issue with eslint/prettier setup can't extend
/recommended for prettier etc...I am confused 😕
@Blue-gray Gnatcatcher did you manage to solve this issue?
Blue-gray GnatcatcherOP
bump
@Mugimaki Flycatcher <@177745933109297152> did you manage to solve this issue?
Blue-gray GnatcatcherOP
unfortunately not, still trying to figure out how to import it
Blue-gray GnatcatcherOP
bump
Mugimaki Flycatcher
Bump
Blue-gray GnatcatcherOP
Bump
Mugimaki Flycatcher
bump
Blue-gray GnatcatcherOP
Bump
Mugimaki Flycatcher
bump
Blue-gray GnatcatcherOP
bump
@Blue-gray Gnatcatcher Hello all, I'm trying to add more Typescript linting with typescript-eslint, but following the instructions in their official documentation (https://typescript-eslint.io/getting-started/legacy-eslint-setup) results in an `npm` error because `eslint-config-next` also depends on `typescript-eslint`. I'm guessing there is some sort of way to enable an extended ruleset without having to install `typescript-eslint` plugins twice, however the NextJS docs don't really specify how to do that. Any ideas?
yeah
next-config-next already sets up TS compatibility with eslint and it works out of the box. if you are having issues with it, do you mind sharing a reproduction of the problem so I can give it a look?@Rafael Almeida yeah `next-config-next` already sets up TS compatibility with eslint and it works out of the box. if you are having issues with it, do you mind sharing a reproduction of the problem so I can give it a look?
Blue-gray GnatcatcherOP
Sure! Our team is working with this repo: https://github.com/Purdue-CS307-tsundoku/tsundoku
It's a monorepo -- you'll find the NextJS project within the
I've been trying to convert the config to use the new flat config, but that's a separate concern and seems like eslint-config-next doesn't support it yet. The main problem is even with the old JSON config, I can't seem to enable any of the typescript-eslint rules. Without them the default linting rules won't even catch things like floating promises.
Trying to install typescript-eslint fails because eslint-config-next already depends on it, but when I try and enable any of the rulesets or plugins I get errors about them not being found.
It's a monorepo -- you'll find the NextJS project within the
backend/ folder.I've been trying to convert the config to use the new flat config, but that's a separate concern and seems like eslint-config-next doesn't support it yet. The main problem is even with the old JSON config, I can't seem to enable any of the typescript-eslint rules. Without them the default linting rules won't even catch things like floating promises.
Trying to install typescript-eslint fails because eslint-config-next already depends on it, but when I try and enable any of the rulesets or plugins I get errors about them not being found.