From d202480a1707be6575b2c8cf0383cfe6db44413c Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Fri, 10 Aug 2018 21:28:28 -0400 Subject: [PATCH] build: update/cleanup tslint rules & fix errors --- .../angular/cli/models/architect-command.ts | 3 +- packages/angular/cli/models/json-schema.ts | 19 +++++----- .../build_angular/src/dev-server/index.ts | 7 ++-- packages/angular_devkit/core/node/host.ts | 4 +-- .../angular_devkit/core/node/host_spec.ts | 2 +- .../core/src/json/schema/visitor_spec.ts | 2 +- .../core/src/virtual-fs/host/alias.ts | 2 +- .../core/src/virtual-fs/host/memory_spec.ts | 2 +- .../core/src/virtual-fs/host/sync.ts | 2 +- .../schematics/src/engine/schematic_spec.ts | 2 +- .../angular_devkit/schematics/src/index.ts | 3 +- .../schematics/src/rules/base_spec.ts | 2 +- .../schematics/src/rules/call_spec.ts | 2 +- .../schematics/src/rules/move_spec.ts | 2 +- .../schematics/src/rules/rename_spec.ts | 2 +- .../schematics/src/tree/common_spec.ts | 2 +- .../schematics/src/tree/filesystem_spec.ts | 2 +- .../schematics/src/tree/interface.ts | 8 ++--- .../schematics/src/tree/virtual_spec.ts | 2 +- .../webpack/src/angular_compiler_plugin.ts | 2 +- .../schematics/angular/app-shell/index.ts | 6 ++-- packages/schematics/angular/e2e/index.ts | 3 +- .../angular/migrations/update-6/index.ts | 2 +- .../schematics/angular/universal/index.ts | 4 +-- .../schematics/angular/utility/ast-utils.ts | 2 +- .../angular/utility/ng-ast-utils.ts | 2 +- packages/schematics/update/update/index.ts | 2 +- rules/nonNullOperatorRule.ts | 36 ------------------- scripts/release.ts | 3 +- tslint.json | 10 ++++-- 30 files changed, 55 insertions(+), 87 deletions(-) delete mode 100644 rules/nonNullOperatorRule.ts diff --git a/packages/angular/cli/models/architect-command.ts b/packages/angular/cli/models/architect-command.ts index 4e0ad8db0a..aacacfe9a5 100644 --- a/packages/angular/cli/models/architect-command.ts +++ b/packages/angular/cli/models/architect-command.ts @@ -20,8 +20,7 @@ import { tags, } from '@angular-devkit/core'; import { NodeJsSyncHost, createConsoleLogger } from '@angular-devkit/core/node'; -import { of } from 'rxjs'; -import { from } from 'rxjs'; +import { from, of } from 'rxjs'; import { concatMap, map, tap, toArray } from 'rxjs/operators'; import { Command, Option } from './command'; import { WorkspaceLoader } from './workspace-loader'; diff --git a/packages/angular/cli/models/json-schema.ts b/packages/angular/cli/models/json-schema.ts index 08ceb80b19..1dcb8aee16 100644 --- a/packages/angular/cli/models/json-schema.ts +++ b/packages/angular/cli/models/json-schema.ts @@ -16,17 +16,20 @@ export async function convertSchemaToOptions(schema: string): Promise } function getOptions(schemaText: string, onlyRootProperties = true): Promise { - // TODO: refactor promise to an observable then use `.toPromise()` - return new Promise((resolve, reject) => { + // TODO: Use devkit core's visitJsonSchema + return new Promise((resolve) => { const fullSchema = parseJson(schemaText); + if (!isJsonObject(fullSchema)) { + return Promise.resolve([]); + } const traverseOptions = {}; const options: Option[] = []; function postCallback(schema: JsonObject, jsonPointer: string, - rootSchema: string, - parentJsonPointer: string, + _rootSchema: string, + _parentJsonPointer: string, parentKeyword: string, - parentSchema: string, + _parentSchema: string, property: string) { if (parentKeyword === 'properties') { let includeOption = true; @@ -43,7 +46,7 @@ function getOptions(schemaText: string, onlyRootProperties = true): Promise schema.$default; + $default = schema.$default as OptionSmartDefault; } let required = false; if (typeof schema.required === 'boolean') { @@ -51,7 +54,7 @@ function getOptions(schemaText: string, onlyRootProperties = true): Promise schema.aliases; + aliases = schema.aliases as string[]; } let format: string | undefined = undefined; if (typeof schema.format === 'string') { @@ -86,7 +89,7 @@ function getOptions(schemaText: string, onlyRootProperties = true): Promise fullSchema, traverseOptions, callbacks); + jsonSchemaTraverse(fullSchema, traverseOptions, callbacks); }); } diff --git a/packages/angular_devkit/build_angular/src/dev-server/index.ts b/packages/angular_devkit/build_angular/src/dev-server/index.ts index 5451d11725..fe6fc802d6 100644 --- a/packages/angular_devkit/build_angular/src/dev-server/index.ts +++ b/packages/angular_devkit/build_angular/src/dev-server/index.ts @@ -14,8 +14,7 @@ import { } from '@angular-devkit/architect'; import { WebpackDevServerBuilder } from '@angular-devkit/build-webpack'; import { Path, getSystemPath, resolve, tags, virtualFs } from '@angular-devkit/core'; -import { existsSync, readFileSync } from 'fs'; -import * as fs from 'fs'; +import { Stats, existsSync, readFileSync } from 'fs'; import * as path from 'path'; import { Observable, throwError } from 'rxjs'; import { concatMap, map, tap } from 'rxjs/operators'; @@ -69,7 +68,7 @@ export class DevServerBuilder implements Builder { const options = builderConfig.options; const root = this.context.workspace.root; const projectRoot = resolve(root, builderConfig.root); - const host = new virtualFs.AliasHost(this.context.host as virtualFs.Host); + const host = new virtualFs.AliasHost(this.context.host as virtualFs.Host); const webpackDevServerBuilder = new WebpackDevServerBuilder({ ...this.context, host }); let browserOptions: BrowserBuilderSchema; let first = true; @@ -175,7 +174,7 @@ export class DevServerBuilder implements Builder { buildWebpackConfig( root: Path, projectRoot: Path, - host: virtualFs.Host, + host: virtualFs.Host, browserOptions: BrowserBuilderSchema, ) { const browserBuilder = new BrowserBuilder(this.context); diff --git a/packages/angular_devkit/core/node/host.ts b/packages/angular_devkit/core/node/host.ts index fd219330c5..aeec54bfff 100644 --- a/packages/angular_devkit/core/node/host.ts +++ b/packages/angular_devkit/core/node/host.ts @@ -336,11 +336,11 @@ export class NodeJsSyncHost implements virtualFs.Host { } isDirectory(path: Path): Observable { - // tslint:disable-next-line:non-null-operator + // tslint:disable-next-line:no-non-null-assertion return this.stat(path) !.pipe(map(stat => stat.isDirectory())); } isFile(path: Path): Observable { - // tslint:disable-next-line:non-null-operator + // tslint:disable-next-line:no-non-null-assertion return this.stat(path) !.pipe(map(stat => stat.isFile())); } diff --git a/packages/angular_devkit/core/node/host_spec.ts b/packages/angular_devkit/core/node/host_spec.ts index 79a02d2165..1b55218d64 100644 --- a/packages/angular_devkit/core/node/host_spec.ts +++ b/packages/angular_devkit/core/node/host_spec.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ // tslint:disable:no-any -// tslint:disable:non-null-operator +// tslint:disable:no-non-null-assertion // tslint:disable:no-implicit-dependencies import { normalize, virtualFs } from '@angular-devkit/core'; import { NodeJsAsyncHost, NodeJsSyncHost } from '@angular-devkit/core/node'; diff --git a/packages/angular_devkit/core/src/json/schema/visitor_spec.ts b/packages/angular_devkit/core/src/json/schema/visitor_spec.ts index 9a9ca8289f..e938ccd562 100644 --- a/packages/angular_devkit/core/src/json/schema/visitor_spec.ts +++ b/packages/angular_devkit/core/src/json/schema/visitor_spec.ts @@ -28,7 +28,7 @@ function syncObs(obs: Observable): T { throw new Error('Async observable.'); } - return value !; // tslint:disable-line:non-null-operator + return value !; // tslint:disable-line:no-non-null-assertion } diff --git a/packages/angular_devkit/core/src/virtual-fs/host/alias.ts b/packages/angular_devkit/core/src/virtual-fs/host/alias.ts index d266674ed8..4df9c6b1fb 100644 --- a/packages/angular_devkit/core/src/virtual-fs/host/alias.ts +++ b/packages/angular_devkit/core/src/virtual-fs/host/alias.ts @@ -74,7 +74,7 @@ export class AliasHost extends ResolverHost maybeAlias = join(maybeAlias, ...remaining); } // Allow non-null-operator because we know sp.length > 0 (condition on while). - remaining.unshift(sp.pop() !); // tslint:disable-line:non-null-operator + remaining.unshift(sp.pop() !); // tslint:disable-line:no-non-null-assertion } return maybeAlias || path; diff --git a/packages/angular_devkit/core/src/virtual-fs/host/memory_spec.ts b/packages/angular_devkit/core/src/virtual-fs/host/memory_spec.ts index 849829666d..bed5437eeb 100644 --- a/packages/angular_devkit/core/src/virtual-fs/host/memory_spec.ts +++ b/packages/angular_devkit/core/src/virtual-fs/host/memory_spec.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ // tslint:disable:no-implicit-dependencies -// tslint:disable:non-null-operator +// tslint:disable:no-non-null-assertion import { fragment, normalize } from '@angular-devkit/core'; import { stringToFileBuffer } from './buffer'; import { SimpleMemoryHost } from './memory'; diff --git a/packages/angular_devkit/core/src/virtual-fs/host/sync.ts b/packages/angular_devkit/core/src/virtual-fs/host/sync.ts index 7706971b42..d28097c69b 100644 --- a/packages/angular_devkit/core/src/virtual-fs/host/sync.ts +++ b/packages/angular_devkit/core/src/virtual-fs/host/sync.ts @@ -53,7 +53,7 @@ export class SyncDelegateHost { // The non-null operation is to work around `void` type. We don't allow to return undefined // but ResultT could be void, which is undefined in JavaScript, so this doesn't change the // behaviour. - // tslint:disable-next-line:non-null-operator + // tslint:disable-next-line:no-non-null-assertion return result !; } diff --git a/packages/angular_devkit/schematics/src/engine/schematic_spec.ts b/packages/angular_devkit/schematics/src/engine/schematic_spec.ts index 26aa34b15c..7a3fbcfa93 100644 --- a/packages/angular_devkit/schematics/src/engine/schematic_spec.ts +++ b/packages/angular_devkit/schematics/src/engine/schematic_spec.ts @@ -5,7 +5,7 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -// tslint:disable:non-null-operator +// tslint:disable:no-non-null-assertion import { logging } from '@angular-devkit/core'; import { of as observableOf } from 'rxjs'; import { chain } from '../rules/base'; diff --git a/packages/angular_devkit/schematics/src/index.ts b/packages/angular_devkit/schematics/src/index.ts index 722bd0a911..31333a014f 100644 --- a/packages/angular_devkit/schematics/src/index.ts +++ b/packages/angular_devkit/schematics/src/index.ts @@ -5,8 +5,7 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -import { FilePredicate, MergeStrategy } from './tree/interface'; -import { Tree as TreeInterface } from './tree/interface'; +import { FilePredicate, MergeStrategy, Tree as TreeInterface } from './tree/interface'; import { branch, empty, merge, optimize, partition } from './tree/static'; diff --git a/packages/angular_devkit/schematics/src/rules/base_spec.ts b/packages/angular_devkit/schematics/src/rules/base_spec.ts index 418b44b447..b504d3c01d 100644 --- a/packages/angular_devkit/schematics/src/rules/base_spec.ts +++ b/packages/angular_devkit/schematics/src/rules/base_spec.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ // tslint:disable:no-implicit-dependencies -// tslint:disable:non-null-operator +// tslint:disable:no-non-null-assertion import { Path, virtualFs } from '@angular-devkit/core'; import { HostTree, diff --git a/packages/angular_devkit/schematics/src/rules/call_spec.ts b/packages/angular_devkit/schematics/src/rules/call_spec.ts index ffb9896c27..b4ec2d4b43 100644 --- a/packages/angular_devkit/schematics/src/rules/call_spec.ts +++ b/packages/angular_devkit/schematics/src/rules/call_spec.ts @@ -5,7 +5,7 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -// tslint:disable:non-null-operator +// tslint:disable:no-non-null-assertion // tslint:disable:no-any // tslint:disable:no-implicit-dependencies import { MergeStrategy } from '@angular-devkit/schematics'; diff --git a/packages/angular_devkit/schematics/src/rules/move_spec.ts b/packages/angular_devkit/schematics/src/rules/move_spec.ts index c9c67a23b3..7737f861db 100644 --- a/packages/angular_devkit/schematics/src/rules/move_spec.ts +++ b/packages/angular_devkit/schematics/src/rules/move_spec.ts @@ -5,7 +5,7 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -// tslint:disable:non-null-operator +// tslint:disable:no-non-null-assertion import { of as observableOf } from 'rxjs'; import { SchematicContext } from '../engine/interface'; import { HostTree } from '../tree/host-tree'; diff --git a/packages/angular_devkit/schematics/src/rules/rename_spec.ts b/packages/angular_devkit/schematics/src/rules/rename_spec.ts index 8cc869dab7..c9fdda3cdd 100644 --- a/packages/angular_devkit/schematics/src/rules/rename_spec.ts +++ b/packages/angular_devkit/schematics/src/rules/rename_spec.ts @@ -5,7 +5,7 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -// tslint:disable:non-null-operator +// tslint:disable:no-non-null-assertion import { of as observableOf } from 'rxjs'; import { SchematicContext } from '../engine/interface'; import { HostTree } from '../tree/host-tree'; diff --git a/packages/angular_devkit/schematics/src/tree/common_spec.ts b/packages/angular_devkit/schematics/src/tree/common_spec.ts index 1b23171159..141a744a24 100644 --- a/packages/angular_devkit/schematics/src/tree/common_spec.ts +++ b/packages/angular_devkit/schematics/src/tree/common_spec.ts @@ -5,7 +5,7 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -// tslint:disable:non-null-operator +// tslint:disable:no-non-null-assertion import { normalize } from '@angular-devkit/core'; import { Tree } from './interface'; diff --git a/packages/angular_devkit/schematics/src/tree/filesystem_spec.ts b/packages/angular_devkit/schematics/src/tree/filesystem_spec.ts index 4d748943b5..8944945056 100644 --- a/packages/angular_devkit/schematics/src/tree/filesystem_spec.ts +++ b/packages/angular_devkit/schematics/src/tree/filesystem_spec.ts @@ -5,7 +5,7 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -// tslint:disable:non-null-operator +// tslint:disable:no-non-null-assertion import { PathIsFileException, normalize, virtualFs } from '@angular-devkit/core'; import { testTreeVisit } from './common_spec'; import { FileSystemTree } from './filesystem'; diff --git a/packages/angular_devkit/schematics/src/tree/interface.ts b/packages/angular_devkit/schematics/src/tree/interface.ts index f78f029e0c..df763916b3 100644 --- a/packages/angular_devkit/schematics/src/tree/interface.ts +++ b/packages/angular_devkit/schematics/src/tree/interface.ts @@ -22,12 +22,12 @@ export enum MergeStrategy { Error = 1 << 0, // Only content conflicts are overwritten. - ContentOnly = MergeStrategy.AllowOverwriteConflict, + ContentOnly = AllowOverwriteConflict, // Overwrite everything with the latest change. - Overwrite = MergeStrategy.AllowOverwriteConflict - + MergeStrategy.AllowCreationConflict - + MergeStrategy.AllowDeleteConflict, + Overwrite = AllowOverwriteConflict + + AllowCreationConflict + + AllowDeleteConflict, } diff --git a/packages/angular_devkit/schematics/src/tree/virtual_spec.ts b/packages/angular_devkit/schematics/src/tree/virtual_spec.ts index 3b30acd6e7..afd8d9f834 100644 --- a/packages/angular_devkit/schematics/src/tree/virtual_spec.ts +++ b/packages/angular_devkit/schematics/src/tree/virtual_spec.ts @@ -5,7 +5,7 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -// tslint:disable:non-null-operator no-big-function +// tslint:disable:no-non-null-assertion no-big-function import { normalize, virtualFs } from '@angular-devkit/core'; import { FileAlreadyExistException, FileDoesNotExistException } from '../exception/exception'; import { testTreeVisit } from './common_spec'; diff --git a/packages/ngtools/webpack/src/angular_compiler_plugin.ts b/packages/ngtools/webpack/src/angular_compiler_plugin.ts index 338814daa2..e4c9da1535 100644 --- a/packages/ngtools/webpack/src/angular_compiler_plugin.ts +++ b/packages/ngtools/webpack/src/angular_compiler_plugin.ts @@ -413,7 +413,7 @@ export class AngularCompilerPlugin { genDir: '', }), // TODO: fix compiler-cli typings; entryModule should not be string, but also optional. - // tslint:disable-next-line:non-null-operator + // tslint:disable-next-line:no-non-null-assertion entryModule: this._entryModule !, }); timeEnd('AngularCompilerPlugin._getLazyRoutesFromNgtools'); diff --git a/packages/schematics/angular/app-shell/index.ts b/packages/schematics/angular/app-shell/index.ts index 4ae8bcd8fd..2cdf54a46c 100644 --- a/packages/schematics/angular/app-shell/index.ts +++ b/packages/schematics/angular/app-shell/index.ts @@ -62,7 +62,7 @@ function getServerModulePath( if (!expNode) { return null; } - const relativePath = ( expNode).moduleSpecifier; + const relativePath = (expNode as ts.ExportDeclaration).moduleSpecifier as ts.StringLiteral; const modulePath = normalize(`/${project.root}/src/${relativePath.text}.ts`); return modulePath; @@ -113,7 +113,7 @@ function getBootstrapComponentPath( const metadataNode = getDecoratorMetadata(moduleSource, 'NgModule', '@angular/core')[0]; const bootstrapProperty = getMetadataProperty(metadataNode, 'bootstrap'); - const arrLiteral = ( bootstrapProperty) + const arrLiteral = (bootstrapProperty as ts.PropertyAssignment) .initializer as ts.ArrayLiteralExpression; const componentSymbol = arrLiteral.elements[0].getText(); @@ -124,7 +124,7 @@ function getBootstrapComponentPath( return findNode(imp, ts.SyntaxKind.Identifier, componentSymbol); }) .map((imp: ts.ImportDeclaration) => { - const pathStringLiteral = imp.moduleSpecifier; + const pathStringLiteral = imp.moduleSpecifier as ts.StringLiteral; return pathStringLiteral.text; })[0]; diff --git a/packages/schematics/angular/e2e/index.ts b/packages/schematics/angular/e2e/index.ts index d6f4634613..2c2f5472ee 100644 --- a/packages/schematics/angular/e2e/index.ts +++ b/packages/schematics/angular/e2e/index.ts @@ -5,8 +5,7 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -import { strings, tags } from '@angular-devkit/core'; -import { experimental } from '@angular-devkit/core'; +import { experimental, strings, tags } from '@angular-devkit/core'; import { Rule, SchematicContext, diff --git a/packages/schematics/angular/migrations/update-6/index.ts b/packages/schematics/angular/migrations/update-6/index.ts index 3683627ee1..3509bb8849 100644 --- a/packages/schematics/angular/migrations/update-6/index.ts +++ b/packages/schematics/angular/migrations/update-6/index.ts @@ -517,7 +517,7 @@ function extractProjectsConfig( } return newItems; - }, []); + }, [] as string[]); // Tslint target const lintOptions: JsonObject = { diff --git a/packages/schematics/angular/universal/index.ts b/packages/schematics/angular/universal/index.ts index f3a94daea5..6db955cd11 100644 --- a/packages/schematics/angular/universal/index.ts +++ b/packages/schematics/angular/universal/index.ts @@ -221,7 +221,7 @@ export default function (options: UniversalOptions): Rule { template({ ...strings, ...options as object, - stripTsExtension: (s: string) => { return s.replace(/\.ts$/, ''); }, + stripTsExtension: (s: string) => s.replace(/\.ts$/, ''), }), move(join(normalize(clientProject.root), 'src')), ]); @@ -230,7 +230,7 @@ export default function (options: UniversalOptions): Rule { template({ ...strings, ...options as object, - stripTsExtension: (s: string) => { return s.replace(/\.ts$/, ''); }, + stripTsExtension: (s: string) => s.replace(/\.ts$/, ''), outDir, tsConfigExtends, rootInSrc, diff --git a/packages/schematics/angular/utility/ast-utils.ts b/packages/schematics/angular/utility/ast-utils.ts index 5b388e1700..96479d02e9 100644 --- a/packages/schematics/angular/utility/ast-utils.ts +++ b/packages/schematics/angular/utility/ast-utils.ts @@ -555,7 +555,7 @@ export function isImported(source: ts.SourceFile, .filter(node => node.kind === ts.SyntaxKind.ImportDeclaration) .filter((imp: ts.ImportDeclaration) => imp.moduleSpecifier.kind === ts.SyntaxKind.StringLiteral) .filter((imp: ts.ImportDeclaration) => { - return ( imp.moduleSpecifier).text === importPath; + return (imp.moduleSpecifier as ts.StringLiteral).text === importPath; }) .filter((imp: ts.ImportDeclaration) => { if (!imp.importClause) { diff --git a/packages/schematics/angular/utility/ng-ast-utils.ts b/packages/schematics/angular/utility/ng-ast-utils.ts index 615b6e89da..b0cac7e51e 100644 --- a/packages/schematics/angular/utility/ng-ast-utils.ts +++ b/packages/schematics/angular/utility/ng-ast-utils.ts @@ -67,7 +67,7 @@ export function findBootstrapModulePath(host: Tree, mainPath: string): string { return findNode(imp, ts.SyntaxKind.Identifier, bootstrapModule.getText()); }) .map((imp: ts.ImportDeclaration) => { - const modulePathStringLiteral = imp.moduleSpecifier; + const modulePathStringLiteral = imp.moduleSpecifier as ts.StringLiteral; return modulePathStringLiteral.text; })[0]; diff --git a/packages/schematics/update/update/index.ts b/packages/schematics/update/update/index.ts index 8e95b98f09..cee35c6352 100644 --- a/packages/schematics/update/update/index.ts +++ b/packages/schematics/update/update/index.ts @@ -243,7 +243,7 @@ function _performUpdate( const toInstall = [...infoMap.values()] .map(x => [x.name, x.target, x.installed]) - // tslint:disable-next-line:non-null-operator + // tslint:disable-next-line:no-non-null-assertion .filter(([name, target, installed]) => { return !!name && !!target && !!installed; }) as [string, PackageVersionInfo, PackageVersionInfo][]; diff --git a/rules/nonNullOperatorRule.ts b/rules/nonNullOperatorRule.ts deleted file mode 100644 index 1a05d704bc..0000000000 --- a/rules/nonNullOperatorRule.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -import * as Lint from 'tslint'; -import * as ts from 'typescript'; - - -export class Rule extends Lint.Rules.AbstractRule { - public static metadata: Lint.IRuleMetadata = { - ruleName: 'non-null-operator', - type: 'typescript', - description: `Ensure the NonNull operator (!) can be used or not.`, - rationale: 'strictNullChecks are meant to avoid issues, which the non-null operator removes ' - + 'if used too frequently. Please use the non-null operator responsibly.', - options: null, - optionsDescription: `Not configurable.`, - typescriptOnly: false, - }; - - public static FAILURE_STRING = 'The Non-Null operator `!` is illegal.'; - - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new Walker(sourceFile, this.getOptions())); - } -} - - -class Walker extends Lint.RuleWalker { - visitNonNullExpression(node: ts.NonNullExpression): void { - this.addFailureAt(node.getStart(), node.getWidth(), Rule.FAILURE_STRING); - } -} diff --git a/scripts/release.ts b/scripts/release.ts index 21d3a13bde..b9ef93cd4a 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -10,7 +10,6 @@ import { logging } from '@angular-devkit/core'; import * as fs from 'fs'; import * as path from 'path'; import * as semver from 'semver'; -import { ReleaseType } from 'semver'; import { packages } from '../lib/packages'; @@ -81,7 +80,7 @@ function _upgrade(release: string, force: boolean, logger: logging.Logger) { } } } else if (dirty || release !== 'patch') { - newVersion = semver.inc(version, release as ReleaseType); + newVersion = semver.inc(version, release as semver.ReleaseType); } let message = ''; diff --git a/tslint.json b/tslint.json index 652121c760..2957023b87 100644 --- a/tslint.json +++ b/tslint.json @@ -14,7 +14,6 @@ "//04": "custom rules defined in dist/rules/**", "defocus": true, "import-groups": true, - "non-null-operator": true, "no-global-tslint-disable": true, "single-eof-line": true, "//05": "==================================================================================================", @@ -38,7 +37,6 @@ "no-unthrown-error": true, "no-use-of-empty-return-value": true, "no-useless-increment": true, - "no-useless-intersection": true, "//09": "These rules are part of the code smell detection section of tslint-sonarts", "no-dead-store": true, @@ -47,6 +45,14 @@ "//11": "==================================================================================================", "//12": "base tslint rules", + "arrow-return-shorthand": true, + "no-duplicate-imports": true, + "no-angle-bracket-type-assertion": true, + "no-conditional-assignment": true, + "no-non-null-assertion": true, + "no-unnecessary-qualifier": true, + "no-string-throw": true, + "encoding": true, "no-floating-promises": true, "no-implicit-dependencies": true, "no-import-side-effect": [true, {"ignore-module": "^(?!rxjs\/)"}],