Comparing version 3.6.4 to 3.6.6
@@ -12,3 +12,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.typeScriptPath = exports.cleanInstalls = exports.installNext = exports.installAll = void 0; | ||
const assert = require("assert"); | ||
@@ -69,5 +68,2 @@ const child_process_1 = require("child_process"); | ||
assert(version !== "local"); | ||
if (version === "next") { | ||
version = definitelytyped_header_parser_1.TypeScriptVersion.latest; | ||
} | ||
return path.join(installsDir, version); | ||
@@ -74,0 +70,0 @@ } |
@@ -26,19 +26,16 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
Rule.metadata = { | ||
ruleName: "dt-header", | ||
description: "Ensure consistency of DefinitelyTyped headers.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "dt-header", | ||
description: "Ensure consistency of DefinitelyTyped headers.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
function walk(ctx) { | ||
@@ -45,0 +42,0 @@ const { sourceFile } = ctx; |
@@ -32,75 +32,72 @@ "use strict"; | ||
const perfDir = path_1.join(os.homedir(), ".dts", "perf"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.TypedRule { | ||
static FAILURE_STRING(expectedVersion, expectedType, actualType) { | ||
return `TypeScript@${expectedVersion} expected type to be:\n ${expectedType}\ngot:\n ${actualType}`; | ||
class Rule extends Lint.Rules.TypedRule { | ||
static FAILURE_STRING(expectedVersion, expectedType, actualType) { | ||
return `TypeScript@${expectedVersion} expected type to be:\n ${expectedType}\ngot:\n ${actualType}`; | ||
} | ||
applyWithProgram(sourceFile, lintProgram) { | ||
const options = this.ruleArguments[0]; | ||
if (!options) { | ||
return this.applyWithFunction(sourceFile, ctx => walk(ctx, lintProgram, TsType, "next", /*nextHigherVersion*/ undefined)); | ||
} | ||
applyWithProgram(sourceFile, lintProgram) { | ||
const options = this.ruleArguments[0]; | ||
if (!options) { | ||
return this.applyWithFunction(sourceFile, ctx => walk(ctx, lintProgram, TsType, "next", /*nextHigherVersion*/ undefined)); | ||
} | ||
const { tsconfigPath, versionsToTest } = options; | ||
const getFailures = ({ versionName, path }, nextHigherVersion, writeOutput) => { | ||
const ts = require(path); | ||
const program = getProgram(tsconfigPath, ts, versionName, lintProgram); | ||
const failures = this.applyWithFunction(sourceFile, ctx => walk(ctx, program, ts, versionName, nextHigherVersion)); | ||
if (writeOutput) { | ||
const packageName = path_1.basename(path_1.dirname(tsconfigPath)); | ||
if (!packageName.match(/v\d+/) && !packageName.match(/ts\d\.\d/)) { | ||
const d = { | ||
[packageName]: { | ||
typeCount: program.getTypeCount(), | ||
memory: ts.sys.getMemoryUsage ? ts.sys.getMemoryUsage() : 0, | ||
}, | ||
}; | ||
if (!fs_1.existsSync(cacheDir)) { | ||
fs_1.mkdirSync(cacheDir); | ||
} | ||
if (!fs_1.existsSync(perfDir)) { | ||
fs_1.mkdirSync(perfDir); | ||
} | ||
fs_1.writeFileSync(path_1.join(perfDir, `${packageName}.json`), JSON.stringify(d)); | ||
const { tsconfigPath, versionsToTest } = options; | ||
const getFailures = ({ versionName, path }, nextHigherVersion, writeOutput) => { | ||
const ts = require(path); | ||
const program = getProgram(tsconfigPath, ts, versionName, lintProgram); | ||
const failures = this.applyWithFunction(sourceFile, ctx => walk(ctx, program, ts, versionName, nextHigherVersion)); | ||
if (writeOutput) { | ||
const packageName = path_1.basename(path_1.dirname(tsconfigPath)); | ||
if (!packageName.match(/v\d+/) && !packageName.match(/ts\d\.\d/)) { | ||
const d = { | ||
[packageName]: { | ||
typeCount: program.getTypeCount(), | ||
memory: ts.sys.getMemoryUsage ? ts.sys.getMemoryUsage() : 0, | ||
}, | ||
}; | ||
if (!fs_1.existsSync(cacheDir)) { | ||
fs_1.mkdirSync(cacheDir); | ||
} | ||
if (!fs_1.existsSync(perfDir)) { | ||
fs_1.mkdirSync(perfDir); | ||
} | ||
fs_1.writeFileSync(path_1.join(perfDir, `${packageName}.json`), JSON.stringify(d)); | ||
} | ||
} | ||
return failures; | ||
}; | ||
const maxFailures = getFailures(util_1.last(versionsToTest), undefined, /*writeOutput*/ true); | ||
if (maxFailures.length) { | ||
return maxFailures; | ||
} | ||
// As an optimization, check the earliest version for errors; | ||
// assume that if it works on min and max, it works for everything in between. | ||
const minFailures = getFailures(versionsToTest[0], undefined, /*writeOutput*/ false); | ||
if (!minFailures.length) { | ||
return []; | ||
} | ||
// There are no failures in the max version, but there are failures in the min version. | ||
// Work backward to find the newest version with failures. | ||
for (let i = versionsToTest.length - 2; i >= 0; i--) { | ||
const failures = getFailures(versionsToTest[i], options.versionsToTest[i + 1].versionName, /*writeOutput*/ false); | ||
if (failures.length) { | ||
return failures; | ||
}; | ||
const maxFailures = getFailures(util_1.last(versionsToTest), undefined, /*writeOutput*/ true); | ||
if (maxFailures.length) { | ||
return maxFailures; | ||
} | ||
// As an optimization, check the earliest version for errors; | ||
// assume that if it works on min and max, it works for everything in between. | ||
const minFailures = getFailures(versionsToTest[0], undefined, /*writeOutput*/ false); | ||
if (!minFailures.length) { | ||
return []; | ||
} | ||
// There are no failures in the max version, but there are failures in the min version. | ||
// Work backward to find the newest version with failures. | ||
for (let i = versionsToTest.length - 2; i >= 0; i--) { | ||
const failures = getFailures(versionsToTest[i], options.versionsToTest[i + 1].versionName, /*writeOutput*/ false); | ||
if (failures.length) { | ||
return failures; | ||
} | ||
} | ||
throw new Error(); // unreachable -- at least the min version should have failures. | ||
} | ||
throw new Error(); // unreachable -- at least the min version should have failures. | ||
} | ||
/* tslint:disable:object-literal-sort-keys */ | ||
Rule.metadata = { | ||
ruleName: "expect", | ||
description: "Asserts types with $ExpectType and presence of errors with $ExpectError.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
requiresTypeInfo: true, | ||
}; | ||
/* tslint:enable:object-literal-sort-keys */ | ||
Rule.FAILURE_STRING_DUPLICATE_ASSERTION = "This line has 2 $ExpectType assertions."; | ||
Rule.FAILURE_STRING_ASSERTION_MISSING_NODE = "Can not match a node to this assertion."; | ||
Rule.FAILURE_STRING_EXPECTED_ERROR = "Expected an error on this line, but found none."; | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
/* tslint:disable:object-literal-sort-keys */ | ||
Rule.metadata = { | ||
ruleName: "expect", | ||
description: "Asserts types with $ExpectType and presence of errors with $ExpectError.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
requiresTypeInfo: true, | ||
}; | ||
/* tslint:enable:object-literal-sort-keys */ | ||
Rule.FAILURE_STRING_DUPLICATE_ASSERTION = "This line has 2 $ExpectType assertions."; | ||
Rule.FAILURE_STRING_ASSERTION_MISSING_NODE = "Can not match a node to this assertion."; | ||
Rule.FAILURE_STRING_EXPECTED_ERROR = "Expected an error on this line, but found none."; | ||
const programCache = new WeakMap(); | ||
@@ -107,0 +104,0 @@ /** Maps a tslint Program to one created with the version specified in `options`. */ |
@@ -26,20 +26,17 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
Rule.metadata = { | ||
ruleName: "export-just-namespace", | ||
description: "Forbid to `export = foo` where `foo` is a namespace and isn't merged with a function/class/type/interface.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "Instead of `export =`-ing a namespace, use the body of the namespace as the module body."); | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "export-just-namespace", | ||
description: "Forbid to `export = foo` where `foo` is a namespace and isn't merged with a function/class/type/interface.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "Instead of `export =`-ing a namespace, use the body of the namespace as the module body."); | ||
function walk(ctx) { | ||
@@ -46,0 +43,0 @@ const { sourceFile: { statements } } = ctx; |
@@ -26,20 +26,17 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
Rule.metadata = { | ||
ruleName: "no-any-union", | ||
description: "Forbid a union to contain `any`", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "Including `any` in a union will override all other members of the union."); | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "no-any-union", | ||
description: "Forbid a union to contain `any`", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "Including `any` in a union will override all other members of the union."); | ||
function walk(ctx) { | ||
@@ -46,0 +43,0 @@ ctx.sourceFile.forEachChild(function recur(node) { |
@@ -25,21 +25,18 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
Rule.metadata = { | ||
ruleName: "no-bad-reference", | ||
description: 'Forbid <reference path="../etc"/> in any file, and forbid <reference path> in test files.', | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "Don't use <reference path> to reference another package. Use an import or <reference types> instead."); | ||
Rule.FAILURE_STRING_REFERENCE_IN_TEST = util_1.failure(Rule.metadata.ruleName, "Don't use <reference path> in test files. Use <reference types> or include the file in 'tsconfig.json'."); | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "no-bad-reference", | ||
description: 'Forbid <reference path="../etc"/> in any file, and forbid <reference path> in test files.', | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "Don't use <reference path> to reference another package. Use an import or <reference types> instead."); | ||
Rule.FAILURE_STRING_REFERENCE_IN_TEST = util_1.failure(Rule.metadata.ruleName, "Don't use <reference path> in test files. Use <reference types> or include the file in 'tsconfig.json'."); | ||
function walk(ctx) { | ||
@@ -46,0 +43,0 @@ const { sourceFile } = ctx; |
@@ -26,20 +26,17 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
Rule.metadata = { | ||
ruleName: "no-const-enum", | ||
description: "Forbid `const enum`", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "Use of `const enum`s is forbidden."); | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "no-const-enum", | ||
description: "Forbid `const enum`", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "Use of `const enum`s is forbidden."); | ||
function walk(ctx) { | ||
@@ -46,0 +43,0 @@ ctx.sourceFile.forEachChild(function recur(node) { |
@@ -25,21 +25,18 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
Rule.metadata = { | ||
ruleName: "no-dead-reference", | ||
description: "Ensures that all `/// <reference>` comments go at the top of the file.", | ||
rationale: "style", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "`/// <reference>` directive must be at top of file to take effect."); | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "no-dead-reference", | ||
description: "Ensures that all `/// <reference>` comments go at the top of the file.", | ||
rationale: "style", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "`/// <reference>` directive must be at top of file to take effect."); | ||
function walk(ctx) { | ||
@@ -46,0 +43,0 @@ const { sourceFile: { statements, text } } = ctx; |
@@ -26,23 +26,20 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.TypedRule { | ||
applyWithProgram(sourceFile, program) { | ||
if (!sourceFile.isDeclarationFile) { | ||
return []; | ||
} | ||
const packageName = util_1.getCommonDirectoryName(program.getRootFileNames()); | ||
return this.applyWithFunction(sourceFile, ctx => walk(ctx, packageName)); | ||
class Rule extends Lint.Rules.TypedRule { | ||
applyWithProgram(sourceFile, program) { | ||
if (!sourceFile.isDeclarationFile) { | ||
return []; | ||
} | ||
const packageName = util_1.getCommonDirectoryName(program.getRootFileNames()); | ||
return this.applyWithFunction(sourceFile, ctx => walk(ctx, packageName)); | ||
} | ||
Rule.metadata = { | ||
ruleName: "no-declare-current-package", | ||
description: "Don't use an ambient module declaration of the current package; use an external module.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "no-declare-current-package", | ||
description: "Don't use an ambient module declaration of the current package; use an external module.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
function walk(ctx, packageName) { | ||
@@ -49,0 +46,0 @@ for (const statement of ctx.sourceFile.statements) { |
@@ -26,22 +26,19 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.TypedRule { | ||
static FAILURE_STRING(importName, moduleName) { | ||
return util_1.failure(Rule.metadata.ruleName, `The module ${moduleName} uses \`export = \`. Import with \`import ${importName} = require(${moduleName})\`.`); | ||
} | ||
applyWithProgram(sourceFile, program) { | ||
return this.applyWithFunction(sourceFile, ctx => walk(ctx, program.getTypeChecker())); | ||
} | ||
class Rule extends Lint.Rules.TypedRule { | ||
static FAILURE_STRING(importName, moduleName) { | ||
return util_1.failure(Rule.metadata.ruleName, `The module ${moduleName} uses \`export = \`. Import with \`import ${importName} = require(${moduleName})\`.`); | ||
} | ||
Rule.metadata = { | ||
ruleName: "no-import-default-of-export-equals", | ||
description: "Forbid a default import to reference an `export =` module.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
return Rule; | ||
})(); | ||
applyWithProgram(sourceFile, program) { | ||
return this.applyWithFunction(sourceFile, ctx => walk(ctx, program.getTypeChecker())); | ||
} | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "no-import-default-of-export-equals", | ||
description: "Forbid a default import to reference an `export =` module.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
function walk(ctx, checker) { | ||
@@ -48,0 +45,0 @@ util_1.eachModuleStatement(ctx.sourceFile, statement => { |
@@ -25,32 +25,29 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.TypedRule { | ||
applyWithProgram(_sourceFile, program) { | ||
if (seenPrograms.has(program)) { | ||
return []; | ||
class Rule extends Lint.Rules.TypedRule { | ||
applyWithProgram(_sourceFile, program) { | ||
if (seenPrograms.has(program)) { | ||
return []; | ||
} | ||
seenPrograms.add(program); | ||
const failures = []; | ||
for (const sourceFile of program.getSourceFiles()) { | ||
const { fileName } = sourceFile; | ||
if (fileName.includes("/DefinitelyTyped/node_modules/") && !program.isSourceFileDefaultLibrary(sourceFile)) { | ||
const msg = util_1.failure(Rule.metadata.ruleName, `File ${fileName} comes from a \`node_modules\` but is not declared in this type's \`package.json\`. `); | ||
failures.push(new Lint.RuleFailure(sourceFile, 0, 1, msg, Rule.metadata.ruleName)); | ||
} | ||
seenPrograms.add(program); | ||
const failures = []; | ||
for (const sourceFile of program.getSourceFiles()) { | ||
const { fileName } = sourceFile; | ||
if (fileName.includes("/DefinitelyTyped/node_modules/") && !program.isSourceFileDefaultLibrary(sourceFile)) { | ||
const msg = util_1.failure(Rule.metadata.ruleName, `File ${fileName} comes from a \`node_modules\` but is not declared in this type's \`package.json\`. `); | ||
failures.push(new Lint.RuleFailure(sourceFile, 0, 1, msg, Rule.metadata.ruleName)); | ||
} | ||
} | ||
return failures; | ||
} | ||
return failures; | ||
} | ||
Rule.metadata = { | ||
ruleName: "no-outside-dependencies", | ||
description: "Don't import things in `DefinitelyTyped/node_modules`.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "no-outside-dependencies", | ||
description: "Don't import things in `DefinitelyTyped/node_modules`.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
const seenPrograms = new WeakSet(); | ||
//# sourceMappingURL=noOutsideDependenciesRule.js.map |
@@ -26,22 +26,19 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
static FAILURE_STRING(kind, token) { | ||
return util_1.failure(Rule.metadata.ruleName, `Don't leave a blank line ${kind} '${ts.tokenToString(token)}'.`); | ||
} | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
class Rule extends Lint.Rules.AbstractRule { | ||
static FAILURE_STRING(kind, token) { | ||
return util_1.failure(Rule.metadata.ruleName, `Don't leave a blank line ${kind} '${ts.tokenToString(token)}'.`); | ||
} | ||
Rule.metadata = { | ||
ruleName: "no-padding", | ||
description: "Forbids a blank line after `(` / `[` / `{`, or before `)` / `]` / `}`.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "style", | ||
typescriptOnly: true, | ||
}; | ||
return Rule; | ||
})(); | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "no-padding", | ||
description: "Forbids a blank line after `(` / `[` / `{`, or before `)` / `]` / `}`.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "style", | ||
typescriptOnly: true, | ||
}; | ||
function walk(ctx) { | ||
@@ -48,0 +45,0 @@ const { sourceFile } = ctx; |
@@ -28,30 +28,27 @@ "use strict"; | ||
const ts = __importStar(require("typescript")); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
static FAILURE_STRING_REDUNDANT_TAG(tagName) { | ||
return `JSDoc tag '@${tagName}' is redundant in TypeScript code.`; | ||
} | ||
static FAILURE_STRING_NO_COMMENT(tagName) { | ||
return `'@${tagName}' is redundant in TypeScript code if it has no description.`; | ||
} | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
class Rule extends Lint.Rules.AbstractRule { | ||
static FAILURE_STRING_REDUNDANT_TAG(tagName) { | ||
return `JSDoc tag '@${tagName}' is redundant in TypeScript code.`; | ||
} | ||
/* tslint:disable:object-literal-sort-keys */ | ||
Rule.metadata = { | ||
ruleName: "no-redundant-jsdoc", | ||
description: "Forbids JSDoc which duplicates TypeScript functionality.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
optionExamples: [true], | ||
type: "style", | ||
typescriptOnly: true, | ||
}; | ||
/* tslint:enable:object-literal-sort-keys */ | ||
Rule.FAILURE_STRING_REDUNDANT_TYPE = "Type annotation in JSDoc is redundant in TypeScript code."; | ||
Rule.FAILURE_STRING_EMPTY = "JSDoc comment is empty."; | ||
return Rule; | ||
})(); | ||
static FAILURE_STRING_NO_COMMENT(tagName) { | ||
return `'@${tagName}' is redundant in TypeScript code if it has no description.`; | ||
} | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
} | ||
exports.Rule = Rule; | ||
/* tslint:disable:object-literal-sort-keys */ | ||
Rule.metadata = { | ||
ruleName: "no-redundant-jsdoc", | ||
description: "Forbids JSDoc which duplicates TypeScript functionality.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
optionExamples: [true], | ||
type: "style", | ||
typescriptOnly: true, | ||
}; | ||
/* tslint:enable:object-literal-sort-keys */ | ||
Rule.FAILURE_STRING_REDUNDANT_TYPE = "Type annotation in JSDoc is redundant in TypeScript code."; | ||
Rule.FAILURE_STRING_EMPTY = "JSDoc comment is empty."; | ||
function walk(ctx) { | ||
@@ -58,0 +55,0 @@ const { sourceFile } = ctx; |
@@ -26,19 +26,16 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
Rule.metadata = { | ||
ruleName: "no-redundant-undefined", | ||
description: "Forbids optional parameters/properties to include an explicit `undefined` in their type.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "style", | ||
typescriptOnly: true, | ||
}; | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "no-redundant-undefined", | ||
description: "Forbids optional parameters/properties to include an explicit `undefined` in their type.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "style", | ||
typescriptOnly: true, | ||
}; | ||
function failureString(container) { | ||
@@ -45,0 +42,0 @@ const desc = container.kind === ts.SyntaxKind.Parameter ? "Parameter" : "Property"; |
@@ -26,22 +26,19 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.TypedRule { | ||
applyWithProgram(sourceFile, program) { | ||
if (sourceFile.isDeclarationFile) { | ||
return []; | ||
} | ||
return this.applyWithFunction(sourceFile, ctx => walk(ctx, program.getTypeChecker())); | ||
class Rule extends Lint.Rules.TypedRule { | ||
applyWithProgram(sourceFile, program) { | ||
if (sourceFile.isDeclarationFile) { | ||
return []; | ||
} | ||
return this.applyWithFunction(sourceFile, ctx => walk(ctx, program.getTypeChecker())); | ||
} | ||
Rule.metadata = { | ||
ruleName: "no-relative-import-in-test", | ||
description: "Forbids test (non-declaration) files to use relative imports.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: false, | ||
}; | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "no-relative-import-in-test", | ||
description: "Forbids test (non-declaration) files to use relative imports.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: false, | ||
}; | ||
const FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "Test file should not use a relative import. Use a global import as if this were a user of the package."); | ||
@@ -48,0 +45,0 @@ function walk(ctx, checker) { |
@@ -25,23 +25,20 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.TypedRule { | ||
applyWithProgram(sourceFile, program) { | ||
if (!sourceFile.isDeclarationFile) { | ||
return []; | ||
} | ||
const name = util_1.getCommonDirectoryName(program.getRootFileNames()); | ||
return this.applyWithFunction(sourceFile, ctx => walk(ctx, name)); | ||
class Rule extends Lint.Rules.TypedRule { | ||
applyWithProgram(sourceFile, program) { | ||
if (!sourceFile.isDeclarationFile) { | ||
return []; | ||
} | ||
const name = util_1.getCommonDirectoryName(program.getRootFileNames()); | ||
return this.applyWithFunction(sourceFile, ctx => walk(ctx, name)); | ||
} | ||
Rule.metadata = { | ||
ruleName: "no-self-import", | ||
description: "Forbids declaration files to import the current package using a global import.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: false, | ||
}; | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "no-self-import", | ||
description: "Forbids declaration files to import the current package using a global import.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: false, | ||
}; | ||
const FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "Declaration file should not use a global import of itself. Use a relative import."); | ||
@@ -48,0 +45,0 @@ function walk(ctx, packageName) { |
@@ -26,21 +26,18 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
Rule.metadata = { | ||
ruleName: "no-single-declare-module", | ||
description: "Don't use an ambient module declaration if you can use an external module file.", | ||
rationale: "Cuts down on nesting", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "style", | ||
typescriptOnly: true, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "File has only 1 module declaration — write it as an external module."); | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "no-single-declare-module", | ||
description: "Don't use an ambient module declaration if you can use an external module file.", | ||
rationale: "Cuts down on nesting", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "style", | ||
typescriptOnly: true, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "File has only 1 module declaration — write it as an external module."); | ||
function walk(ctx) { | ||
@@ -47,0 +44,0 @@ const { sourceFile } = ctx; |
@@ -26,23 +26,21 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
Rule.metadata = { | ||
ruleName: "no-single-element-tuple-type", | ||
description: "Forbids `[T]`, which should be `T[]`.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "no-single-element-tuple-type", | ||
description: "Forbids `[T]`, which should be `T[]`.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
function walk(ctx) { | ||
const { sourceFile } = ctx; | ||
sourceFile.forEachChild(function cb(node) { | ||
if (ts.isTupleTypeNode(node) && node.elementTypes.length === 1) { | ||
var _a; | ||
if (ts.isTupleTypeNode(node) && ((_a = node.elements) !== null && _a !== void 0 ? _a : node.elementTypes).length === 1) { | ||
ctx.addFailureAtNode(node, util_1.failure(Rule.metadata.ruleName, "Type [T] is a single-element tuple type. You probably meant T[].")); | ||
@@ -49,0 +47,0 @@ } |
@@ -26,25 +26,22 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.TypedRule { | ||
static FAILURE_STRING(typeParameter) { | ||
return util_1.failure(Rule.metadata.ruleName, `Type parameter ${typeParameter} is used only once.`); | ||
} | ||
static FAILURE_STRING_NEVER(typeParameter) { | ||
return util_1.failure(Rule.metadata.ruleName, `Type parameter ${typeParameter} is never used.`); | ||
} | ||
applyWithProgram(sourceFile, program) { | ||
return this.applyWithFunction(sourceFile, ctx => walk(ctx, program.getTypeChecker())); | ||
} | ||
class Rule extends Lint.Rules.TypedRule { | ||
static FAILURE_STRING(typeParameter) { | ||
return util_1.failure(Rule.metadata.ruleName, `Type parameter ${typeParameter} is used only once.`); | ||
} | ||
Rule.metadata = { | ||
ruleName: "no-unnecessary-generics", | ||
description: "Forbids signatures using a generic parameter only once.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "style", | ||
typescriptOnly: true, | ||
}; | ||
return Rule; | ||
})(); | ||
static FAILURE_STRING_NEVER(typeParameter) { | ||
return util_1.failure(Rule.metadata.ruleName, `Type parameter ${typeParameter} is never used.`); | ||
} | ||
applyWithProgram(sourceFile, program) { | ||
return this.applyWithFunction(sourceFile, ctx => walk(ctx, program.getTypeChecker())); | ||
} | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "no-unnecessary-generics", | ||
description: "Forbids signatures using a generic parameter only once.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "style", | ||
typescriptOnly: true, | ||
}; | ||
function walk(ctx, checker) { | ||
@@ -51,0 +48,0 @@ const { sourceFile } = ctx; |
@@ -27,24 +27,21 @@ "use strict"; | ||
// Remove when that PR is in. | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const { statements, referencedFiles, typeReferenceDirectives } = sourceFile; | ||
if (statements.length + referencedFiles.length + typeReferenceDirectives.length !== 0) { | ||
return []; | ||
} | ||
return [new Lint.RuleFailure(sourceFile, 0, 1, Rule.FAILURE_STRING, this.ruleName)]; | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
const { statements, referencedFiles, typeReferenceDirectives } = sourceFile; | ||
if (statements.length + referencedFiles.length + typeReferenceDirectives.length !== 0) { | ||
return []; | ||
} | ||
return [new Lint.RuleFailure(sourceFile, 0, 1, Rule.FAILURE_STRING, this.ruleName)]; | ||
} | ||
Rule.metadata = { | ||
ruleName: "no-useless-files", | ||
description: "Forbids files with no content.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: false, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "File has no content."); | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "no-useless-files", | ||
description: "Forbids files with no content.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "functionality", | ||
typescriptOnly: false, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "File has no content."); | ||
//# sourceMappingURL=noUselessFilesRule.js.map |
@@ -30,81 +30,78 @@ "use strict"; | ||
}; | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk, toCriticOptions(parseOptions(this.ruleArguments))); | ||
} | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk, toCriticOptions(parseOptions(this.ruleArguments))); | ||
} | ||
Rule.metadata = { | ||
ruleName: "npm-naming", | ||
description: "Ensure that package name and DefinitelyTyped header match npm package info.", | ||
optionsDescription: `An object with a \`mode\` property should be provided. | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "npm-naming", | ||
description: "Ensure that package name and DefinitelyTyped header match npm package info.", | ||
optionsDescription: `An object with a \`mode\` property should be provided. | ||
If \`mode\` is '${dts_critic_1.Mode.Code}', then option \`errors\` can be provided. | ||
\`errors\` should be an array specifying which code checks should be enabled or disabled.`, | ||
options: { | ||
oneOf: [ | ||
{ | ||
type: "object", | ||
properties: { | ||
"mode": { | ||
type: "string", | ||
enum: [dts_critic_1.Mode.NameOnly], | ||
}, | ||
"single-line": { | ||
description: "Whether to print error messages in a single line. Used for testing.", | ||
type: "boolean", | ||
}, | ||
"required": ["mode"], | ||
options: { | ||
oneOf: [ | ||
{ | ||
type: "object", | ||
properties: { | ||
"mode": { | ||
type: "string", | ||
enum: [dts_critic_1.Mode.NameOnly], | ||
}, | ||
"single-line": { | ||
description: "Whether to print error messages in a single line. Used for testing.", | ||
type: "boolean", | ||
}, | ||
"required": ["mode"], | ||
}, | ||
{ | ||
type: "object", | ||
properties: { | ||
"mode": { | ||
type: "string", | ||
enum: [dts_critic_1.Mode.Code], | ||
}, | ||
"errors": { | ||
}, | ||
{ | ||
type: "object", | ||
properties: { | ||
"mode": { | ||
type: "string", | ||
enum: [dts_critic_1.Mode.Code], | ||
}, | ||
"errors": { | ||
type: "array", | ||
items: { | ||
type: "array", | ||
items: { | ||
type: "array", | ||
items: [ | ||
{ description: "Name of the check.", | ||
type: "string", enum: [dts_critic_1.ErrorKind.NeedsExportEquals, dts_critic_1.ErrorKind.NoDefaultExport], | ||
}, | ||
{ | ||
description: "Whether the check is enabled or disabled.", | ||
type: "boolean", | ||
}, | ||
], | ||
minItems: 2, | ||
maxItems: 2, | ||
}, | ||
default: [], | ||
items: [ | ||
{ description: "Name of the check.", | ||
type: "string", enum: [dts_critic_1.ErrorKind.NeedsExportEquals, dts_critic_1.ErrorKind.NoDefaultExport], | ||
}, | ||
{ | ||
description: "Whether the check is enabled or disabled.", | ||
type: "boolean", | ||
}, | ||
], | ||
minItems: 2, | ||
maxItems: 2, | ||
}, | ||
"single-line": { | ||
description: "Whether to print error messages in a single line. Used for testing.", | ||
type: "boolean", | ||
}, | ||
"required": ["mode"], | ||
default: [], | ||
}, | ||
"single-line": { | ||
description: "Whether to print error messages in a single line. Used for testing.", | ||
type: "boolean", | ||
}, | ||
"required": ["mode"], | ||
}, | ||
], | ||
}, | ||
optionExamples: [ | ||
}, | ||
], | ||
}, | ||
optionExamples: [ | ||
true, | ||
[true, { mode: dts_critic_1.Mode.NameOnly }], | ||
[ | ||
true, | ||
[true, { mode: dts_critic_1.Mode.NameOnly }], | ||
[ | ||
true, | ||
{ | ||
mode: dts_critic_1.Mode.Code, | ||
errors: [[dts_critic_1.ErrorKind.NeedsExportEquals, true], [dts_critic_1.ErrorKind.NoDefaultExport, false]], | ||
}, | ||
], | ||
{ | ||
mode: dts_critic_1.Mode.Code, | ||
errors: [[dts_critic_1.ErrorKind.NeedsExportEquals, true], [dts_critic_1.ErrorKind.NoDefaultExport, false]], | ||
}, | ||
], | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
return Rule; | ||
})(); | ||
exports.Rule = Rule; | ||
], | ||
type: "functionality", | ||
typescriptOnly: true, | ||
}; | ||
function parseOptions(args) { | ||
@@ -111,0 +108,0 @@ if (args.length === 0) { |
@@ -26,20 +26,17 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
Rule.metadata = { | ||
ruleName: "prefer-declare-function", | ||
description: "Forbids `export const x = () => void`.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "style", | ||
typescriptOnly: true, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "Use a function declaration instead of a variable of function type."); | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "prefer-declare-function", | ||
description: "Forbids `export const x = () => void`.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "style", | ||
typescriptOnly: true, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "Use a function declaration instead of a variable of function type."); | ||
function walk(ctx) { | ||
@@ -46,0 +43,0 @@ util_1.eachModuleStatement(ctx.sourceFile, statement => { |
@@ -26,19 +26,16 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
Rule.metadata = { | ||
ruleName: "strict-export-declare-modifiers", | ||
description: "Enforces strict rules about where the 'export' and 'declare' modifiers may appear.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "style", | ||
typescriptOnly: true, | ||
}; | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "strict-export-declare-modifiers", | ||
description: "Enforces strict rules about where the 'export' and 'declare' modifiers may appear.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "style", | ||
typescriptOnly: true, | ||
}; | ||
function walk(ctx) { | ||
@@ -45,0 +42,0 @@ const { sourceFile } = ctx; |
@@ -25,21 +25,18 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
Rule.metadata = { | ||
ruleName: "trim-file", | ||
description: "Forbids leading/trailing blank lines in a file. Allows file to end in '\n'.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "style", | ||
typescriptOnly: false, | ||
}; | ||
Rule.FAILURE_STRING_LEADING = util_1.failure(Rule.metadata.ruleName, "File should not begin with a blank line."); | ||
Rule.FAILURE_STRING_TRAILING = util_1.failure(Rule.metadata.ruleName, "File should not end with a blank line. (Ending in one newline OK, ending in two newlines not OK.)"); | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "trim-file", | ||
description: "Forbids leading/trailing blank lines in a file. Allows file to end in '\n'.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "style", | ||
typescriptOnly: false, | ||
}; | ||
Rule.FAILURE_STRING_LEADING = util_1.failure(Rule.metadata.ruleName, "File should not begin with a blank line."); | ||
Rule.FAILURE_STRING_TRAILING = util_1.failure(Rule.metadata.ruleName, "File should not end with a blank line. (Ending in one newline OK, ending in two newlines not OK.)"); | ||
function walk(ctx) { | ||
@@ -46,0 +43,0 @@ const { sourceFile: { text } } = ctx; |
@@ -26,21 +26,18 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
let Rule = /** @class */ (() => { | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
class Rule extends Lint.Rules.AbstractRule { | ||
apply(sourceFile) { | ||
return this.applyWithFunction(sourceFile, walk); | ||
} | ||
Rule.metadata = { | ||
ruleName: "void-return", | ||
description: "`void` may only be used as a return type.", | ||
rationale: "style", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "style", | ||
typescriptOnly: true, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "Use the `void` type for return types only. Otherwise, use `undefined`."); | ||
return Rule; | ||
})(); | ||
} | ||
exports.Rule = Rule; | ||
Rule.metadata = { | ||
ruleName: "void-return", | ||
description: "`void` may only be used as a return type.", | ||
rationale: "style", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
type: "style", | ||
typescriptOnly: true, | ||
}; | ||
Rule.FAILURE_STRING = util_1.failure(Rule.metadata.ruleName, "Use the `void` type for return types only. Otherwise, use `undefined`."); | ||
function walk(ctx) { | ||
@@ -47,0 +44,0 @@ ctx.sourceFile.forEachChild(function cb(node) { |
{ | ||
"name": "dtslint", | ||
"version": "3.6.4", | ||
"version": "3.6.6", | ||
"description": "Runs tests on TypeScript definition files", | ||
@@ -30,5 +30,5 @@ "files": [ | ||
"dependencies": { | ||
"@definitelytyped/header-parser": "0.0.34", | ||
"@definitelytyped/typescript-versions": "0.0.34", | ||
"@definitelytyped/utils": "0.0.34", | ||
"@definitelytyped/header-parser": "latest", | ||
"@definitelytyped/typescript-versions": "latest", | ||
"@definitelytyped/utils": "latest", | ||
"dts-critic": "^3.2.3", | ||
@@ -35,0 +35,0 @@ "fs-extra": "^6.0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
244428
3531
+ Addedsemver@6.3.1(transitive)
- Removed@definitelytyped/header-parser@0.0.34(transitive)
- Removed@definitelytyped/typescript-versions@0.0.34(transitive)
- Removed@definitelytyped/utils@0.0.34(transitive)
- Removed@types/node@12.20.55(transitive)
- Removed@types/parsimmon@1.10.9(transitive)
- Removedbl@1.2.3(transitive)
- Removedblock-stream@0.0.9(transitive)
- Removedbuffer-alloc@1.2.0(transitive)
- Removedbuffer-alloc-unsafe@1.1.0(transitive)
- Removedbuffer-fill@1.0.0(transitive)
- Removedconcat-stream@1.6.2(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedfs-constants@1.0.0(transitive)
- Removedfs-extra@8.1.0(transitive)
- Removedfstream@1.0.12(transitive)
- Removedhosted-git-info@2.8.9(transitive)
- Removednormalize-package-data@2.5.0(transitive)
- Removednpm-package-arg@6.1.1(transitive)
- Removednpm-registry-client@8.6.0(transitive)
- Removedos-homedir@1.0.2(transitive)
- Removedos-tmpdir@1.0.2(transitive)
- Removedosenv@0.1.5(transitive)
- Removedparsimmon@1.18.1(transitive)
- Removedretry@0.10.1(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedssri@5.3.0(transitive)
- Removedtar@2.2.2(transitive)
- Removedtar-stream@1.6.2(transitive)
- Removedto-buffer@1.1.1(transitive)
- Removedxtend@4.0.2(transitive)