eslint should be listed in the project's dependencies, not devDependencies

后端 未结 2 1754
执念已碎
执念已碎 2021-01-31 07:12

Either I don\'t understand dependencies vs. devDependencies in node 100% yet or eslint is just wrong here (not capable of analyzing this correctly):

2条回答
  •  渐次进展
    2021-01-31 07:35

    Solved it with adding this to my .eslintrc:

    "import/no-extraneous-dependencies": ["error", {"devDependencies": true}]

    [no-extraneous-dependencies] Add exceptions? #422

    Based on this user's reply:

    you could set the option devDependencies: true in an .eslintrc in your test folder:

    rules: import/no-extraneous-dependencies: [error, { devDependencies: true }] Then you'll get reports of any packages referenced that are not included dependencies or devDependencies. Then you get the goodness of the rule, with no noise from the disable comments.

    I think that might work for you? This is how I would use the rule, in your case, since you have your test code separated into a test directory.

    Also this post was helpful to confirm I wasn't insane to not want some of these in my dependencies list: Sharable ESLint Config

提交回复
热议问题