diff --git a/packages/schematics/src/application/files/__directory__/tslint.json b/packages/schematics/src/application/files/__directory__/tslint.json index 89228ccd1f..684918fdb4 100644 --- a/packages/schematics/src/application/files/__directory__/tslint.json +++ b/packages/schematics/src/application/files/__directory__/tslint.json @@ -67,24 +67,12 @@ "no-string-literal": false, "no-string-throw": true, "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, "no-unnecessary-initializer": true, "no-unused-expression": true, "no-use-before-declare": true, "no-var-keyword": true, "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-whitespace" - ], "prefer-const": true, - "quotemark": [ - true, - "single" - ], "radix": true, "semicolon": [ true, @@ -94,27 +82,9 @@ true, "allow-null-check" ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], "typeof-compare": true, "unified-signatures": true, "variable-name": false, - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ], "directive-selector": [ true, "attribute", diff --git a/packages/schematics/src/workspace/index.ts b/packages/schematics/src/workspace/index.ts index 2462d8be19..1d1916efc8 100644 --- a/packages/schematics/src/workspace/index.ts +++ b/packages/schematics/src/workspace/index.ts @@ -79,7 +79,6 @@ function updateAngularCLIJson(options: Schema) { function updateTsConfigsJson(options: Schema) { return (host: Tree) => { - const angularCliJson = JSON.parse(host.read('.angular-cli.json')!.toString('utf-8')); const npmScope = options && options.npmScope ? options.npmScope : options.name; updateJsonFile('tsconfig.json', (json) => setUpCompilerOptions(json, npmScope)); @@ -110,6 +109,20 @@ function updateTsConfigsJson(options: Schema) { }; } +function updateTsLintJson(options: Schema) { + return (host: Tree) => { + const npmScope = options && options.npmScope ? options.npmScope : options.name; + + updateJsonFile('tslint.json', (json) => { + ['no-trailing-whitespace', 'one-line', 'quotemark', 'typedef-whitespace', 'whitespace'].forEach(key => { + json[key] = undefined; + }); + json['nx-enforce-module-boundaries'] = [true, {'npmScope': npmScope, 'lazyLoad': []}]; + }); + return host; + }; +} + function updateProtractorConf() { return (host: Tree) => { if (!host.exists('protractor.conf.js')) { @@ -168,6 +181,7 @@ export default function(options: Schema): Rule { moveFiles(options), branchAndMerge(chain([ mergeWith(apply(url('./files'), [])), ])), - updatePackageJson(), updateAngularCLIJson(options), updateTsConfigsJson(options), updateProtractorConf() + updatePackageJson(), updateAngularCLIJson(options), updateTsConfigsJson(options), updateProtractorConf(), + updateTsLintJson(options) ]); }