From 8122595a2d4e2db75391cc718418cc72f2b662a3 Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Mon, 15 May 2017 16:50:50 +0200 Subject: [PATCH 1/7] Don't create preEmitDiagnostics when testing Diagnostics are ignored anyway and are not necessary for type checking --- src/test.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/test.ts b/src/test.ts index 74eb88e2a6b..46fbb410a79 100644 --- a/src/test.ts +++ b/src/test.ts @@ -142,8 +142,6 @@ export function runTest(testDirectory: string, rulesDirectory?: string | string[ }; program = ts.createProgram([fileCompileName], compilerOptions, compilerHost); - // perform type checking on the program, updating nodes with symbol table references - ts.getPreEmitDiagnostics(program); } const lintOptions = { From 96d7782b94d8a1fb74bc833e5207d7fa18bda0d1 Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Mon, 15 May 2017 18:02:34 +0200 Subject: [PATCH 2/7] create a program when tsconfig.json is found --- src/test.ts | 10 ++++++++-- test/rules/await-promise/tslint.json | 3 --- test/rules/completed-docs/defaults/tsconfig.json | 1 + test/rules/completed-docs/defaults/tslint.json | 3 --- test/rules/completed-docs/locations/tsconfig.json | 1 + test/rules/completed-docs/locations/tslint.json | 3 --- .../completed-docs/privacies-private/tsconfig.json | 1 + .../rules/completed-docs/privacies-private/tslint.json | 3 --- .../completed-docs/privacies-protected/tsconfig.json | 1 + .../completed-docs/privacies-protected/tslint.json | 3 --- .../completed-docs/privacies-public/tsconfig.json | 1 + test/rules/completed-docs/privacies-public/tslint.json | 3 --- test/rules/completed-docs/privacies/tsconfig.json | 1 + test/rules/completed-docs/privacies/tslint.json | 3 --- test/rules/completed-docs/types/tsconfig.json | 1 + test/rules/completed-docs/types/tslint.json | 3 --- test/rules/completed-docs/visibilities/tsconfig.json | 1 + test/rules/completed-docs/visibilities/tslint.json | 3 --- test/rules/deprecation/tsconfig.json | 1 + test/rules/deprecation/tslint.json | 3 --- test/rules/match-default-export-name/tsconfig.json | 1 + test/rules/match-default-export-name/tslint.json | 3 --- test/rules/no-boolean-literal-compare/tslint.json | 3 --- .../no-floating-promises/jquerypromise/tsconfig.json | 1 + .../no-floating-promises/jquerypromise/tslint.json | 3 --- test/rules/no-floating-promises/promises/tsconfig.json | 1 + test/rules/no-floating-promises/promises/tslint.json | 3 --- test/rules/no-for-in-array/tsconfig.json | 1 + test/rules/no-for-in-array/tslint.json | 3 --- test/rules/no-import-side-effect/default/test.ts.lint | 1 + test/rules/no-import-side-effect/default/tslint.json | 3 --- .../no-import-side-effect/ignore-module/tslint.json | 3 --- test/rules/no-inferred-empty-object-type/tsconfig.json | 1 + test/rules/no-inferred-empty-object-type/tslint.json | 3 --- test/rules/no-unbound-method/tsconfig.json | 1 + test/rules/no-unbound-method/tslint.json | 3 --- test/rules/no-unnecessary-qualifier/tslint.json | 3 --- test/rules/no-unnecessary-type-assertion/tslint.json | 3 --- test/rules/no-unsafe-any/tsconfig.json | 1 + test/rules/no-unsafe-any/tslint.json | 3 --- .../no-unused-variable/check-parameters/tsconfig.json | 1 + .../no-unused-variable/check-parameters/tslint.json | 3 --- test/rules/no-unused-variable/default/tsconfig.json | 1 + test/rules/no-unused-variable/default/tslint.json | 3 --- .../no-unused-variable/ignore-pattern/tsconfig.json | 1 + .../no-unused-variable/ignore-pattern/tslint.json | 3 --- test/rules/no-unused-variable/type-checked/tslint.json | 3 --- test/rules/no-use-before-declare/tsconfig.json | 1 + test/rules/no-use-before-declare/tslint.json | 3 --- test/rules/no-void-expression/default/tslint.json | 3 --- .../ignore-arrow-function-shorthand/tsconfig.json | 1 + .../ignore-arrow-function-shorthand/tslint.json | 3 --- test/rules/promise-function-async/tsconfig.json | 1 + test/rules/promise-function-async/tslint.json | 3 --- test/rules/restrict-plus-operands/tsconfig.json | 1 + test/rules/restrict-plus-operands/tslint.json | 3 --- test/rules/return-undefined/tslint.json | 3 --- .../strict-boolean-expressions/allow-mix/tslint.json | 3 --- .../allow-null-union/tslint.json | 3 --- .../allow-number/tslint.json | 3 --- .../allow-string/tslint.json | 3 --- .../allow-undefined-union/tslint.json | 3 --- .../strict-boolean-expressions/default/tslint.json | 3 --- .../no-allow-mix/tslint.json | 3 --- .../no-null-checks-allow-null-union/tsconfig.json | 1 + .../no-null-checks-allow-null-union/tslint.json | 3 --- .../no-null-checks-allow-number-string/tsconfig.json | 1 + .../no-null-checks-allow-number-string/tslint.json | 3 --- .../no-null-checks/tsconfig.json | 1 + .../no-null-checks/tslint.json | 3 --- test/rules/strict-type-predicates/tslint.json | 3 --- 71 files changed, 35 insertions(+), 131 deletions(-) create mode 100644 test/rules/completed-docs/defaults/tsconfig.json create mode 100644 test/rules/completed-docs/locations/tsconfig.json create mode 100644 test/rules/completed-docs/privacies-private/tsconfig.json create mode 100644 test/rules/completed-docs/privacies-protected/tsconfig.json create mode 100644 test/rules/completed-docs/privacies-public/tsconfig.json create mode 100644 test/rules/completed-docs/privacies/tsconfig.json create mode 100644 test/rules/completed-docs/types/tsconfig.json create mode 100644 test/rules/completed-docs/visibilities/tsconfig.json create mode 100644 test/rules/deprecation/tsconfig.json create mode 100644 test/rules/match-default-export-name/tsconfig.json create mode 100644 test/rules/no-floating-promises/jquerypromise/tsconfig.json create mode 100644 test/rules/no-floating-promises/promises/tsconfig.json create mode 100644 test/rules/no-for-in-array/tsconfig.json create mode 100644 test/rules/no-inferred-empty-object-type/tsconfig.json create mode 100644 test/rules/no-unbound-method/tsconfig.json create mode 100644 test/rules/no-unsafe-any/tsconfig.json create mode 100644 test/rules/no-unused-variable/check-parameters/tsconfig.json create mode 100644 test/rules/no-unused-variable/default/tsconfig.json create mode 100644 test/rules/no-unused-variable/ignore-pattern/tsconfig.json create mode 100644 test/rules/no-use-before-declare/tsconfig.json create mode 100644 test/rules/no-void-expression/ignore-arrow-function-shorthand/tsconfig.json create mode 100644 test/rules/promise-function-async/tsconfig.json create mode 100644 test/rules/restrict-plus-operands/tsconfig.json create mode 100644 test/rules/strict-boolean-expressions/no-null-checks-allow-null-union/tsconfig.json create mode 100644 test/rules/strict-boolean-expressions/no-null-checks-allow-number-string/tsconfig.json create mode 100644 test/rules/strict-boolean-expressions/no-null-checks/tsconfig.json diff --git a/src/test.ts b/src/test.ts index 46fbb410a79..8e9ec27d41e 100644 --- a/src/test.ts +++ b/src/test.ts @@ -23,6 +23,7 @@ import * as path from "path"; import * as semver from "semver"; import * as ts from "typescript"; +import { showWarningOnce } from "./error"; import {Replacement} from "./language/rule/rule"; import * as Linter from "./linter"; import {LintError} from "./test/lintError"; @@ -70,7 +71,8 @@ export function runTest(testDirectory: string, rulesDirectory?: string | string[ const tslintConfig = Linter.findConfiguration(path.join(testDirectory, "tslint.json"), "").results; const tsConfig = path.join(testDirectory, "tsconfig.json"); let compilerOptions: ts.CompilerOptions = { allowJs: true }; - if (fs.existsSync(tsConfig)) { + let hasConfig = fs.existsSync(tsConfig); + if (hasConfig) { const {config, error} = ts.readConfigFile(tsConfig, ts.sys.readFile); if (error !== undefined) { throw new Error(JSON.stringify(error)); @@ -84,6 +86,10 @@ export function runTest(testDirectory: string, rulesDirectory?: string | string[ }; compilerOptions = ts.parseJsonConfigFileContent(config, parseConfigHost, testDirectory).options; } + if (tslintConfig !== undefined && tslintConfig.linterOptions !== undefined && tslintConfig.linterOptions.typeCheck === true) { + hasConfig = true; + showWarningOnce("Using linterOptions.typeCheck in tests is deprecated. Place a tsconfig.json in the directory instead"); + } const results: TestResult = { directory: testDirectory, results: {} }; for (const fileToLint of filesToLint) { @@ -115,7 +121,7 @@ export function runTest(testDirectory: string, rulesDirectory?: string | string[ const errorsFromMarkup = parse.parseErrorsFromMarkup(fileText); let program: ts.Program | undefined; - if (tslintConfig !== undefined && tslintConfig.linterOptions !== undefined && tslintConfig.linterOptions.typeCheck === true) { + if (hasConfig) { const compilerHost: ts.CompilerHost = { fileExists: () => true, getCanonicalFileName: (filename: string) => filename, diff --git a/test/rules/await-promise/tslint.json b/test/rules/await-promise/tslint.json index 310c3d77712..8f307816f9b 100644 --- a/test/rules/await-promise/tslint.json +++ b/test/rules/await-promise/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "await-promise": true } diff --git a/test/rules/completed-docs/defaults/tsconfig.json b/test/rules/completed-docs/defaults/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/completed-docs/defaults/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/completed-docs/defaults/tslint.json b/test/rules/completed-docs/defaults/tslint.json index 8dce9903cd7..17b5070c104 100644 --- a/test/rules/completed-docs/defaults/tslint.json +++ b/test/rules/completed-docs/defaults/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "completed-docs": true } diff --git a/test/rules/completed-docs/locations/tsconfig.json b/test/rules/completed-docs/locations/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/completed-docs/locations/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/completed-docs/locations/tslint.json b/test/rules/completed-docs/locations/tslint.json index aafbf0ef568..1ea892b6326 100644 --- a/test/rules/completed-docs/locations/tslint.json +++ b/test/rules/completed-docs/locations/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "completed-docs": [true, { "methods": { diff --git a/test/rules/completed-docs/privacies-private/tsconfig.json b/test/rules/completed-docs/privacies-private/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/completed-docs/privacies-private/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/completed-docs/privacies-private/tslint.json b/test/rules/completed-docs/privacies-private/tslint.json index cd309ecea29..9a1da1b3647 100644 --- a/test/rules/completed-docs/privacies-private/tslint.json +++ b/test/rules/completed-docs/privacies-private/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "completed-docs": [true, { "methods": { diff --git a/test/rules/completed-docs/privacies-protected/tsconfig.json b/test/rules/completed-docs/privacies-protected/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/completed-docs/privacies-protected/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/completed-docs/privacies-protected/tslint.json b/test/rules/completed-docs/privacies-protected/tslint.json index 843428a816f..ae578287241 100644 --- a/test/rules/completed-docs/privacies-protected/tslint.json +++ b/test/rules/completed-docs/privacies-protected/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "completed-docs": [true, { "methods": { diff --git a/test/rules/completed-docs/privacies-public/tsconfig.json b/test/rules/completed-docs/privacies-public/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/completed-docs/privacies-public/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/completed-docs/privacies-public/tslint.json b/test/rules/completed-docs/privacies-public/tslint.json index e91f6078e51..8f32bf88245 100644 --- a/test/rules/completed-docs/privacies-public/tslint.json +++ b/test/rules/completed-docs/privacies-public/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "completed-docs": [true, { "methods": { diff --git a/test/rules/completed-docs/privacies/tsconfig.json b/test/rules/completed-docs/privacies/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/completed-docs/privacies/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/completed-docs/privacies/tslint.json b/test/rules/completed-docs/privacies/tslint.json index 396adaa8594..3ed521af93c 100644 --- a/test/rules/completed-docs/privacies/tslint.json +++ b/test/rules/completed-docs/privacies/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "completed-docs": [true, { "methods": { diff --git a/test/rules/completed-docs/types/tsconfig.json b/test/rules/completed-docs/types/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/completed-docs/types/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/completed-docs/types/tslint.json b/test/rules/completed-docs/types/tslint.json index 0f8ac6f9c46..2b390114565 100644 --- a/test/rules/completed-docs/types/tslint.json +++ b/test/rules/completed-docs/types/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "completed-docs": [ true, diff --git a/test/rules/completed-docs/visibilities/tsconfig.json b/test/rules/completed-docs/visibilities/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/completed-docs/visibilities/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/completed-docs/visibilities/tslint.json b/test/rules/completed-docs/visibilities/tslint.json index cb0a666b870..9b537f463c3 100644 --- a/test/rules/completed-docs/visibilities/tslint.json +++ b/test/rules/completed-docs/visibilities/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "completed-docs": [true, { "enums": { diff --git a/test/rules/deprecation/tsconfig.json b/test/rules/deprecation/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/deprecation/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/deprecation/tslint.json b/test/rules/deprecation/tslint.json index 7a48e8d675a..db90a0266cd 100644 --- a/test/rules/deprecation/tslint.json +++ b/test/rules/deprecation/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "deprecation": true } diff --git a/test/rules/match-default-export-name/tsconfig.json b/test/rules/match-default-export-name/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/match-default-export-name/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/match-default-export-name/tslint.json b/test/rules/match-default-export-name/tslint.json index 4a9afbf9587..be090e5892d 100644 --- a/test/rules/match-default-export-name/tslint.json +++ b/test/rules/match-default-export-name/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "match-default-export-name": true } diff --git a/test/rules/no-boolean-literal-compare/tslint.json b/test/rules/no-boolean-literal-compare/tslint.json index 79f31adfee3..ad257794e15 100644 --- a/test/rules/no-boolean-literal-compare/tslint.json +++ b/test/rules/no-boolean-literal-compare/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "no-boolean-literal-compare": true } diff --git a/test/rules/no-floating-promises/jquerypromise/tsconfig.json b/test/rules/no-floating-promises/jquerypromise/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/no-floating-promises/jquerypromise/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/no-floating-promises/jquerypromise/tslint.json b/test/rules/no-floating-promises/jquerypromise/tslint.json index f207ba50df6..1aa03fb4f2f 100644 --- a/test/rules/no-floating-promises/jquerypromise/tslint.json +++ b/test/rules/no-floating-promises/jquerypromise/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "no-floating-promises": [true, "JQueryPromise"] } diff --git a/test/rules/no-floating-promises/promises/tsconfig.json b/test/rules/no-floating-promises/promises/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/no-floating-promises/promises/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/no-floating-promises/promises/tslint.json b/test/rules/no-floating-promises/promises/tslint.json index 2f3715da4c5..9ed3c104284 100644 --- a/test/rules/no-floating-promises/promises/tslint.json +++ b/test/rules/no-floating-promises/promises/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "no-floating-promises": true } diff --git a/test/rules/no-for-in-array/tsconfig.json b/test/rules/no-for-in-array/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/no-for-in-array/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/no-for-in-array/tslint.json b/test/rules/no-for-in-array/tslint.json index 583d5858c71..57f80691b45 100644 --- a/test/rules/no-for-in-array/tslint.json +++ b/test/rules/no-for-in-array/tslint.json @@ -1,8 +1,5 @@ { "rules": { "no-for-in-array": true - }, - "linterOptions": { - "typeCheck": true } } diff --git a/test/rules/no-import-side-effect/default/test.ts.lint b/test/rules/no-import-side-effect/default/test.ts.lint index 7c6568222fc..0f5151a0b4e 100644 --- a/test/rules/no-import-side-effect/default/test.ts.lint +++ b/test/rules/no-import-side-effect/default/test.ts.lint @@ -1,3 +1,4 @@ + // valid cases import {Injectable, Component, Directive} from '@angular/core'; import {Inject} from '@angular/core'; diff --git a/test/rules/no-import-side-effect/default/tslint.json b/test/rules/no-import-side-effect/default/tslint.json index d8505197084..220182feece 100644 --- a/test/rules/no-import-side-effect/default/tslint.json +++ b/test/rules/no-import-side-effect/default/tslint.json @@ -1,8 +1,5 @@ { "rules": { "no-import-side-effect": [true] - }, - "linterOptions": { - "typeCheck": false } } diff --git a/test/rules/no-import-side-effect/ignore-module/tslint.json b/test/rules/no-import-side-effect/ignore-module/tslint.json index 7230e57ab1d..72647987f09 100644 --- a/test/rules/no-import-side-effect/ignore-module/tslint.json +++ b/test/rules/no-import-side-effect/ignore-module/tslint.json @@ -6,8 +6,5 @@ "ignore-module": "(allow-side-effect|\\.css)$" } ] - }, - "linterOptions": { - "typeCheck": false } } diff --git a/test/rules/no-inferred-empty-object-type/tsconfig.json b/test/rules/no-inferred-empty-object-type/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/no-inferred-empty-object-type/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/no-inferred-empty-object-type/tslint.json b/test/rules/no-inferred-empty-object-type/tslint.json index 46856d2b38a..81b900beb64 100644 --- a/test/rules/no-inferred-empty-object-type/tslint.json +++ b/test/rules/no-inferred-empty-object-type/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "no-inferred-empty-object-type": true } diff --git a/test/rules/no-unbound-method/tsconfig.json b/test/rules/no-unbound-method/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/no-unbound-method/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/no-unbound-method/tslint.json b/test/rules/no-unbound-method/tslint.json index 767d91262bd..908c6e2ad9e 100644 --- a/test/rules/no-unbound-method/tslint.json +++ b/test/rules/no-unbound-method/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "no-unbound-method": true } diff --git a/test/rules/no-unnecessary-qualifier/tslint.json b/test/rules/no-unnecessary-qualifier/tslint.json index 2945858d5e7..53feac1c8ab 100644 --- a/test/rules/no-unnecessary-qualifier/tslint.json +++ b/test/rules/no-unnecessary-qualifier/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "no-unnecessary-qualifier": true } diff --git a/test/rules/no-unnecessary-type-assertion/tslint.json b/test/rules/no-unnecessary-type-assertion/tslint.json index c007079863e..2acf91b7b08 100644 --- a/test/rules/no-unnecessary-type-assertion/tslint.json +++ b/test/rules/no-unnecessary-type-assertion/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "no-unnecessary-type-assertion": true } diff --git a/test/rules/no-unsafe-any/tsconfig.json b/test/rules/no-unsafe-any/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/no-unsafe-any/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/no-unsafe-any/tslint.json b/test/rules/no-unsafe-any/tslint.json index 85a9290c2e6..b44ff572bc8 100644 --- a/test/rules/no-unsafe-any/tslint.json +++ b/test/rules/no-unsafe-any/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "no-unsafe-any": true } diff --git a/test/rules/no-unused-variable/check-parameters/tsconfig.json b/test/rules/no-unused-variable/check-parameters/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/no-unused-variable/check-parameters/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/no-unused-variable/check-parameters/tslint.json b/test/rules/no-unused-variable/check-parameters/tslint.json index 62b8abc06c2..ab3b45be1f5 100644 --- a/test/rules/no-unused-variable/check-parameters/tslint.json +++ b/test/rules/no-unused-variable/check-parameters/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "no-unused-variable": [true, "check-parameters"] } diff --git a/test/rules/no-unused-variable/default/tsconfig.json b/test/rules/no-unused-variable/default/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/no-unused-variable/default/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/no-unused-variable/default/tslint.json b/test/rules/no-unused-variable/default/tslint.json index e81cc662cf1..b1d833a0963 100644 --- a/test/rules/no-unused-variable/default/tslint.json +++ b/test/rules/no-unused-variable/default/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "no-unused-variable": true } diff --git a/test/rules/no-unused-variable/ignore-pattern/tsconfig.json b/test/rules/no-unused-variable/ignore-pattern/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/no-unused-variable/ignore-pattern/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/no-unused-variable/ignore-pattern/tslint.json b/test/rules/no-unused-variable/ignore-pattern/tslint.json index b8d027ab315..6e81221de24 100644 --- a/test/rules/no-unused-variable/ignore-pattern/tslint.json +++ b/test/rules/no-unused-variable/ignore-pattern/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "no-unused-variable": [true, {"ignore-pattern": "^[_R]"}] } diff --git a/test/rules/no-unused-variable/type-checked/tslint.json b/test/rules/no-unused-variable/type-checked/tslint.json index e81cc662cf1..b1d833a0963 100644 --- a/test/rules/no-unused-variable/type-checked/tslint.json +++ b/test/rules/no-unused-variable/type-checked/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "no-unused-variable": true } diff --git a/test/rules/no-use-before-declare/tsconfig.json b/test/rules/no-use-before-declare/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/no-use-before-declare/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/no-use-before-declare/tslint.json b/test/rules/no-use-before-declare/tslint.json index 9565c5b8b02..744ae40f6ff 100644 --- a/test/rules/no-use-before-declare/tslint.json +++ b/test/rules/no-use-before-declare/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "no-use-before-declare": true } diff --git a/test/rules/no-void-expression/default/tslint.json b/test/rules/no-void-expression/default/tslint.json index 56fe3ac12f3..d8073cc8eda 100644 --- a/test/rules/no-void-expression/default/tslint.json +++ b/test/rules/no-void-expression/default/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "no-void-expression": true } diff --git a/test/rules/no-void-expression/ignore-arrow-function-shorthand/tsconfig.json b/test/rules/no-void-expression/ignore-arrow-function-shorthand/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/no-void-expression/ignore-arrow-function-shorthand/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/no-void-expression/ignore-arrow-function-shorthand/tslint.json b/test/rules/no-void-expression/ignore-arrow-function-shorthand/tslint.json index 53d3125e510..edb823990d3 100644 --- a/test/rules/no-void-expression/ignore-arrow-function-shorthand/tslint.json +++ b/test/rules/no-void-expression/ignore-arrow-function-shorthand/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "no-void-expression": [true, "ignore-arrow-function-shorthand"] } diff --git a/test/rules/promise-function-async/tsconfig.json b/test/rules/promise-function-async/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/promise-function-async/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/promise-function-async/tslint.json b/test/rules/promise-function-async/tslint.json index a5c4617c770..c4546e54179 100644 --- a/test/rules/promise-function-async/tslint.json +++ b/test/rules/promise-function-async/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "promise-function-async": true } diff --git a/test/rules/restrict-plus-operands/tsconfig.json b/test/rules/restrict-plus-operands/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/restrict-plus-operands/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/restrict-plus-operands/tslint.json b/test/rules/restrict-plus-operands/tslint.json index 5337f453195..8389b1de47a 100644 --- a/test/rules/restrict-plus-operands/tslint.json +++ b/test/rules/restrict-plus-operands/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "restrict-plus-operands": true } diff --git a/test/rules/return-undefined/tslint.json b/test/rules/return-undefined/tslint.json index 56d94ccd1c8..475b28dc589 100644 --- a/test/rules/return-undefined/tslint.json +++ b/test/rules/return-undefined/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "return-undefined": true } diff --git a/test/rules/strict-boolean-expressions/allow-mix/tslint.json b/test/rules/strict-boolean-expressions/allow-mix/tslint.json index 725d18c2e5b..0a36db5f45a 100644 --- a/test/rules/strict-boolean-expressions/allow-mix/tslint.json +++ b/test/rules/strict-boolean-expressions/allow-mix/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "strict-boolean-expressions": [true, "allow-string", "allow-undefined-union", "allow-mix"] } diff --git a/test/rules/strict-boolean-expressions/allow-null-union/tslint.json b/test/rules/strict-boolean-expressions/allow-null-union/tslint.json index 64303ce8a51..68d81e95e18 100644 --- a/test/rules/strict-boolean-expressions/allow-null-union/tslint.json +++ b/test/rules/strict-boolean-expressions/allow-null-union/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "strict-boolean-expressions": [true, "allow-null-union"] } diff --git a/test/rules/strict-boolean-expressions/allow-number/tslint.json b/test/rules/strict-boolean-expressions/allow-number/tslint.json index df204cead30..e11c8f93fcc 100644 --- a/test/rules/strict-boolean-expressions/allow-number/tslint.json +++ b/test/rules/strict-boolean-expressions/allow-number/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "strict-boolean-expressions": [true, "allow-number"] } diff --git a/test/rules/strict-boolean-expressions/allow-string/tslint.json b/test/rules/strict-boolean-expressions/allow-string/tslint.json index 7b9da6c84fc..356b40389f6 100644 --- a/test/rules/strict-boolean-expressions/allow-string/tslint.json +++ b/test/rules/strict-boolean-expressions/allow-string/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "strict-boolean-expressions": [true, "allow-string"] } diff --git a/test/rules/strict-boolean-expressions/allow-undefined-union/tslint.json b/test/rules/strict-boolean-expressions/allow-undefined-union/tslint.json index b7dc81fb3b8..ea0d9855d30 100644 --- a/test/rules/strict-boolean-expressions/allow-undefined-union/tslint.json +++ b/test/rules/strict-boolean-expressions/allow-undefined-union/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "strict-boolean-expressions": [true, "allow-undefined-union"] } diff --git a/test/rules/strict-boolean-expressions/default/tslint.json b/test/rules/strict-boolean-expressions/default/tslint.json index 1060078bc17..153f37560a7 100644 --- a/test/rules/strict-boolean-expressions/default/tslint.json +++ b/test/rules/strict-boolean-expressions/default/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "strict-boolean-expressions": true } diff --git a/test/rules/strict-boolean-expressions/no-allow-mix/tslint.json b/test/rules/strict-boolean-expressions/no-allow-mix/tslint.json index ffbe242f4c9..01f7ab6fe2a 100644 --- a/test/rules/strict-boolean-expressions/no-allow-mix/tslint.json +++ b/test/rules/strict-boolean-expressions/no-allow-mix/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "strict-boolean-expressions": [true, "allow-string", "allow-undefined-union"] } diff --git a/test/rules/strict-boolean-expressions/no-null-checks-allow-null-union/tsconfig.json b/test/rules/strict-boolean-expressions/no-null-checks-allow-null-union/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/strict-boolean-expressions/no-null-checks-allow-null-union/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/strict-boolean-expressions/no-null-checks-allow-null-union/tslint.json b/test/rules/strict-boolean-expressions/no-null-checks-allow-null-union/tslint.json index 64303ce8a51..68d81e95e18 100644 --- a/test/rules/strict-boolean-expressions/no-null-checks-allow-null-union/tslint.json +++ b/test/rules/strict-boolean-expressions/no-null-checks-allow-null-union/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "strict-boolean-expressions": [true, "allow-null-union"] } diff --git a/test/rules/strict-boolean-expressions/no-null-checks-allow-number-string/tsconfig.json b/test/rules/strict-boolean-expressions/no-null-checks-allow-number-string/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/strict-boolean-expressions/no-null-checks-allow-number-string/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/strict-boolean-expressions/no-null-checks-allow-number-string/tslint.json b/test/rules/strict-boolean-expressions/no-null-checks-allow-number-string/tslint.json index cd87f1dba77..584f5f112f6 100644 --- a/test/rules/strict-boolean-expressions/no-null-checks-allow-number-string/tslint.json +++ b/test/rules/strict-boolean-expressions/no-null-checks-allow-number-string/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "strict-boolean-expressions": [true, "allow-number", "allow-string"] } diff --git a/test/rules/strict-boolean-expressions/no-null-checks/tsconfig.json b/test/rules/strict-boolean-expressions/no-null-checks/tsconfig.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/rules/strict-boolean-expressions/no-null-checks/tsconfig.json @@ -0,0 +1 @@ +{} diff --git a/test/rules/strict-boolean-expressions/no-null-checks/tslint.json b/test/rules/strict-boolean-expressions/no-null-checks/tslint.json index 1060078bc17..153f37560a7 100644 --- a/test/rules/strict-boolean-expressions/no-null-checks/tslint.json +++ b/test/rules/strict-boolean-expressions/no-null-checks/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "strict-boolean-expressions": true } diff --git a/test/rules/strict-type-predicates/tslint.json b/test/rules/strict-type-predicates/tslint.json index 268b470e4be..bb5f9231e91 100644 --- a/test/rules/strict-type-predicates/tslint.json +++ b/test/rules/strict-type-predicates/tslint.json @@ -1,7 +1,4 @@ { - "linterOptions": { - "typeCheck": true - }, "rules": { "strict-type-predicates": true } From 47b884364667129da9a9c5bf0de0959cbe8c5a5c Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Mon, 15 May 2017 18:14:40 +0200 Subject: [PATCH 3/7] add todo comment --- src/test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test.ts b/src/test.ts index 8e9ec27d41e..85752835b76 100644 --- a/src/test.ts +++ b/src/test.ts @@ -86,9 +86,10 @@ export function runTest(testDirectory: string, rulesDirectory?: string | string[ }; compilerOptions = ts.parseJsonConfigFileContent(config, parseConfigHost, testDirectory).options; } + // TODO remove in v6.0.0 if (tslintConfig !== undefined && tslintConfig.linterOptions !== undefined && tslintConfig.linterOptions.typeCheck === true) { hasConfig = true; - showWarningOnce("Using linterOptions.typeCheck in tests is deprecated. Place a tsconfig.json in the directory instead"); + showWarningOnce("Using linterOptions.typeCheck in tests is deprecated. Place a tsconfig.json next to tslint.json instead."); } const results: TestResult = { directory: testDirectory, results: {} }; From 40978202d66fe491220281d906e565822456a178 Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Mon, 15 May 2017 21:52:48 +0200 Subject: [PATCH 4/7] remove linterOptions completely, add content to tsconfig.json --- src/test.ts | 7 +------ test/rules/completed-docs/defaults/tsconfig.json | 6 +++++- test/rules/completed-docs/locations/tsconfig.json | 6 +++++- test/rules/completed-docs/privacies-private/tsconfig.json | 6 +++++- .../rules/completed-docs/privacies-protected/tsconfig.json | 6 +++++- test/rules/completed-docs/privacies-public/tsconfig.json | 6 +++++- test/rules/completed-docs/privacies/tsconfig.json | 6 +++++- test/rules/completed-docs/types/tsconfig.json | 6 +++++- test/rules/completed-docs/visibilities/tsconfig.json | 6 +++++- test/rules/deprecation/tsconfig.json | 6 +++++- test/rules/match-default-export-name/tsconfig.json | 6 +++++- .../rules/no-floating-promises/jquerypromise/tsconfig.json | 6 +++++- test/rules/no-floating-promises/promises/tsconfig.json | 6 +++++- test/rules/no-for-in-array/tsconfig.json | 6 +++++- test/rules/no-inferred-empty-object-type/tsconfig.json | 6 +++++- test/rules/no-unbound-method/tsconfig.json | 6 +++++- test/rules/no-unsafe-any/tsconfig.json | 6 +++++- .../no-unused-variable/check-parameters/tsconfig.json | 6 +++++- test/rules/no-unused-variable/default/tsconfig.json | 6 +++++- test/rules/no-unused-variable/ignore-pattern/tsconfig.json | 6 +++++- test/rules/no-use-before-declare/tsconfig.json | 6 +++++- .../ignore-arrow-function-shorthand/tsconfig.json | 6 +++++- test/rules/promise-function-async/tsconfig.json | 6 +++++- test/rules/restrict-plus-operands/tsconfig.json | 6 +++++- .../no-null-checks-allow-null-union/tsconfig.json | 6 +++++- .../no-null-checks-allow-number-string/tsconfig.json | 6 +++++- .../no-null-checks/tsconfig.json | 6 +++++- 27 files changed, 131 insertions(+), 32 deletions(-) diff --git a/src/test.ts b/src/test.ts index 85752835b76..75eb4f3f4fe 100644 --- a/src/test.ts +++ b/src/test.ts @@ -71,7 +71,7 @@ export function runTest(testDirectory: string, rulesDirectory?: string | string[ const tslintConfig = Linter.findConfiguration(path.join(testDirectory, "tslint.json"), "").results; const tsConfig = path.join(testDirectory, "tsconfig.json"); let compilerOptions: ts.CompilerOptions = { allowJs: true }; - let hasConfig = fs.existsSync(tsConfig); + const hasConfig = fs.existsSync(tsConfig); if (hasConfig) { const {config, error} = ts.readConfigFile(tsConfig, ts.sys.readFile); if (error !== undefined) { @@ -86,11 +86,6 @@ export function runTest(testDirectory: string, rulesDirectory?: string | string[ }; compilerOptions = ts.parseJsonConfigFileContent(config, parseConfigHost, testDirectory).options; } - // TODO remove in v6.0.0 - if (tslintConfig !== undefined && tslintConfig.linterOptions !== undefined && tslintConfig.linterOptions.typeCheck === true) { - hasConfig = true; - showWarningOnce("Using linterOptions.typeCheck in tests is deprecated. Place a tsconfig.json next to tslint.json instead."); - } const results: TestResult = { directory: testDirectory, results: {} }; for (const fileToLint of filesToLint) { diff --git a/test/rules/completed-docs/defaults/tsconfig.json b/test/rules/completed-docs/defaults/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/completed-docs/defaults/tsconfig.json +++ b/test/rules/completed-docs/defaults/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/completed-docs/locations/tsconfig.json b/test/rules/completed-docs/locations/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/completed-docs/locations/tsconfig.json +++ b/test/rules/completed-docs/locations/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/completed-docs/privacies-private/tsconfig.json b/test/rules/completed-docs/privacies-private/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/completed-docs/privacies-private/tsconfig.json +++ b/test/rules/completed-docs/privacies-private/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/completed-docs/privacies-protected/tsconfig.json b/test/rules/completed-docs/privacies-protected/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/completed-docs/privacies-protected/tsconfig.json +++ b/test/rules/completed-docs/privacies-protected/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/completed-docs/privacies-public/tsconfig.json b/test/rules/completed-docs/privacies-public/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/completed-docs/privacies-public/tsconfig.json +++ b/test/rules/completed-docs/privacies-public/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/completed-docs/privacies/tsconfig.json b/test/rules/completed-docs/privacies/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/completed-docs/privacies/tsconfig.json +++ b/test/rules/completed-docs/privacies/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/completed-docs/types/tsconfig.json b/test/rules/completed-docs/types/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/completed-docs/types/tsconfig.json +++ b/test/rules/completed-docs/types/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/completed-docs/visibilities/tsconfig.json b/test/rules/completed-docs/visibilities/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/completed-docs/visibilities/tsconfig.json +++ b/test/rules/completed-docs/visibilities/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/deprecation/tsconfig.json b/test/rules/deprecation/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/deprecation/tsconfig.json +++ b/test/rules/deprecation/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/match-default-export-name/tsconfig.json b/test/rules/match-default-export-name/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/match-default-export-name/tsconfig.json +++ b/test/rules/match-default-export-name/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/no-floating-promises/jquerypromise/tsconfig.json b/test/rules/no-floating-promises/jquerypromise/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/no-floating-promises/jquerypromise/tsconfig.json +++ b/test/rules/no-floating-promises/jquerypromise/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/no-floating-promises/promises/tsconfig.json b/test/rules/no-floating-promises/promises/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/no-floating-promises/promises/tsconfig.json +++ b/test/rules/no-floating-promises/promises/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/no-for-in-array/tsconfig.json b/test/rules/no-for-in-array/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/no-for-in-array/tsconfig.json +++ b/test/rules/no-for-in-array/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/no-inferred-empty-object-type/tsconfig.json b/test/rules/no-inferred-empty-object-type/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/no-inferred-empty-object-type/tsconfig.json +++ b/test/rules/no-inferred-empty-object-type/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/no-unbound-method/tsconfig.json b/test/rules/no-unbound-method/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/no-unbound-method/tsconfig.json +++ b/test/rules/no-unbound-method/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/no-unsafe-any/tsconfig.json b/test/rules/no-unsafe-any/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/no-unsafe-any/tsconfig.json +++ b/test/rules/no-unsafe-any/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/no-unused-variable/check-parameters/tsconfig.json b/test/rules/no-unused-variable/check-parameters/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/no-unused-variable/check-parameters/tsconfig.json +++ b/test/rules/no-unused-variable/check-parameters/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/no-unused-variable/default/tsconfig.json b/test/rules/no-unused-variable/default/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/no-unused-variable/default/tsconfig.json +++ b/test/rules/no-unused-variable/default/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/no-unused-variable/ignore-pattern/tsconfig.json b/test/rules/no-unused-variable/ignore-pattern/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/no-unused-variable/ignore-pattern/tsconfig.json +++ b/test/rules/no-unused-variable/ignore-pattern/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/no-use-before-declare/tsconfig.json b/test/rules/no-use-before-declare/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/no-use-before-declare/tsconfig.json +++ b/test/rules/no-use-before-declare/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/no-void-expression/ignore-arrow-function-shorthand/tsconfig.json b/test/rules/no-void-expression/ignore-arrow-function-shorthand/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/no-void-expression/ignore-arrow-function-shorthand/tsconfig.json +++ b/test/rules/no-void-expression/ignore-arrow-function-shorthand/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/promise-function-async/tsconfig.json b/test/rules/promise-function-async/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/promise-function-async/tsconfig.json +++ b/test/rules/promise-function-async/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/restrict-plus-operands/tsconfig.json b/test/rules/restrict-plus-operands/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/restrict-plus-operands/tsconfig.json +++ b/test/rules/restrict-plus-operands/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/strict-boolean-expressions/no-null-checks-allow-null-union/tsconfig.json b/test/rules/strict-boolean-expressions/no-null-checks-allow-null-union/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/strict-boolean-expressions/no-null-checks-allow-null-union/tsconfig.json +++ b/test/rules/strict-boolean-expressions/no-null-checks-allow-null-union/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/strict-boolean-expressions/no-null-checks-allow-number-string/tsconfig.json b/test/rules/strict-boolean-expressions/no-null-checks-allow-number-string/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/strict-boolean-expressions/no-null-checks-allow-number-string/tsconfig.json +++ b/test/rules/strict-boolean-expressions/no-null-checks-allow-number-string/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} diff --git a/test/rules/strict-boolean-expressions/no-null-checks/tsconfig.json b/test/rules/strict-boolean-expressions/no-null-checks/tsconfig.json index 0967ef424bc..0d58d115f70 100644 --- a/test/rules/strict-boolean-expressions/no-null-checks/tsconfig.json +++ b/test/rules/strict-boolean-expressions/no-null-checks/tsconfig.json @@ -1 +1,5 @@ -{} +{ + "compilerOptions": { + "target": "esnext" + } +} From 52e1240bff25fdc25311f55575b42c4c78075d40 Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Mon, 15 May 2017 21:57:28 +0200 Subject: [PATCH 5/7] Remove unused import --- src/test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test.ts b/src/test.ts index 75eb4f3f4fe..8655953d2b0 100644 --- a/src/test.ts +++ b/src/test.ts @@ -23,7 +23,6 @@ import * as path from "path"; import * as semver from "semver"; import * as ts from "typescript"; -import { showWarningOnce } from "./error"; import {Replacement} from "./language/rule/rule"; import * as Linter from "./linter"; import {LintError} from "./test/lintError"; From 1109ffabff6075d7988796da3defbe4d915192f7 Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Mon, 15 May 2017 21:59:32 +0200 Subject: [PATCH 6/7] Add documentation --- docs/develop/testing-rules/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/develop/testing-rules/index.md b/docs/develop/testing-rules/index.md index 355ae625c69..ac120df6617 100644 --- a/docs/develop/testing-rules/index.md +++ b/docs/develop/testing-rules/index.md @@ -160,6 +160,8 @@ The following part can be any [version range](https://github.com/npm/node-semver * You can use this system to test rules outside of the TSLint build! Use the `tslint --test path/to/dir` command to test your own custom rules. The directory you pass should contain a `tslint.json` file and `.ts.lint` files. You can try this out on the TSLint rule test cases, for example, `tslint --test path/to/tslint-code/test/rules/quotemark/single`. +* To test rules that need type information, you can simply add a `tsconfig.json` with the desired configuration next to `tslint.json`. + * Lint failures sometimes span over multiple lines. To handle this case, don't specify a message until the end of the error. For example: ``` From 528d3d0f448bc93591fb5b55c8b0417bcfa63364 Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Mon, 15 May 2017 22:10:02 +0200 Subject: [PATCH 7/7] don't specify target in tsconfig.json --- test/rules/completed-docs/defaults/tsconfig.json | 2 +- test/rules/completed-docs/locations/tsconfig.json | 2 +- test/rules/completed-docs/privacies-private/tsconfig.json | 2 +- test/rules/completed-docs/privacies-protected/tsconfig.json | 2 +- test/rules/completed-docs/privacies-public/tsconfig.json | 2 +- test/rules/completed-docs/privacies/tsconfig.json | 2 +- test/rules/completed-docs/types/tsconfig.json | 2 +- test/rules/completed-docs/visibilities/tsconfig.json | 2 +- test/rules/deprecation/tsconfig.json | 2 +- test/rules/match-default-export-name/tsconfig.json | 2 +- test/rules/no-floating-promises/jquerypromise/tsconfig.json | 2 +- test/rules/no-floating-promises/promises/tsconfig.json | 2 +- test/rules/no-for-in-array/tsconfig.json | 2 +- test/rules/no-inferred-empty-object-type/tsconfig.json | 2 +- test/rules/no-unbound-method/tsconfig.json | 2 +- test/rules/no-unsafe-any/tsconfig.json | 2 +- test/rules/no-unused-variable/check-parameters/tsconfig.json | 2 +- test/rules/no-unused-variable/default/tsconfig.json | 2 +- test/rules/no-unused-variable/ignore-pattern/tsconfig.json | 2 +- test/rules/no-use-before-declare/tsconfig.json | 2 +- .../ignore-arrow-function-shorthand/tsconfig.json | 2 +- test/rules/promise-function-async/tsconfig.json | 2 +- test/rules/restrict-plus-operands/tsconfig.json | 2 +- .../no-null-checks-allow-null-union/tsconfig.json | 2 +- .../no-null-checks-allow-number-string/tsconfig.json | 2 +- .../strict-boolean-expressions/no-null-checks/tsconfig.json | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/test/rules/completed-docs/defaults/tsconfig.json b/test/rules/completed-docs/defaults/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/completed-docs/defaults/tsconfig.json +++ b/test/rules/completed-docs/defaults/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/completed-docs/locations/tsconfig.json b/test/rules/completed-docs/locations/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/completed-docs/locations/tsconfig.json +++ b/test/rules/completed-docs/locations/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/completed-docs/privacies-private/tsconfig.json b/test/rules/completed-docs/privacies-private/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/completed-docs/privacies-private/tsconfig.json +++ b/test/rules/completed-docs/privacies-private/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/completed-docs/privacies-protected/tsconfig.json b/test/rules/completed-docs/privacies-protected/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/completed-docs/privacies-protected/tsconfig.json +++ b/test/rules/completed-docs/privacies-protected/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/completed-docs/privacies-public/tsconfig.json b/test/rules/completed-docs/privacies-public/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/completed-docs/privacies-public/tsconfig.json +++ b/test/rules/completed-docs/privacies-public/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/completed-docs/privacies/tsconfig.json b/test/rules/completed-docs/privacies/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/completed-docs/privacies/tsconfig.json +++ b/test/rules/completed-docs/privacies/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/completed-docs/types/tsconfig.json b/test/rules/completed-docs/types/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/completed-docs/types/tsconfig.json +++ b/test/rules/completed-docs/types/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/completed-docs/visibilities/tsconfig.json b/test/rules/completed-docs/visibilities/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/completed-docs/visibilities/tsconfig.json +++ b/test/rules/completed-docs/visibilities/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/deprecation/tsconfig.json b/test/rules/deprecation/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/deprecation/tsconfig.json +++ b/test/rules/deprecation/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/match-default-export-name/tsconfig.json b/test/rules/match-default-export-name/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/match-default-export-name/tsconfig.json +++ b/test/rules/match-default-export-name/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/no-floating-promises/jquerypromise/tsconfig.json b/test/rules/no-floating-promises/jquerypromise/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/no-floating-promises/jquerypromise/tsconfig.json +++ b/test/rules/no-floating-promises/jquerypromise/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/no-floating-promises/promises/tsconfig.json b/test/rules/no-floating-promises/promises/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/no-floating-promises/promises/tsconfig.json +++ b/test/rules/no-floating-promises/promises/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/no-for-in-array/tsconfig.json b/test/rules/no-for-in-array/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/no-for-in-array/tsconfig.json +++ b/test/rules/no-for-in-array/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/no-inferred-empty-object-type/tsconfig.json b/test/rules/no-inferred-empty-object-type/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/no-inferred-empty-object-type/tsconfig.json +++ b/test/rules/no-inferred-empty-object-type/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/no-unbound-method/tsconfig.json b/test/rules/no-unbound-method/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/no-unbound-method/tsconfig.json +++ b/test/rules/no-unbound-method/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/no-unsafe-any/tsconfig.json b/test/rules/no-unsafe-any/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/no-unsafe-any/tsconfig.json +++ b/test/rules/no-unsafe-any/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/no-unused-variable/check-parameters/tsconfig.json b/test/rules/no-unused-variable/check-parameters/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/no-unused-variable/check-parameters/tsconfig.json +++ b/test/rules/no-unused-variable/check-parameters/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/no-unused-variable/default/tsconfig.json b/test/rules/no-unused-variable/default/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/no-unused-variable/default/tsconfig.json +++ b/test/rules/no-unused-variable/default/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/no-unused-variable/ignore-pattern/tsconfig.json b/test/rules/no-unused-variable/ignore-pattern/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/no-unused-variable/ignore-pattern/tsconfig.json +++ b/test/rules/no-unused-variable/ignore-pattern/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/no-use-before-declare/tsconfig.json b/test/rules/no-use-before-declare/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/no-use-before-declare/tsconfig.json +++ b/test/rules/no-use-before-declare/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/no-void-expression/ignore-arrow-function-shorthand/tsconfig.json b/test/rules/no-void-expression/ignore-arrow-function-shorthand/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/no-void-expression/ignore-arrow-function-shorthand/tsconfig.json +++ b/test/rules/no-void-expression/ignore-arrow-function-shorthand/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/promise-function-async/tsconfig.json b/test/rules/promise-function-async/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/promise-function-async/tsconfig.json +++ b/test/rules/promise-function-async/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/restrict-plus-operands/tsconfig.json b/test/rules/restrict-plus-operands/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/restrict-plus-operands/tsconfig.json +++ b/test/rules/restrict-plus-operands/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/strict-boolean-expressions/no-null-checks-allow-null-union/tsconfig.json b/test/rules/strict-boolean-expressions/no-null-checks-allow-null-union/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/strict-boolean-expressions/no-null-checks-allow-null-union/tsconfig.json +++ b/test/rules/strict-boolean-expressions/no-null-checks-allow-null-union/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/strict-boolean-expressions/no-null-checks-allow-number-string/tsconfig.json b/test/rules/strict-boolean-expressions/no-null-checks-allow-number-string/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/strict-boolean-expressions/no-null-checks-allow-number-string/tsconfig.json +++ b/test/rules/strict-boolean-expressions/no-null-checks-allow-number-string/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } } diff --git a/test/rules/strict-boolean-expressions/no-null-checks/tsconfig.json b/test/rules/strict-boolean-expressions/no-null-checks/tsconfig.json index 0d58d115f70..744a66c893a 100644 --- a/test/rules/strict-boolean-expressions/no-null-checks/tsconfig.json +++ b/test/rules/strict-boolean-expressions/no-null-checks/tsconfig.json @@ -1,5 +1,5 @@ { "compilerOptions": { - "target": "esnext" + "module": "commonjs" } }