tyspice
tyspice

Reputation: 63

node/no-extraneous-require "resolvePaths" option doesn't seem to work with relative paths in VSCode

I'm currently running eslint ^8.13.0 and eslint-plugin-node ^11.1.0. My repository has a package.json file in the root directory as well as an additional package.json file in a child directory.

I'm currently seeing a node/no-extraneous-require error on several packages. These packages are listed dependencies in the root package.json however the file that's importing them is in the directory that contains the second package.json file.

This issue seems like it would be easily fixed by adding the following to .eslintrc.json (which is also located in the root directory).

    "rules": {
        "node/no-extraneous-require": ["error", {
            "resolvePaths": ["./node_modules"],
        }]
    }

The above, however, does not resolve the issue. I'm using VSCode and wondering if anyone has experienced a similar issue using relative paths in an eslintrc.json file and/or if the path itself seems to be incorrect in some way.

Paths I've tried: "." "./" "./node_modules" "./node_modules/"

Upvotes: 0

Views: 22

Answers (0)

Related Questions