crana
crana copied to clipboard
Dynamically adjust .eslintrc path in VSCode settings file
In order that VSCode can locate the ESLint config, a settings file (.vscode/settings.json) is created in the root of the project where the path to the ESLint config is specified. The absolute path of the ESLint file depends on the user, so if someone else than the creator of the project opened it, VSCode will not find the file.
The path should be dynamically changed depending on the path the Crana package is located.
An alternative solution would be to place the .eslintrc file directly in the project itself, but that would break the "encapsulate everything" principle of Crana.
Currently, the seetings.json file looks something like this:
{
"eslint.options": { "configFile": "C:/Users/_scriptify_/DEV/crana-no-git/.eslintrc" }
}