В settings.json добавить правило
"eslint.workingDirectories": [{
"directory": "/path/to/directory/with/eslintrc_file",
"changeProcessCWD": true
},],
Выдержка из доки по поводу данной настройки:
"eslint.workingDirectories": [ "./client", // changeProcessCWD defaults to false { "directory": "./server", "changeProcessCWD": true } ]
In the above example,
client.js
will be evaluated fromroot
usingroot/client/.eslintrc.json
,
whileserver.js
will be evaluated fromroot/server
usingroot/server/.eslintrc.json
UsingchangeProcessCWD
causes vscode-eslint to change the current working directory of the eslint process todirectory
as well. This is often necessary if ESLint is used to validate relative import statements likeimport A from 'components/A';
which would otherwise be resolved to the workspace folder root.
Top comments (0)