I have two projects that share common files from the common folder.
Now, I am trying to setup eslint so I can lint both the project folder and the common folder.
Folder structure is like this:
MyProjectFolder
.eslintrc.js
src
CommonFolder
src
I am trying to add an "override: [ files: ["src/**/*.js", "../CommonFolder/src/**/*.js"] }]" to eslint with relative path, but eslint is telling me that it is an invalid override path.
So, does anyone know how I can add CommonFolder into .eslintrc.js file?
If using VS-Code, you can add both directories to the ESLint working directory settings in the VS-Code Workspace Extensions settings.
cmd + shift + p / ctrl + shift + p
type workspace setting!
Select ESLint from the Extensions menu.
Look for the working directory configuration and open it in JSON format.
Include a directory path.
{
"eslint.workingDirectories": [
"path1/",
"path2/"
]
}
you cant visit this link https://medium.com/devityoself/monorepo-eslint-vscode-6f5982c8404d
I hope this is helpful.
The .eslintrc* file should work as expected on its own, but if you're using VS Code, it may not behave. The eslint.workingDirectories setting is what you probably want.
Just adding the folder path may not work. Consider using mode:
"eslint.workingDirectories": [{ "mode": "auto" }]
According to the docs: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint#settings-options
[{ "mode": "auto" }](@since 2.0.0): instructs ESLint to infer a working directory based on the location of package.json, .eslintignore and .eslintrc* files. This might work in many cases but can lead to unexpected results as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With