You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
Projects use this configuration in the following way:
{
"extends": [
"shared-configuration"
],
This is not an npm problem. tslint-defocus gets correctly installed in node_modules in the projects, but every time I run tslint in such project, I get the following error:
ng lint
Failed to load AAA\tslint.json: Could not find custom rule directory: ./node_modules/tslint-defocus/dist
FatalError: Failed to load AAA\tslint.json: Could not find custom rule directory: ./node_modules/tslint-defocus/dist
at new FatalError (C:\Users\matste\uptime\uptime\ui\ui-frontend\node_modules\tslint\lib\error.js:27:28)
at Object.findConfiguration (C:\Users\matste\uptime\uptime\ui\ui-frontend\node_modules\tslint\lib\configuration.js:55:15)
at lintConfigs.map (C:\Users\matste\uptime\uptime\ui\ui-frontend\node_modules\@angular\cli\tasks\lint.js:67:48)
at Array.map (<anonymous>)
I tried all options: node_modules/tslint-defocus/dist, tslint-defocus/dist.
Looking at the code of the configuration.ts, it seems that when tslint sees tslint-defocus/dist, it first try to resolve it as a node module and fails predictably (the module is called 'tslint-defocus', not 'tslint-defocus/dist'). Then it tries to resolve it as a local path, but tslint resolves it relative to where the shared configuration is installed (relativeTo !== undefined).
export function getRulesDirectories(directories?: string | string[], relativeTo?: string): string[] {
return arrayify(directories)
.map((dir) => {
if (!useAsPath(dir)) {
try {
return path.dirname(resolve.sync(dir, { basedir: relativeTo }));
} catch (err) {
// swallow error and fallback to using directory as path
}
}
const absolutePath = relativeTo === undefined ? path.resolve(dir) : path.resolve(relativeTo, dir);
if (absolutePath !== undefined) {
if (!fs.existsSync(absolutePath)) {
throw new FatalError(`Could not find custom rule directory: ${dir}`);
}
}
return absolutePath;
});
}
In my opinion, tslint should also try local path (ignoring relativeTo), when the above options fail.
The text was updated successfully, but these errors were encountered:
Bug Report
I have a company-wide tslint configuration which is used by various projects via
"extends"
configuration.I don't seem to be able to configure
tslint-defocus
to be included in the shared configuration.The shared configuration:
Projects use this configuration in the following way:
This is not an npm problem.
tslint-defocus
gets correctly installed in node_modules in the projects, but every time I run tslint in such project, I get the following error:I tried all options:
node_modules/tslint-defocus/dist
,tslint-defocus/dist
.Looking at the code of the configuration.ts, it seems that when tslint sees
tslint-defocus/dist
, it first try to resolve it as a node module and fails predictably (the module is called 'tslint-defocus', not 'tslint-defocus/dist'). Then it tries to resolve it as a local path, but tslint resolves it relative to where the shared configuration is installed (relativeTo !== undefined).In my opinion, tslint should also try local path (ignoring relativeTo), when the above options fail.
The text was updated successfully, but these errors were encountered: