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

View File

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