fix(@angular-devkit/build-angular): add tslint as an optional peer dependency

tslint is currently used by the tslint builder within this package but is not represented in the dependencies. The can lead to accidental version mismatches as well as package manager hoisting problems due to the package manager not knowing the full dependency set of the package.
This commit is contained in:
Charles Lyding 2020-09-25 16:15:45 -04:00 committed by Alan Agius
parent 7fed4cf7f7
commit 1873f2d28f
2 changed files with 6 additions and 2 deletions

View File

@ -84,6 +84,7 @@
"karma": "^5.2.0",
"ng-packagr": "^10.0.0",
"protractor": "^7.0.0",
"tslint": "^6.1.0",
"typescript": ">=3.9 < 4.1"
},
"peerDependenciesMeta": {
@ -98,6 +99,9 @@
},
"protractor": {
"optional": true
},
"tslint": {
"optional": true
}
}
}

View File

@ -11,7 +11,7 @@ import { readFileSync } from 'fs';
import * as glob from 'glob';
import { Minimatch } from 'minimatch';
import * as path from 'path';
import * as tslint from 'tslint'; // tslint:disable-line:no-implicit-dependencies
import * as tslint from 'tslint';
import { Program } from 'typescript';
import { stripBom } from '../utils/strip-bom';
import { Schema as RealTslintBuilderOptions } from './schema';
@ -25,7 +25,7 @@ interface LintResult extends tslint.LintResult {
async function _loadTslint() {
let tslint;
try {
tslint = await import('tslint'); // tslint:disable-line:no-implicit-dependencies
tslint = await import('tslint');
} catch {
throw new Error('Unable to find TSLint. Ensure TSLint is installed.');
}