-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Can't deactivate "import/no-extraneous-dependencies" (for devDependencies) for .ts files #1384
Comments
Re "I put everything into dev-dependencies because it will all be transpiled by webpack" - anything that is conceptually a runtime dependency belongs in production deps. Use of webpack is an implementation detail, and doesn't make those things dev deps. That said, it should certainly be set to |
Re: devDendencies vs dependencies - from what I understand, runtime dependencies are dependencies that have to be present in ./node_modules while running the app. But here, everything is already bundled into the distribution at development time, so the app could (theoretically, because it's not a node app) be executed with an empty ./node_modules folder. There's a fun thread about it over in the webpack issues (webpack/webpack#520) that leans strongly towards devDependencies, and prominent frontend libraries like React (https://github.com/facebook/react/blob/master/package.json) and Vue (https://github.com/vuejs/vue/blob/dev/package.json) use that pattern too. Either way, this is a pretty philosophical discussion considering that the app will never run as a node app. Re:
That didn't change anything. At this point I'm rather convinced that it's a problem with .ts files as opposed to e.g. .js files. As I said in my opening post, renaming a .ts file to .js makes it behave correctly, i.e. the error vanishes (with the configuration file above) or turns into a warning if I set It only and persistently stays an error as long as the file has the .ts extension. |
You're only describing code that runs in node - |
Yes, that's what I meant by root true :-/ I'm not familiar with |
I'm not really sure about anything, especially since this is my first time using ESLint for Typescript. For that reason, I'm just using this configuration file https://github.com/iamturns/create-exposed-app/blob/master/.eslintrc.js to start out with. Can you clarify what you mean by "setting up all the right typescript extensions"? |
The import plugin has to be told to look at https://unpkg.com/eslint-config-airbnb-typescript@4.0.0/index.js looks like it is doing that, though. |
Turns out I was using an extremely outdated eslint-config-airbnb-typescript (among other things). Upgrading my package.json to current versions (via Thanks a lot for your quick answers, and sorry I wasted your time there! |
I continue to get errors for "import/no-extraneous-dependencies" despite doing my best to deactivate it in my .eslintrc.js. I've tried all variations of deactivating it I could think of for well over an hour now, and all of them are ignored. I can't even set it to "warn" instead of "error".
Things that work:
// eslint-disable-next-line import/no-extraneous-dependencies
works fine./* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
works fine too, but putting the same into .eslintrc.js produces no effect. It's like something adds the rule after my .eslintrc.js rules.Here is an example of the error I get:
'pixi.js' should be listed in the project's dependencies, not devDependencies.eslint(import/no-extraneous-dependencies)
Here is my .eslintrc.js:
The text was updated successfully, but these errors were encountered: