Comparing version 4.0.0-dev.1 to 4.0.0-dev.2
113
CHANGELOG.md
Change Log | ||
=== | ||
v4.0.0-dev.2 | ||
--- | ||
* Include latest v4.0.0 changes | ||
v4.0.0 | ||
--- | ||
* **BREAKING CHANGES** | ||
* [api-change] Minor changes to the library API. See this PR for changes and upgrade instructions (#1720) | ||
* [removed-rule] Removed `no-unreachable` rule; covered by compiler (#661) | ||
* [enhancement] Changed order of applied configuration files for the `extends` array to make it more intuitive. (#1503) | ||
* [enhancement] Changed TypeScript peer dependency to >= 2.0.0 (#1710) | ||
* [new-rule] `completed-docs` rule added (#1644) | ||
* [new-fixer] `ordered-imports` auto fixed (#1640) | ||
* [new-fixer] `arrow-parens` auto fixed (#1731) | ||
* [rule-change] `indent` rule now ignores template strings (#1611) | ||
* [new-rule-option] `object-literal-key-quotes` adds the options `consistent` and `consistent-as-needed` (#1733) | ||
* [enhancement] `--fix` option added to automatically fix selected rules (#1697) | ||
* [enhancement] Updated recommend rules (#1717) | ||
* [enhancement] `adjacent-overload-signatures` now works with classes, source files, modules, and namespaces (#1707) | ||
* [enhancement] Users are notified if they are using an old TSLint version (#1696) | ||
* [bugfix] Lint `.jsx` files if `jsRules` are configured (#1714) | ||
* [bugfix] Command line glob patterns now handle single quotes (#1679) | ||
Thanks to our contributors! | ||
* Andrii Dieiev | ||
* Andy | ||
* Chris Barr | ||
* Davie Schoots | ||
* Jordan Hawker | ||
* Josh Goldberg | ||
* Stepan Riha | ||
* Yuichi Nukiyama | ||
v4.0.0-dev.1 | ||
--- | ||
* TODO | ||
* **BREAKING CHANGES** | ||
* [enhancement] The `semicolon` rule now disallows semicolons in multi-line bound class methods | ||
(to get the v3 behavior, use the `ignore-bound-class-methods` option) (#1643) | ||
* [removed-rule] Removed `use-strict` rule (#678) | ||
* [removed-rule] Removed `label-undefined` rule; covered by compiler (#1614) | ||
* [enhancement] Renamed `no-constructor-vars` to `no-parameter-properties` (#1296) | ||
* [rule-change] The `orderedImports` rule now sorts relative modules below non-relative modules (#1640) | ||
* **Deprecated** | ||
* [deprecated] `no-unused-variable` rule. This is checked by the TypeScript v2 compiler using the flags [`--noUnusedParameters` and `--noUnusedLocals`](https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript#flag-unused-declarations-with---nounusedparameters-and---nounusedlocals). (#1481) | ||
* [enhancement] Lint .js files (#1515) | ||
* [new-fixer] `no-var-keyword` replaces `var` with `let` (#1547) | ||
* [new-fixer] `trailing-comma` auto fixed (#1546) | ||
* [new-fixer] `no-unused-variable` auto fixed for imports (#1568) | ||
* [new-fixer] `semicolon` auto fixed (#1423) | ||
* [new-rule] `max-classes-per-file` rule added (#1666) | ||
* [new-rule-option] `no-consecutive-blank-lines` rule now accepts a number value indicating max blank lines (#1650) | ||
* [new-rule-option] `ordered-inputs` rule option `input-sources-order` accepts value `any` (#1602) | ||
* [bugfix] `no-empty` rule fixed when parameter has readonly modifier | ||
* [bugfix] `no-namespace` rule: do not flag nested or .d.ts namespaces (#1571) | ||
Thanks to our contributors! | ||
* Alex Eagle | ||
* Andrii Dieiev | ||
* Ben Coveney | ||
* Boris Aranovich | ||
* Chris Barr | ||
* Cyril Gandon | ||
* Evgeniy Zhukovskiy | ||
* Jay Anslow | ||
* Kunal Marwaha | ||
* Martin Probst | ||
* Mingye Wang | ||
* Raghav Katyal | ||
* Sean Dawson | ||
* Yuichi Nukiyama | ||
* jakpaw | ||
v4.0.0-dev.0 | ||
--- | ||
* TODO | ||
* **BREAKING CHANGES** | ||
* [enhancement] Drop support for configuration via package.json (#1579) | ||
* [removed-rule] Removed `no-duplicate-key` rule; covered by compiler (#1109) | ||
* [enhancement] Call formatter once for all file results. Format output may be different (#656) | ||
* [rule-change] `trailing-comma` supports function declarations, expressions, and types (#1486) | ||
* [rule-change] `object-literal-sort-keys` now sorts quoted keys (#1529) | ||
* [rule-change] `semicolon` now processes type aliases (#1475) | ||
* [rule-change] `no-var-keyword` now rejects `export var` statements (#1256) | ||
* [rule-change] `semicolon` now requires semicolon for function declaration with no body (#1447) | ||
* [new-formatter] `fileslist` formatter writes a list of files with errors without position or error type specifics (#1558) | ||
* [new-rule] `cyclomaticComplexity`, enforces a threshold of cyclomatic complexity.] (#1464) | ||
* [new-rule] `prefer-for-of`, which errors when `for(var x of y)` can be used instead of `for(var i = 0; i < y.length; i++)` (#1335) | ||
* [new-rule] `array-type`, which can require using either `T[]' or 'Array<T>' for arrays (#1498) | ||
* [rule-change] `object-literal-sort-keys` checks multiline objects only (#1642) | ||
* [rule-change] `ban` rule now can ban global functions (#327) | ||
* [bugfix] always write lint result, even if using formatter (#1353) | ||
* [bugfix] npm run test:bin fails on Windows (#1635) | ||
* [bugfix] Don't enforce trailing spaces on newlines in typedef-whitespace rule (#1531) | ||
* [bugfix] `jsdoc` rule should not match arbitrary comments (#1543) | ||
* [bugfix] `one-line` rule errors when declaring wildcard ambient modules (#1425) | ||
Thanks to our contributors! | ||
* Alex Eagle | ||
* Andrii Dieiev | ||
* Andy Hanson | ||
* Ben Coveney | ||
* Boris Aranovich | ||
* Chris Barr | ||
* Christian Dreher | ||
* Claas Augner | ||
* Josh Goldberg | ||
* Martin Probst | ||
* Mike Deverell | ||
* Nina Hartmann | ||
* Satoshi Amemiya | ||
* Scott Wu | ||
* Steve Van Opstal | ||
* Umar Bolatov | ||
* Vladimir Matveev | ||
* Yui | ||
v3.15.1 | ||
@@ -13,0 +122,0 @@ --- |
@@ -17,15 +17,4 @@ /** | ||
*/ | ||
export declare const rules: { | ||
"adjacent-overload-signatures": boolean; | ||
"cyclomatic-complexity": boolean; | ||
"no-unsafe-finally": boolean; | ||
"object-literal-key-quotes": (string | boolean)[]; | ||
"object-literal-shorthand": boolean; | ||
"only-arrow-functions": (string | boolean)[]; | ||
"ordered-imports": (boolean | { | ||
"import-sources-order": string; | ||
"named-imports-order": string; | ||
})[]; | ||
}; | ||
export declare const rules: {}; | ||
declare const xtends: string; | ||
export { xtends as extends }; |
@@ -18,16 +18,5 @@ /** | ||
"use strict"; | ||
exports.rules = { | ||
"adjacent-overload-signatures": true, | ||
"cyclomatic-complexity": false, | ||
"no-unsafe-finally": true, | ||
"object-literal-key-quotes": [true, "as-needed"], | ||
"object-literal-shorthand": true, | ||
"only-arrow-functions": [true, "allow-declarations"], | ||
"ordered-imports": [true, { | ||
"import-sources-order": "case-insensitive", | ||
"named-imports-order": "lowercase-last", | ||
}], | ||
}; | ||
exports.rules = {}; | ||
// work around "extends" being a keyword | ||
var xtends = "tslint:recommended"; | ||
exports.extends = xtends; |
@@ -18,6 +18,10 @@ /** | ||
export declare const rules: { | ||
"adjacent-overload-signatures": boolean; | ||
"align": (string | boolean)[]; | ||
"array-type": (string | boolean)[]; | ||
"arrow-parens": boolean; | ||
"class-name": boolean; | ||
"comment-format": (string | boolean)[]; | ||
"curly": boolean; | ||
"cyclomatic-complexity": boolean; | ||
"eofline": boolean; | ||
@@ -29,2 +33,3 @@ "forin": boolean; | ||
"label-position": boolean; | ||
"max-classes-per-file": (number | boolean)[]; | ||
"max-line-length": (number | boolean)[]; | ||
@@ -44,3 +49,2 @@ "member-access": boolean; | ||
"no-debugger": boolean; | ||
"no-duplicate-variable": boolean; | ||
"no-empty": boolean; | ||
@@ -56,3 +60,3 @@ "no-eval": boolean; | ||
"no-trailing-whitespace": boolean; | ||
"no-unreachable": boolean; | ||
"no-unsafe-finally": boolean; | ||
"no-unused-expression": boolean; | ||
@@ -64,5 +68,13 @@ "no-unused-new": boolean; | ||
"no-var-requires": boolean; | ||
"object-literal-key-quotes": (string | boolean)[]; | ||
"object-literal-shorthand": boolean; | ||
"object-literal-sort-keys": boolean; | ||
"one-line": (string | boolean)[]; | ||
"one-variable-per-declaration": (string | boolean)[]; | ||
"only-arrow-functions": (string | boolean)[]; | ||
"ordered-imports": (boolean | { | ||
"import-sources-order": string; | ||
"named-imports-order": string; | ||
})[]; | ||
"prefer-for-of": boolean; | ||
"quotemark": (string | boolean)[]; | ||
@@ -107,3 +119,2 @@ "radix": boolean; | ||
"no-debugger": boolean; | ||
"no-duplicate-key": boolean; | ||
"no-duplicate-variable": boolean; | ||
@@ -117,3 +128,2 @@ "no-empty": boolean; | ||
"no-trailing-whitespace": boolean; | ||
"no-unreachable": boolean; | ||
"no-unused-expression": boolean; | ||
@@ -120,0 +130,0 @@ "no-unused-new": boolean; |
@@ -20,2 +20,3 @@ /** | ||
exports.rules = { | ||
"adjacent-overload-signatures": true, | ||
"align": [true, | ||
@@ -25,2 +26,4 @@ "parameters", | ||
], | ||
"array-type": [true, "array-simple"], | ||
"arrow-parens": true, | ||
"class-name": true, | ||
@@ -31,2 +34,3 @@ "comment-format": [true, | ||
"curly": true, | ||
"cyclomatic-complexity": false, | ||
"eofline": true, | ||
@@ -38,2 +42,3 @@ "forin": true, | ||
"label-position": true, | ||
"max-classes-per-file": [true, 1], | ||
"max-line-length": [true, 120], | ||
@@ -60,3 +65,2 @@ "member-access": true, | ||
"no-debugger": true, | ||
"no-duplicate-variable": true, | ||
"no-empty": true, | ||
@@ -72,3 +76,3 @@ "no-eval": true, | ||
"no-trailing-whitespace": true, | ||
"no-unreachable": true, | ||
"no-unsafe-finally": true, | ||
"no-unused-expression": true, | ||
@@ -82,2 +86,4 @@ "no-unused-new": true, | ||
"no-var-requires": true, | ||
"object-literal-key-quotes": [true, "consistent-as-needed"], | ||
"object-literal-shorthand": true, | ||
"object-literal-sort-keys": true, | ||
@@ -94,2 +100,8 @@ "one-line": [true, | ||
], | ||
"only-arrow-functions": [true, "allow-declarations"], | ||
"ordered-imports": [true, { | ||
"import-sources-order": "case-insensitive", | ||
"named-imports-order": "case-insensitive", | ||
}], | ||
"prefer-for-of": true, | ||
"quotemark": [true, "double", "avoid-escape"], | ||
@@ -165,3 +177,2 @@ "radix": true, | ||
"no-debugger": true, | ||
"no-duplicate-key": true, | ||
"no-duplicate-variable": true, | ||
@@ -175,3 +186,2 @@ "no-empty": true, | ||
"no-trailing-whitespace": true, | ||
"no-unreachable": true, | ||
"no-unused-expression": true, | ||
@@ -178,0 +188,0 @@ "no-unused-new": true, |
@@ -10,2 +10,14 @@ export interface IConfigurationFile { | ||
} | ||
/** | ||
* Define `Error` here to avoid using `Error` from @types/node. | ||
* Using the `node` version causes a compilation error when this code is used as an npm library if @types/node is not already imported. | ||
*/ | ||
export interface Error { | ||
message: string; | ||
} | ||
export interface IConfigurationLoadResult { | ||
error?: Error; | ||
path: string; | ||
results?: IConfigurationFile; | ||
} | ||
export declare const CONFIG_FILENAME: string; | ||
@@ -21,3 +33,2 @@ export declare const DEFAULT_CONFIG: { | ||
"no-unsafe-finally": boolean; | ||
"no-var-keyword": boolean; | ||
"one-line": (string | boolean)[]; | ||
@@ -34,3 +45,2 @@ "quotemark": (string | boolean)[]; | ||
"indent": (string | boolean)[]; | ||
"no-duplicate-variable": boolean; | ||
"no-eval": boolean; | ||
@@ -61,5 +71,5 @@ "no-internal-module": boolean; | ||
* of the search for a configuration. | ||
* @returns A TSLint configuration object | ||
* @returns Load status for a TSLint configuration object | ||
*/ | ||
export declare function findConfiguration(configFile: string, inputFilePath: string): IConfigurationFile; | ||
export declare function findConfiguration(configFile: string, inputFilePath: string): IConfigurationLoadResult; | ||
/** | ||
@@ -85,3 +95,3 @@ * Searches for a TSLint configuration and returns the path to it. | ||
export declare function loadConfigurationFromPath(configFilePath: string): IConfigurationFile; | ||
export declare function extendConfigurationFile(config: IConfigurationFile, baseConfig: IConfigurationFile): IConfigurationFile; | ||
export declare function extendConfigurationFile(targetConfig: IConfigurationFile, nextConfigSource: IConfigurationFile): IConfigurationFile; | ||
export declare function getRelativePath(directory: string, relativeTo?: string): string; | ||
@@ -88,0 +98,0 @@ /** |
@@ -34,3 +34,2 @@ /** | ||
"no-unsafe-finally": true, | ||
"no-var-keyword": true, | ||
"one-line": [true, "check-open-brace", "check-whitespace"], | ||
@@ -53,3 +52,2 @@ "quotemark": [true, "double"], | ||
"indent": [true, "spaces"], | ||
"no-duplicate-variable": true, | ||
"no-eval": true, | ||
@@ -90,7 +88,14 @@ "no-internal-module": true, | ||
* of the search for a configuration. | ||
* @returns A TSLint configuration object | ||
* @returns Load status for a TSLint configuration object | ||
*/ | ||
function findConfiguration(configFile, inputFilePath) { | ||
var configPath = findConfigurationPath(configFile, inputFilePath); | ||
return loadConfigurationFromPath(configPath); | ||
var path = findConfigurationPath(configFile, inputFilePath); | ||
var loadResult = { path: path }; | ||
try { | ||
loadResult.results = loadConfigurationFromPath(path); | ||
} | ||
catch (error) { | ||
loadResult.error = error; | ||
} | ||
return loadResult; | ||
} | ||
@@ -161,12 +166,11 @@ exports.findConfiguration = findConfiguration; | ||
} | ||
var configFileDir = path.dirname(resolvedConfigFilePath); | ||
configFile.rulesDirectory = getRulesDirectories(configFile.rulesDirectory, configFileDir); | ||
configFile.extends = utils_1.arrayify(configFile.extends); | ||
for (var _i = 0, _a = configFile.extends; _i < _a.length; _i++) { | ||
var name_1 = _a[_i]; | ||
var baseConfigFilePath = resolveConfigurationPath(name_1, configFileDir); | ||
var baseConfigFile = loadConfigurationFromPath(baseConfigFilePath); | ||
configFile = extendConfigurationFile(configFile, baseConfigFile); | ||
} | ||
return configFile; | ||
var configFileDir_1 = path.dirname(resolvedConfigFilePath); | ||
configFile.rulesDirectory = getRulesDirectories(configFile.rulesDirectory, configFileDir_1); | ||
// load configurations, in order, using their identifiers or relative paths | ||
// apply the current configuration last by placing it last in this array | ||
var configs = utils_1.arrayify(configFile.extends).map(function (name) { | ||
var nextConfigFilePath = resolveConfigurationPath(name, configFileDir_1); | ||
return loadConfigurationFromPath(nextConfigFilePath); | ||
}).concat([configFile]); | ||
return configs.reduce(extendConfigurationFile, {}); | ||
} | ||
@@ -206,25 +210,23 @@ } | ||
} | ||
function extendConfigurationFile(config, baseConfig) { | ||
function extendConfigurationFile(targetConfig, nextConfigSource) { | ||
var combinedConfig = {}; | ||
var baseRulesDirectory = utils_1.arrayify(baseConfig.rulesDirectory); | ||
var configRulesDirectory = utils_1.arrayify(config.rulesDirectory); | ||
combinedConfig.rulesDirectory = configRulesDirectory.concat(baseRulesDirectory); | ||
combinedConfig.rules = {}; | ||
for (var _i = 0, _a = Object.keys(utils_1.objectify(baseConfig.rules)); _i < _a.length; _i++) { | ||
var name_2 = _a[_i]; | ||
combinedConfig.rules[name_2] = baseConfig.rules[name_2]; | ||
} | ||
for (var _b = 0, _c = Object.keys(utils_1.objectify(config.rules)); _b < _c.length; _b++) { | ||
var name_3 = _c[_b]; | ||
combinedConfig.rules[name_3] = config.rules[name_3]; | ||
} | ||
combinedConfig.jsRules = {}; | ||
for (var _d = 0, _e = Object.keys(utils_1.objectify(baseConfig.jsRules)); _d < _e.length; _d++) { | ||
var name_4 = _e[_d]; | ||
combinedConfig.jsRules[name_4] = baseConfig.jsRules[name_4]; | ||
} | ||
for (var _f = 0, _g = Object.keys(utils_1.objectify(config.jsRules)); _f < _g.length; _f++) { | ||
var name_5 = _g[_f]; | ||
combinedConfig.jsRules[name_5] = config.jsRules[name_5]; | ||
} | ||
var configRulesDirectory = utils_1.arrayify(targetConfig.rulesDirectory); | ||
var nextConfigRulesDirectory = utils_1.arrayify(nextConfigSource.rulesDirectory); | ||
combinedConfig.rulesDirectory = configRulesDirectory.concat(nextConfigRulesDirectory); | ||
var combineProperties = function (targetProperty, nextProperty) { | ||
var combinedProperty = {}; | ||
for (var _i = 0, _a = Object.keys(utils_1.objectify(targetProperty)); _i < _a.length; _i++) { | ||
var name_1 = _a[_i]; | ||
combinedProperty[name_1] = targetProperty[name_1]; | ||
} | ||
// next config source overwrites the target config object | ||
for (var _b = 0, _c = Object.keys(utils_1.objectify(nextProperty)); _b < _c.length; _b++) { | ||
var name_2 = _c[_b]; | ||
combinedProperty[name_2] = nextProperty[name_2]; | ||
} | ||
return combinedProperty; | ||
}; | ||
combinedConfig.rules = combineProperties(targetConfig.rules, nextConfigSource.rules); | ||
combinedConfig.jsRules = combineProperties(targetConfig.jsRules, nextConfigSource.jsRules); | ||
combinedConfig.linterOptions = combineProperties(targetConfig.linterOptions, nextConfigSource.linterOptions); | ||
return combinedConfig; | ||
@@ -231,0 +233,0 @@ } |
@@ -22,3 +22,3 @@ /** | ||
static metadata: IFormatterMetadata; | ||
format(failures: RuleFailure[]): string; | ||
format(failures: RuleFailure[], fixes?: RuleFailure[]): string; | ||
} |
@@ -30,7 +30,25 @@ /** | ||
/* tslint:enable:object-literal-sort-keys */ | ||
Formatter.prototype.format = function (failures) { | ||
if (failures.length === 0) { | ||
Formatter.prototype.format = function (failures, fixes) { | ||
if (failures.length === 0 && (!fixes || fixes.length === 0)) { | ||
return ""; | ||
} | ||
var outputLines = failures.map(function (failure) { | ||
var fixLines = []; | ||
if (fixes) { | ||
var perFileFixes_1 = {}; | ||
for (var _i = 0, fixes_1 = fixes; _i < fixes_1.length; _i++) { | ||
var fix = fixes_1[_i]; | ||
if (perFileFixes_1[fix.getFileName()] == null) { | ||
perFileFixes_1[fix.getFileName()] = 1; | ||
} | ||
else { | ||
perFileFixes_1[fix.getFileName()]++; | ||
} | ||
} | ||
Object.keys(perFileFixes_1).forEach(function (fixedFile) { | ||
var fixCount = perFileFixes_1[fixedFile]; | ||
fixLines.push("Fixed " + fixCount + " error(s) in " + fixedFile); | ||
}); | ||
fixLines.push(""); // add a blank line between fixes and failures | ||
} | ||
var errorLines = failures.map(function (failure) { | ||
var fileName = failure.getFileName(); | ||
@@ -42,3 +60,3 @@ var failureString = failure.getFailure(); | ||
}); | ||
return outputLines.join("\n") + "\n"; | ||
return fixLines.concat(errorLines).join("\n") + "\n"; | ||
}; | ||
@@ -45,0 +63,0 @@ /* tslint:disable:object-literal-sort-keys */ |
@@ -50,6 +50,7 @@ /** | ||
var failureString = failure.getFailure(); | ||
failureString = colors.yellow(failureString); | ||
// Rule | ||
var ruleName = failure.getRuleName(); | ||
ruleName = this.pad(ruleName, ruleMaxSize); | ||
ruleName = colors.yellow(ruleName); | ||
ruleName = colors.grey(ruleName); | ||
// Lines | ||
@@ -56,0 +57,0 @@ var lineAndCharacter = failure.getStartPosition().getLineAndCharacter(); |
@@ -42,3 +42,8 @@ /** | ||
export interface IFormatter { | ||
format(failures: RuleFailure[]): string; | ||
/** | ||
* Formats linter results | ||
* @param {RuleFailure[]} failures Linter errors that were not fixed | ||
* @param {RuleFailure[]} fixes Fixed linter errors. Available when the `--fix` argument is used on the command line | ||
*/ | ||
format(failures: RuleFailure[], fixes?: RuleFailure[]): string; | ||
} |
@@ -18,5 +18,4 @@ /** | ||
import * as ts from "typescript"; | ||
import { IOptions } from "../../lint"; | ||
import { RuleWalker } from "../walker/ruleWalker"; | ||
import { IDisabledInterval, IRule, IRuleMetadata, RuleFailure } from "./rule"; | ||
import { IDisabledInterval, IOptions, IRule, IRuleMetadata, RuleFailure } from "./rule"; | ||
export declare abstract class AbstractRule implements IRule { | ||
@@ -23,0 +22,0 @@ private value; |
@@ -43,3 +43,3 @@ /** | ||
*/ | ||
optionsDescription?: string; | ||
optionsDescription: string; | ||
/** | ||
@@ -65,5 +65,5 @@ * Schema of the options the rule accepts. | ||
/** | ||
* Whether or not the rule use for TypeScript only. | ||
* Whether or not the rule use for TypeScript only. If `false`, this rule may be used with .js files. | ||
*/ | ||
typescriptOnly?: boolean; | ||
typescriptOnly: boolean; | ||
} | ||
@@ -70,0 +70,0 @@ export declare type RuleType = "functionality" | "maintainability" | "style" | "typescript"; |
@@ -19,6 +19,7 @@ /** | ||
import { AbstractRule } from "./abstractRule"; | ||
import { RuleFailure } from "./rule"; | ||
import { IRule, RuleFailure } from "./rule"; | ||
export declare abstract class TypedRule extends AbstractRule { | ||
static isTypedRule(rule: IRule): rule is TypedRule; | ||
apply(_sourceFile: ts.SourceFile): RuleFailure[]; | ||
abstract applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[]; | ||
} |
@@ -29,2 +29,5 @@ /** | ||
} | ||
TypedRule.isTypedRule = function (rule) { | ||
return "applyWithProgram" in rule; | ||
}; | ||
TypedRule.prototype.apply = function (_sourceFile) { | ||
@@ -31,0 +34,0 @@ // if no program is given to the linter, throw an error |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import { IOptions } from "../../lint"; | ||
import { IOptions } from "../rule/rule"; | ||
import { RuleWalker } from "./ruleWalker"; | ||
@@ -21,0 +21,0 @@ export declare class ProgramAwareRuleWalker extends RuleWalker { |
@@ -18,4 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import { IOptions } from "../../lint"; | ||
import { Fix, Replacement, RuleFailure } from "../rule/rule"; | ||
import { Fix, IOptions, Replacement, RuleFailure } from "../rule/rule"; | ||
import { SyntaxWalker } from "./syntaxWalker"; | ||
@@ -22,0 +21,0 @@ export declare class RuleWalker extends SyntaxWalker { |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import { IOptions } from "../../lint"; | ||
import { IOptions } from "../rule/rule"; | ||
import { RuleWalker } from "./ruleWalker"; | ||
@@ -21,0 +21,0 @@ export declare class SkippableTokenAwareRuleWalker extends RuleWalker { |
@@ -37,3 +37,3 @@ /** | ||
else { | ||
if (isJs && Rule.metadata.typescriptOnly != null && Rule.metadata.typescriptOnly) { | ||
if (isJs && Rule.metadata && Rule.metadata.typescriptOnly != null && Rule.metadata.typescriptOnly) { | ||
notAllowedInJsRules.push(ruleName); | ||
@@ -60,3 +60,3 @@ } | ||
else if (notAllowedInJsRules.length > 0) { | ||
var JS_ERROR_MESSAGE = "\n Could not apply to JavaScript files for the following rules specified in the configuration:\n " + notAllowedInJsRules.join("\n") + "\n "; | ||
var JS_ERROR_MESSAGE = "\n Following rules specified in configuration couldn't be applied to .js or .jsx files:\n " + notAllowedInJsRules.join("\n") + "\n\n Make sure to exclude them from \"jsRules\" section of your tslint.json.\n "; | ||
throw new Error(JS_ERROR_MESSAGE); | ||
@@ -63,0 +63,0 @@ } |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -41,2 +41,3 @@ __extends(Rule, _super); | ||
optionExamples: ["true"], | ||
rationale: "Improves readability and organization by grouping naturally related items together.", | ||
type: "typescript", | ||
@@ -46,3 +47,5 @@ typescriptOnly: true, | ||
/* tslint:enable:object-literal-sort-keys */ | ||
Rule.FAILURE_STRING_FACTORY = function (name) { return ("All '" + name + "' signatures should be adjacent"); }; | ||
Rule.FAILURE_STRING_FACTORY = function (name) { | ||
return "All '" + name + "' signatures should be adjacent"; | ||
}; | ||
return Rule; | ||
@@ -56,28 +59,53 @@ }(Lint.Rules.AbstractRule)); | ||
} | ||
AdjacentOverloadSignaturesWalker.prototype.visitSourceFile = function (node) { | ||
this.visitStatements(node.statements); | ||
_super.prototype.visitSourceFile.call(this, node); | ||
}; | ||
AdjacentOverloadSignaturesWalker.prototype.visitModuleDeclaration = function (node) { | ||
var body = node.body; | ||
if (body && body.kind === ts.SyntaxKind.ModuleBlock) { | ||
this.visitStatements(body.statements); | ||
} | ||
_super.prototype.visitModuleDeclaration.call(this, node); | ||
}; | ||
AdjacentOverloadSignaturesWalker.prototype.visitInterfaceDeclaration = function (node) { | ||
this.checkNode(node); | ||
this.checkOverloadsAdjacent(node.members, function (member) { return member.name && getTextOfPropertyName(member.name); }); | ||
_super.prototype.visitInterfaceDeclaration.call(this, node); | ||
}; | ||
AdjacentOverloadSignaturesWalker.prototype.visitClassDeclaration = function (node) { | ||
this.visitMembers(node.members); | ||
_super.prototype.visitClassDeclaration.call(this, node); | ||
}; | ||
AdjacentOverloadSignaturesWalker.prototype.visitTypeLiteral = function (node) { | ||
this.checkNode(node); | ||
this.visitMembers(node.members); | ||
_super.prototype.visitTypeLiteral.call(this, node); | ||
}; | ||
AdjacentOverloadSignaturesWalker.prototype.checkNode = function (node) { | ||
AdjacentOverloadSignaturesWalker.prototype.visitStatements = function (statements) { | ||
this.checkOverloadsAdjacent(statements, function (statement) { | ||
if (statement.kind === ts.SyntaxKind.FunctionDeclaration) { | ||
var name_1 = statement.name; | ||
return name_1 && name_1.text; | ||
} | ||
else { | ||
return undefined; | ||
} | ||
}); | ||
}; | ||
AdjacentOverloadSignaturesWalker.prototype.visitMembers = function (members) { | ||
this.checkOverloadsAdjacent(members, function (member) { return member.name && getTextOfPropertyName(member.name); }); | ||
}; | ||
/** 'getOverloadName' may return undefined for nodes that cannot be overloads, e.g. a `const` declaration. */ | ||
AdjacentOverloadSignaturesWalker.prototype.checkOverloadsAdjacent = function (overloads, getOverloadName) { | ||
var last = undefined; | ||
var seen = {}; | ||
for (var _i = 0, _a = node.members; _i < _a.length; _i++) { | ||
var member = _a[_i]; | ||
if (member.name !== undefined) { | ||
var methodName = getTextOfPropertyName(member.name); | ||
if (methodName !== undefined) { | ||
if (seen.hasOwnProperty(methodName) && last !== methodName) { | ||
this.addFailure(this.createFailure(member.getStart(), member.getWidth(), Rule.FAILURE_STRING_FACTORY(methodName))); | ||
} | ||
last = methodName; | ||
seen[methodName] = true; | ||
var seen = Object.create(null); | ||
for (var _i = 0, overloads_1 = overloads; _i < overloads_1.length; _i++) { | ||
var node = overloads_1[_i]; | ||
var name_2 = getOverloadName(node); | ||
if (name_2 !== undefined) { | ||
if (name_2 in seen && last !== name_2) { | ||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING_FACTORY(name_2))); | ||
} | ||
seen[name_2] = true; | ||
} | ||
else { | ||
last = undefined; | ||
} | ||
last = name_2; | ||
} | ||
@@ -84,0 +112,0 @@ }; |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -23,3 +23,3 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -26,0 +26,0 @@ __extends(Rule, _super); |
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -4,0 +4,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -8,3 +8,3 @@ "use strict"; | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var OPTION_ARRAY = "array"; | ||
@@ -11,0 +11,0 @@ var OPTION_GENERIC = "generic"; |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -71,3 +71,4 @@ __extends(Rule, _super); | ||
&& !isGenerics && node.flags !== ts.NodeFlags.Async) { | ||
this.addFailure(this.createFailure(position, width, Rule.FAILURE_STRING)); | ||
var fix = new Lint.Fix(Rule.metadata.ruleName, [new Lint.Replacement(position, width, "(" + parameter.getText() + ")")]); | ||
this.addFailure(this.createFailure(position, width, Rule.FAILURE_STRING, fix)); | ||
} | ||
@@ -74,0 +75,0 @@ } |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -23,3 +23,3 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -26,0 +26,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var OPTION_SPACE = "check-space"; | ||
@@ -27,0 +27,0 @@ var OPTION_LOWERCASE = "check-lowercase"; |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -17,3 +17,3 @@ /** | ||
*/ | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
import * as ts from "typescript"; | ||
@@ -20,0 +20,0 @@ export declare class Rule extends Lint.Rules.AbstractRule { |
@@ -23,3 +23,3 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var ts = require("typescript"); | ||
@@ -61,9 +61,10 @@ var Rule = (function (_super) { | ||
type: "maintainability", | ||
typescriptOnly: false, | ||
}; | ||
/* tslint:enable:object-literal-sort-keys */ | ||
Rule.ANONYMOUS_FAILURE_STRING = function (expected, actual) { | ||
return ("The function has a cyclomatic complexity of " + actual + " which is higher than the threshold of " + expected); | ||
return "The function has a cyclomatic complexity of " + actual + " which is higher than the threshold of " + expected; | ||
}; | ||
Rule.NAMED_FAILURE_STRING = function (expected, actual, name) { | ||
return ("The function " + name + " has a cyclomatic complexity of " + actual + " which is higher than the threshold of " + expected); | ||
return "The function " + name + " has a cyclomatic complexity of " + actual + " which is higher than the threshold of " + expected; | ||
}; | ||
@@ -70,0 +71,0 @@ return Rule; |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -23,3 +23,3 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -26,0 +26,0 @@ __extends(Rule, _super); |
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -4,0 +4,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -7,3 +7,3 @@ "use strict"; | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -10,0 +10,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var OPTION_USE_TABS = "tabs"; | ||
@@ -77,7 +77,8 @@ var OPTION_USE_SPACES = "spaces"; | ||
var endOfComment = -1; | ||
var endOfTemplateString = -1; | ||
var scanner = ts.createScanner(ts.ScriptTarget.ES5, false, ts.LanguageVariant.Standard, node.text); | ||
for (var _i = 0, _a = node.getLineStarts(); _i < _a.length; _i++) { | ||
var lineStart = _a[_i]; | ||
if (lineStart < endOfComment) { | ||
// skip checking lines inside multi-line comments | ||
if (lineStart < endOfComment || lineStart < endOfTemplateString) { | ||
// skip checking lines inside multi-line comments or template strings | ||
continue; | ||
@@ -102,2 +103,24 @@ } | ||
} | ||
else { | ||
var scanType = currentScannedType; | ||
// scan until we reach end of line, skipping over template strings | ||
while (scanType !== ts.SyntaxKind.NewLineTrivia && scanType !== ts.SyntaxKind.EndOfFileToken) { | ||
if (scanType === ts.SyntaxKind.NoSubstitutionTemplateLiteral) { | ||
// template string without expressions - skip past it | ||
endOfTemplateString = scanner.getStartPos() + scanner.getTokenText().length; | ||
} | ||
else if (scanType === ts.SyntaxKind.TemplateHead) { | ||
// find end of template string containing expressions... | ||
while (scanType !== ts.SyntaxKind.TemplateTail && scanType !== ts.SyntaxKind.EndOfFileToken) { | ||
scanType = scanner.scan(); | ||
if (scanType === ts.SyntaxKind.CloseBraceToken) { | ||
scanType = scanner.reScanTemplateToken(); | ||
} | ||
} | ||
// ... and skip past it | ||
endOfTemplateString = scanner.getStartPos() + scanner.getTokenText().length; | ||
} | ||
scanType = scanner.scan(); | ||
} | ||
} | ||
if (currentScannedType === ts.SyntaxKind.SingleLineCommentTrivia | ||
@@ -104,0 +127,0 @@ || currentScannedType === ts.SyntaxKind.MultiLineCommentTrivia |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -23,3 +23,3 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var OPTION_ALWAYS = "always-prefix"; | ||
@@ -26,0 +26,0 @@ var OPTION_NEVER = "never-prefix"; |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var OPTION_LINEBREAK_STYLE_CRLF = "CRLF"; | ||
@@ -27,0 +27,0 @@ var OPTION_LINEBREAK_STYLE_LF = "LF"; |
@@ -1,2 +0,2 @@ | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
import * as ts from "typescript"; | ||
@@ -3,0 +3,0 @@ export declare class Rule extends Lint.Rules.AbstractRule { |
@@ -7,3 +7,3 @@ "use strict"; | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -37,2 +37,3 @@ __extends(Rule, _super); | ||
type: "maintainability", | ||
typescriptOnly: false, | ||
}; | ||
@@ -39,0 +40,0 @@ /* tslint:enable:object-literal-sort-keys */ |
@@ -17,3 +17,3 @@ /** | ||
*/ | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
import * as ts from "typescript"; | ||
@@ -20,0 +20,0 @@ export declare class Rule extends Lint.Rules.AbstractRule { |
@@ -23,3 +23,3 @@ "use strict"; | ||
*/ | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -26,0 +26,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -23,3 +23,3 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -26,0 +26,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ "use strict"; | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
/* start old options */ | ||
@@ -27,0 +27,0 @@ var OPTION_VARIABLES_BEFORE_FUNCTIONS = "variables-before-functions"; |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -23,3 +23,3 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -26,0 +26,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -23,3 +23,3 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -26,0 +26,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -23,3 +23,3 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -26,0 +26,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static DEFAULT_ALLOWED_BLANKS: number; |
@@ -23,3 +23,3 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -26,0 +26,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
import * as BanRule from "./banRule"; | ||
@@ -21,0 +21,0 @@ export declare class Rule extends BanRule.Rule { |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -23,3 +23,3 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -26,0 +26,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -47,3 +47,5 @@ __extends(Rule, _super); | ||
/* tslint:enable:object-literal-sort-keys */ | ||
Rule.FAILURE_STRING_FACTORY = function (name) { return ("Duplicate variable: '" + name + "'"); }; | ||
Rule.FAILURE_STRING_FACTORY = function (name) { | ||
return "Duplicate variable: '" + name + "'"; | ||
}; | ||
return Rule; | ||
@@ -50,0 +52,0 @@ var _a, _b; |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.TypedRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var OPTION_IGNORE_PARMS = "ignore-params"; | ||
@@ -55,3 +55,5 @@ var Rule = (function (_super) { | ||
/* tslint:enable:object-literal-sort-keys */ | ||
Rule.FAILURE_STRING_FACTORY = function (type) { return ("LHS type (" + type + ") inferred by RHS expression, remove type annotation"); }; | ||
Rule.FAILURE_STRING_FACTORY = function (type) { | ||
return "LHS type (" + type + ") inferred by RHS expression, remove type annotation"; | ||
}; | ||
return Rule; | ||
@@ -58,0 +60,0 @@ var _a; |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var OPTION_FUNCTION_IN_METHOD = "check-function-in-method"; | ||
@@ -27,0 +27,0 @@ var DEPRECATED_OPTION_FUNCTION_IN_METHOD = "no-this-in-function-in-method"; |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -25,3 +25,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -28,0 +28,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -23,3 +23,3 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -45,3 +45,5 @@ __extends(Rule, _super); | ||
/* tslint:enable:object-literal-sort-keys */ | ||
Rule.FAILURE_STRING_FACTORY = function (ident) { return ("Property '" + ident + "' cannot be declared in the constructor"); }; | ||
Rule.FAILURE_STRING_FACTORY = function (ident) { | ||
return "Property '" + ident + "' cannot be declared in the constructor"; | ||
}; | ||
return Rule; | ||
@@ -48,0 +50,0 @@ var _a; |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -23,3 +23,3 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -26,0 +26,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -46,3 +46,5 @@ __extends(Rule, _super); | ||
/* tslint:enable:object-literal-sort-keys */ | ||
Rule.FAILURE_STRING_FACTORY = function (name) { return ("Shadowed variable: '" + name + "'"); }; | ||
Rule.FAILURE_STRING_FACTORY = function (name) { | ||
return "Shadowed variable: '" + name + "'"; | ||
}; | ||
return Rule; | ||
@@ -49,0 +51,0 @@ }(Lint.Rules.AbstractRule)); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -17,3 +17,3 @@ /** | ||
*/ | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
import * as ts from "typescript"; | ||
@@ -20,0 +20,0 @@ export declare class Rule extends Lint.Rules.AbstractRule { |
@@ -23,3 +23,3 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var ts = require("typescript"); | ||
@@ -51,3 +51,5 @@ var Rule = (function (_super) { | ||
Rule.FAILURE_TYPE_THROW = "throw"; | ||
Rule.FAILURE_STRING_FACTORY = function (name) { return (name + " statements in finally blocks are forbidden."); }; | ||
Rule.FAILURE_STRING_FACTORY = function (name) { | ||
return name + " statements in finally blocks are forbidden."; | ||
}; | ||
return Rule; | ||
@@ -54,0 +56,0 @@ var _a, _b; |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var noUnusedExpressionRule_1 = require("./noUnusedExpressionRule"); | ||
@@ -27,0 +27,0 @@ var Rule = (function (_super) { |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var OPTION_REACT = "react"; | ||
@@ -74,3 +74,5 @@ var OPTION_CHECK_PARAMETERS = "check-parameters"; | ||
Rule.FAILURE_TYPE_VAR = "variable"; | ||
Rule.FAILURE_STRING_FACTORY = function (type, name) { return ("Unused " + type + ": '" + name + "'"); }; | ||
Rule.FAILURE_STRING_FACTORY = function (type, name) { | ||
return "Unused " + type + ": '" + name + "'"; | ||
}; | ||
return Rule; | ||
@@ -363,3 +365,3 @@ var _a; | ||
if (replacements && replacements.length) { | ||
fix = new Lint.Fix("no-unused-variable", replacements); | ||
fix = new Lint.Fix(Rule.metadata.ruleName, replacements); | ||
} | ||
@@ -366,0 +368,0 @@ this.addFailure(this.createFailure(position, name.length, Rule.FAILURE_STRING_FACTORY(type, name), fix)); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -1,5 +0,22 @@ | ||
import * as Lint from "../lint"; | ||
/** | ||
* @license | ||
* Copyright 2016 Palantir Technologies, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import * as Lint from "../index"; | ||
import * as ts from "typescript"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
static metadata: Lint.IRuleMetadata; | ||
static INCONSISTENT_PROPERTY: string; | ||
static UNNEEDED_QUOTES: (name: string) => string; | ||
@@ -6,0 +23,0 @@ static UNQUOTED_PROPERTY: (name: string) => string; |
@@ -0,1 +1,17 @@ | ||
/** | ||
* @license | ||
* Copyright 2016 Palantir Technologies, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
"use strict"; | ||
@@ -7,3 +23,3 @@ var __extends = (this && this.__extends) || function (d, b) { | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var ts = require("typescript"); | ||
@@ -24,6 +40,6 @@ var Rule = (function (_super) { | ||
descriptionDetails: (_a = ["\n Object literal property names can be defined in two ways: using literals or using strings.\n For example, these two objects are equivalent:\n\n var object1 = {\n property: true\n };\n\n var object2 = {\n \"property\": true\n };\n\n In many cases, it doesn\u2019t matter if you choose to use an identifier instead of a string\n or vice-versa. Even so, you might decide to enforce a consistent style in your code.\n\n This rules lets you enforce consistent quoting of property names. Either they should always\n be quoted (default behavior) or quoted only as needed (\"as-needed\")."], _a.raw = ["\n Object literal property names can be defined in two ways: using literals or using strings.\n For example, these two objects are equivalent:\n\n var object1 = {\n property: true\n };\n\n var object2 = {\n \"property\": true\n };\n\n In many cases, it doesn’t matter if you choose to use an identifier instead of a string\n or vice-versa. Even so, you might decide to enforce a consistent style in your code.\n\n This rules lets you enforce consistent quoting of property names. Either they should always\n be quoted (default behavior) or quoted only as needed (\"as-needed\")."], Lint.Utils.dedent(_a)), | ||
optionsDescription: (_b = ["\n Possible settings are:\n\n * `\"always\"`: Property names should always be quoted. (This is the default.)\n * `\"as-needed\"`: Only property names which require quotes may be quoted (e.g. those with spaces in them).\n\n For ES6, computed property names (`{[name]: value}`) and methods (`{foo() {}}`) never need\n to be quoted."], _b.raw = ["\n Possible settings are:\n\n * \\`\"always\"\\`: Property names should always be quoted. (This is the default.)\n * \\`\"as-needed\"\\`: Only property names which require quotes may be quoted (e.g. those with spaces in them).\n\n For ES6, computed property names (\\`{[name]: value}\\`) and methods (\\`{foo() {}}\\`) never need\n to be quoted."], Lint.Utils.dedent(_b)), | ||
optionsDescription: (_b = ["\n Possible settings are:\n\n * `\"always\"`: Property names should always be quoted. (This is the default.)\n * `\"as-needed\"`: Only property names which require quotes may be quoted (e.g. those with spaces in them).\n * `\"consistent\"`: Property names should either all be quoted or unquoted.\n * `\"consistent-as-needed\"`: If any property name requires quotes, then all properties must be quoted. Otherwise, no \n property names may be quoted.\n\n For ES6, computed property names (`{[name]: value}`) and methods (`{foo() {}}`) never need\n to be quoted."], _b.raw = ["\n Possible settings are:\n\n * \\`\"always\"\\`: Property names should always be quoted. (This is the default.)\n * \\`\"as-needed\"\\`: Only property names which require quotes may be quoted (e.g. those with spaces in them).\n * \\`\"consistent\"\\`: Property names should either all be quoted or unquoted.\n * \\`\"consistent-as-needed\"\\`: If any property name requires quotes, then all properties must be quoted. Otherwise, no \n property names may be quoted.\n\n For ES6, computed property names (\\`{[name]: value}\\`) and methods (\\`{foo() {}}\\`) never need\n to be quoted."], Lint.Utils.dedent(_b)), | ||
options: { | ||
type: "string", | ||
enum: ["always", "as-needed"], | ||
enum: ["always", "as-needed", "consistent", "consistent-as-needed"], | ||
}, | ||
@@ -35,4 +51,9 @@ optionExamples: ["[true, \"as-needed\"]", "[true, \"always\"]"], | ||
/* tslint:enable:object-literal-sort-keys */ | ||
Rule.UNNEEDED_QUOTES = function (name) { return ("Unnecessarily quoted property '" + name + "' found."); }; | ||
Rule.UNQUOTED_PROPERTY = function (name) { return ("Unquoted property '" + name + "' found."); }; | ||
Rule.INCONSISTENT_PROPERTY = "All property names in this object literal must be consistently quoted or unquoted."; | ||
Rule.UNNEEDED_QUOTES = function (name) { | ||
return "Unnecessarily quoted property '" + name + "' found."; | ||
}; | ||
Rule.UNQUOTED_PROPERTY = function (name) { | ||
return "Unquoted property '" + name + "' found."; | ||
}; | ||
return Rule; | ||
@@ -53,23 +74,56 @@ var _a, _b; | ||
var name = node.name; | ||
if (this.mode === "always") { | ||
if (name.kind !== ts.SyntaxKind.StringLiteral && | ||
name.kind !== ts.SyntaxKind.ComputedPropertyName) { | ||
this.addFailure(this.createFailure(name.getStart(), name.getWidth(), Rule.UNQUOTED_PROPERTY(name.getText()))); | ||
} | ||
if (name.kind !== ts.SyntaxKind.StringLiteral && | ||
name.kind !== ts.SyntaxKind.ComputedPropertyName) { | ||
var errorText = Rule.UNQUOTED_PROPERTY(name.getText()); | ||
this.currentState.unquotedProperties.push(this.createFailure(name.getStart(), name.getWidth(), errorText)); | ||
} | ||
else if (this.mode === "as-needed") { | ||
if (name.kind === ts.SyntaxKind.StringLiteral) { | ||
// Check if the quoting is necessary. | ||
var stringNode = name; | ||
var property = stringNode.text; | ||
var isIdentifier = IDENTIFIER_NAME_REGEX.test(property); | ||
var isNumber = NUMBER_REGEX.test(property); | ||
if (isIdentifier || (isNumber && Number(property).toString() === property)) { | ||
this.addFailure(this.createFailure(stringNode.getStart(), stringNode.getWidth(), Rule.UNNEEDED_QUOTES(property))); | ||
} | ||
if (name.kind === ts.SyntaxKind.StringLiteral) { | ||
// Check if the quoting is necessary. | ||
var stringNode = name; | ||
var property = stringNode.text; | ||
var isIdentifier = IDENTIFIER_NAME_REGEX.test(property); | ||
var isNumber = NUMBER_REGEX.test(property); | ||
if (isIdentifier || (isNumber && Number(property).toString() === property)) { | ||
var errorText = Rule.UNNEEDED_QUOTES(property); | ||
var failure = this.createFailure(stringNode.getStart(), stringNode.getWidth(), errorText); | ||
this.currentState.quotesNotNeededProperties.push(failure); | ||
} | ||
else { | ||
this.currentState.hasQuotesNeededProperty = true; | ||
} | ||
} | ||
_super.prototype.visitPropertyAssignment.call(this, node); | ||
}; | ||
ObjectLiteralKeyQuotesWalker.prototype.visitObjectLiteralExpression = function (node) { | ||
var state = { | ||
hasQuotesNeededProperty: false, | ||
quotesNotNeededProperties: [], | ||
unquotedProperties: [], | ||
}; | ||
// a nested object literal should store its parent state to restore when finished | ||
var previousState = this.currentState; | ||
this.currentState = state; | ||
_super.prototype.visitObjectLiteralExpression.call(this, node); | ||
if (this.mode === "always" || (this.mode === "consistent-as-needed" && state.hasQuotesNeededProperty)) { | ||
for (var _i = 0, _a = state.unquotedProperties; _i < _a.length; _i++) { | ||
var failure = _a[_i]; | ||
this.addFailure(failure); | ||
} | ||
} | ||
else if (this.mode === "as-needed" || (this.mode === "consistent-as-needed" && !state.hasQuotesNeededProperty)) { | ||
for (var _b = 0, _c = state.quotesNotNeededProperties; _b < _c.length; _b++) { | ||
var failure = _c[_b]; | ||
this.addFailure(failure); | ||
} | ||
} | ||
else if (this.mode === "consistent") { | ||
var hasQuotedProperties = state.hasQuotesNeededProperty || state.quotesNotNeededProperties.length > 0; | ||
var hasUnquotedProperties = state.unquotedProperties.length > 0; | ||
if (hasQuotedProperties && hasUnquotedProperties) { | ||
this.addFailure(this.createFailure(node.getStart(), 1, Rule.INCONSISTENT_PROPERTY)); | ||
} | ||
} | ||
this.currentState = previousState; | ||
}; | ||
return ObjectLiteralKeyQuotesWalker; | ||
}(Lint.RuleWalker)); |
@@ -1,2 +0,2 @@ | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
import * as ts from "typescript"; | ||
@@ -3,0 +3,0 @@ export declare class Rule extends Lint.Rules.AbstractRule { |
@@ -7,3 +7,3 @@ "use strict"; | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var ts = require("typescript"); | ||
@@ -23,2 +23,3 @@ var Rule = (function (_super) { | ||
description: "Enforces use of ES6 object literal shorthand when possible.", | ||
optionsDescription: "Not configurable.", | ||
options: null, | ||
@@ -25,0 +26,0 @@ optionExamples: ["true"], |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -46,3 +46,5 @@ __extends(Rule, _super); | ||
/* tslint:enable:object-literal-sort-keys */ | ||
Rule.FAILURE_STRING_FACTORY = function (name) { return ("The key '" + name + "' is not sorted alphabetically"); }; | ||
Rule.FAILURE_STRING_FACTORY = function (name) { | ||
return "The key '" + name + "' is not sorted alphabetically"; | ||
}; | ||
return Rule; | ||
@@ -49,0 +51,0 @@ }(Lint.Rules.AbstractRule)); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var OPTION_BRACE = "check-open-brace"; | ||
@@ -27,0 +27,0 @@ var OPTION_CATCH = "check-catch"; |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var OPTION_IGNORE_FOR_LOOP = "ignore-for-loop"; | ||
@@ -27,0 +27,0 @@ var Rule = (function (_super) { |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -23,3 +23,3 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var OPTION_ALLOW_DECLARATIONS = "allow-declarations"; | ||
@@ -26,0 +26,0 @@ var Rule = (function (_super) { |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -23,3 +23,4 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var ts = require("typescript"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -90,2 +91,32 @@ __extends(Rule, _super); | ||
} | ||
function compare(a, b) { | ||
var isLow = function (value) { | ||
return [".", "/"].some(function (x) { return value[0] === x; }); | ||
}; | ||
if (isLow(a) && !isLow(b)) { | ||
return 1; | ||
} | ||
else if (!isLow(a) && isLow(b)) { | ||
return -1; | ||
} | ||
else if (a > b) { | ||
return 1; | ||
} | ||
else if (a < b) { | ||
return -1; | ||
} | ||
return 0; | ||
} | ||
function removeQuotes(value) { | ||
// strip out quotes | ||
if (value && value.length > 1 && (value[0] === "'" || value[0] === "\"")) { | ||
value = value.substr(1, value.length - 2); | ||
} | ||
return value; | ||
} | ||
function sortByKey(xs, getSortKey) { | ||
return xs.slice().sort(function (a, b) { | ||
return compare(getSortKey(a), getSortKey(b)); | ||
}); | ||
} | ||
// Transformations to apply to produce the desired ordering of imports. | ||
@@ -103,4 +134,3 @@ // The imports must be lexicographically sorted after applying the transform. | ||
_super.call(this, sourceFile, options); | ||
// This gets reset after every blank line. | ||
this.lastImportSource = null; | ||
this.currentImportsBlock = new ImportsBlock(); | ||
this.importSourcesOrderTransform = null; | ||
@@ -116,7 +146,12 @@ this.namedImportsOrderTransform = null; | ||
OrderedImportsWalker.prototype.visitImportDeclaration = function (node) { | ||
var source = this.importSourcesOrderTransform(node.moduleSpecifier.getText()); | ||
if (this.lastImportSource && source < this.lastImportSource) { | ||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.IMPORT_SOURCES_UNORDERED)); | ||
var source = node.moduleSpecifier.getText(); | ||
source = removeQuotes(source); | ||
source = this.importSourcesOrderTransform(source); | ||
var previousSource = this.currentImportsBlock.getLastImportSource(); | ||
this.currentImportsBlock.addImportDeclaration(node, source); | ||
if (previousSource && compare(source, previousSource) === -1) { | ||
this.lastFix = new Lint.Fix(Rule.metadata.ruleName, []); | ||
var ruleFailure = this.createFailure(node.getStart(), node.getWidth(), Rule.IMPORT_SOURCES_UNORDERED, this.lastFix); | ||
this.addFailure(ruleFailure); | ||
} | ||
this.lastImportSource = source; | ||
_super.prototype.visitImportDeclaration.call(this, node); | ||
@@ -127,2 +162,3 @@ }; | ||
OrderedImportsWalker.prototype.visitNamedImports = function (node) { | ||
var _this = this; | ||
var imports = node.elements; | ||
@@ -132,13 +168,35 @@ var pair = findUnsortedPair(imports, this.namedImportsOrderTransform); | ||
var a = pair[0], b = pair[1]; | ||
this.addFailure(this.createFailure(a.getStart(), b.getEnd() - a.getStart(), Rule.NAMED_IMPORTS_UNORDERED)); | ||
var sortedDeclarations = sortByKey(imports, function (x) { return _this.namedImportsOrderTransform(x.getText()); }).map(function (x) { return x.getText(); }); | ||
// replace in reverse order to preserve earlier offsets | ||
for (var i = imports.length - 1; i >= 0; i--) { | ||
var start = imports[i].getStart(); | ||
var length_1 = imports[i].getText().length; | ||
// replace the named imports one at a time to preserve whitespace | ||
this.currentImportsBlock.replaceNamedImports(start, length_1, sortedDeclarations[i]); | ||
} | ||
this.lastFix = new Lint.Fix(Rule.metadata.ruleName, []); | ||
var ruleFailure = this.createFailure(a.getStart(), b.getEnd() - a.getStart(), Rule.NAMED_IMPORTS_UNORDERED, this.lastFix); | ||
this.addFailure(ruleFailure); | ||
} | ||
_super.prototype.visitNamedImports.call(this, node); | ||
}; | ||
// Check for a blank line, in which case we should reset the import ordering. | ||
// keep reading the block of import declarations until the block ends, then replace the entire block | ||
// this allows the reorder of named imports to work well with reordering lines | ||
OrderedImportsWalker.prototype.visitNode = function (node) { | ||
var prefixLength = node.getStart() - node.getFullStart(); | ||
var prefix = node.getFullText().slice(0, prefixLength); | ||
if (prefix.indexOf("\n\n") >= 0 || | ||
prefix.indexOf("\r\n\r\n") >= 0) { | ||
this.lastImportSource = null; | ||
var hasBlankLine = prefix.indexOf("\n\n") >= 0 || prefix.indexOf("\r\n\r\n") >= 0; | ||
var notImportDeclaration = node.parent != null | ||
&& node.parent.kind === ts.SyntaxKind.SourceFile | ||
&& node.kind !== ts.SyntaxKind.ImportDeclaration; | ||
if (hasBlankLine || notImportDeclaration) { | ||
// end of block | ||
if (this.lastFix != null) { | ||
var replacement = this.currentImportsBlock.getReplacement(); | ||
if (replacement != null) { | ||
this.lastFix.replacements.push(replacement); | ||
} | ||
this.lastFix = null; | ||
} | ||
this.currentImportsBlock = new ImportsBlock(); | ||
} | ||
@@ -149,1 +207,70 @@ _super.prototype.visitNode.call(this, node); | ||
}(Lint.RuleWalker)); | ||
var ImportsBlock = (function () { | ||
function ImportsBlock() { | ||
this.importDeclarations = []; | ||
} | ||
ImportsBlock.prototype.addImportDeclaration = function (node, sourcePath) { | ||
var start = this.getStartOffset(node); | ||
var end = this.getEndOffset(node); | ||
var text = node.getSourceFile().text.substring(start, end); | ||
if (start > node.getStart() || end === 0) { | ||
// skip block if any statements don't end with a newline to simplify implementation | ||
this.importDeclarations = []; | ||
return; | ||
} | ||
this.importDeclarations.push({ | ||
node: node, | ||
nodeEndOffset: end, | ||
nodeStartOffset: start, | ||
sourcePath: sourcePath, | ||
text: text, | ||
}); | ||
}; | ||
// replaces the named imports on the most recent import declaration | ||
ImportsBlock.prototype.replaceNamedImports = function (fileOffset, length, replacement) { | ||
var importDeclaration = this.getLastImportDeclaration(); | ||
if (importDeclaration == null) { | ||
// nothing to replace. This can happen if the block is skipped | ||
return; | ||
} | ||
var start = fileOffset - importDeclaration.nodeStartOffset; | ||
if (start < 0 || start + length > importDeclaration.node.getEnd()) { | ||
throw "Unexpected named import position"; | ||
} | ||
var initialText = importDeclaration.text; | ||
importDeclaration.text = initialText.substring(0, start) + replacement + initialText.substring(start + length); | ||
}; | ||
ImportsBlock.prototype.getLastImportSource = function () { | ||
if (this.importDeclarations.length === 0) { | ||
return null; | ||
} | ||
return this.getLastImportDeclaration().sourcePath; | ||
}; | ||
// creates a Lint.Replacement object with ordering fixes for the entire block | ||
ImportsBlock.prototype.getReplacement = function () { | ||
if (this.importDeclarations.length === 0) { | ||
return null; | ||
} | ||
var sortedDeclarations = sortByKey(this.importDeclarations.slice(), function (x) { return x.sourcePath; }); | ||
var fixedText = sortedDeclarations.map(function (x) { return x.text; }).join(""); | ||
var start = this.importDeclarations[0].nodeStartOffset; | ||
var end = this.getLastImportDeclaration().nodeEndOffset; | ||
return new Lint.Replacement(start, end - start, fixedText); | ||
}; | ||
// gets the offset immediately after the end of the previous declaration to include comment above | ||
ImportsBlock.prototype.getStartOffset = function (node) { | ||
if (this.importDeclarations.length === 0) { | ||
return node.getStart(); | ||
} | ||
return this.getLastImportDeclaration().nodeEndOffset; | ||
}; | ||
// gets the offset of the end of the import's line, including newline, to include comment to the right | ||
ImportsBlock.prototype.getEndOffset = function (node) { | ||
var endLineOffset = node.getSourceFile().text.indexOf("\n", node.end) + 1; | ||
return endLineOffset; | ||
}; | ||
ImportsBlock.prototype.getLastImportDeclaration = function () { | ||
return this.importDeclarations[this.importDeclarations.length - 1]; | ||
}; | ||
return ImportsBlock; | ||
}()); |
@@ -17,3 +17,3 @@ /** | ||
*/ | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
import * as ts from "typescript"; | ||
@@ -20,0 +20,0 @@ export declare class Rule extends Lint.Rules.AbstractRule { |
@@ -23,3 +23,3 @@ /** | ||
}; | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var ts = require("typescript"); | ||
@@ -44,2 +44,3 @@ var Rule = (function (_super) { | ||
type: "typescript", | ||
typescriptOnly: false, | ||
}; | ||
@@ -46,0 +47,0 @@ /* tslint:enable:object-literal-sort-keys */ |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var QuoteMark; | ||
@@ -27,0 +27,0 @@ (function (QuoteMark) { |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.TypedRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -47,3 +47,5 @@ __extends(Rule, _super); | ||
Rule.MISMATCHED_TYPES_FAILURE = "Types of values used in '+' operation must match"; | ||
Rule.UNSUPPORTED_TYPE_FAILURE_FACTORY = function (type) { return ("cannot add type " + type); }; | ||
Rule.UNSUPPORTED_TYPE_FAILURE_FACTORY = function (type) { | ||
return "cannot add type " + type; | ||
}; | ||
return Rule; | ||
@@ -50,0 +52,0 @@ }(Lint.Rules.TypedRule)); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var OPTION_ALWAYS = "always"; | ||
@@ -117,3 +117,4 @@ var OPTION_NEVER = "never"; | ||
var initializer = node.initializer; | ||
if (initializer && initializer.kind === ts.SyntaxKind.ArrowFunction) { | ||
// check if this is a multi-line arrow function (`[^]` in the regex matches all characters including CR & LF) | ||
if (initializer && initializer.kind === ts.SyntaxKind.ArrowFunction && /\{[^]*\n/.test(node.getText())) { | ||
if (!this.hasOption(OPTION_IGNORE_BOUND_CLASS_METHODS)) { | ||
@@ -120,0 +121,0 @@ this.checkSemicolonAt(node, "never"); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var OPTION_ALLOW_NULL_CHECK = "allow-null-check"; | ||
@@ -27,0 +27,0 @@ var OPTION_ALLOW_UNDEFINED_CHECK = "allow-undefined-check"; |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
/* tslint:disable:object-literal-sort-keys */ | ||
@@ -27,0 +27,0 @@ var SPACE_OPTIONS = { |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var Rule = (function (_super) { | ||
@@ -27,0 +27,0 @@ __extends(Rule, _super); |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var BANNED_KEYWORDS = ["any", "Number", "number", "String", "string", "Boolean", "boolean", "Undefined", "undefined"]; | ||
@@ -27,0 +27,0 @@ var OPTION_LEADING_UNDERSCORE = "allow-leading-underscore"; |
@@ -18,3 +18,3 @@ /** | ||
import * as ts from "typescript"; | ||
import * as Lint from "../lint"; | ||
import * as Lint from "../index"; | ||
export declare class Rule extends Lint.Rules.AbstractRule { | ||
@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata; |
@@ -24,3 +24,3 @@ /** | ||
var ts = require("typescript"); | ||
var Lint = require("../lint"); | ||
var Lint = require("../index"); | ||
var OPTION_BRANCH = "check-branch"; | ||
@@ -27,0 +27,0 @@ var OPTION_DECL = "check-decl"; |
@@ -26,4 +26,4 @@ /** | ||
var utils_1 = require("./language/utils"); | ||
var Linter = require("./linter"); | ||
var parse = require("./test/parse"); | ||
var Linter = require("./tslint"); | ||
var MARKUP_FILE_EXTENSION = ".lint"; | ||
@@ -33,3 +33,3 @@ var FIXES_FILE_EXTENSION = ".fix"; | ||
var filesToLint = glob.sync(path.join(testDirectory, "**/*" + MARKUP_FILE_EXTENSION)); | ||
var tslintConfig = Linter.findConfiguration(path.join(testDirectory, "tslint.json"), null); | ||
var tslintConfig = Linter.findConfiguration(path.join(testDirectory, "tslint.json"), null).results; | ||
var results = { directory: testDirectory, results: {} }; | ||
@@ -70,3 +70,3 @@ var _loop_1 = function(fileToLint) { | ||
var lintOptions = { | ||
configuration: tslintConfig, | ||
fix: false, | ||
formatter: "prose", | ||
@@ -76,4 +76,5 @@ formattersDirectory: "", | ||
}; | ||
var linter = new Linter(fileBasename, fileTextWithoutMarkup, lintOptions, program); | ||
var failures = linter.lint().failures; | ||
var linter = new Linter(lintOptions, program); | ||
linter.lint(fileBasename, fileTextWithoutMarkup, tslintConfig); | ||
var failures = linter.getResult().failures; | ||
var errorsFromLinter = failures.map(function (failure) { | ||
@@ -80,0 +81,0 @@ var startLineAndCharacter = failure.getStartPosition().getLineAndCharacter(); |
@@ -1,2 +0,2 @@ | ||
/// <reference types="node" /> | ||
import { Error } from "../configuration"; | ||
export interface PositionInFile { | ||
@@ -3,0 +3,0 @@ line: number; |
@@ -24,4 +24,5 @@ /** | ||
var configuration_1 = require("./configuration"); | ||
var Linter = require("./linter"); | ||
var test_1 = require("./test"); | ||
var Linter = require("./tslintMulti"); | ||
var updateNotifier_1 = require("./updateNotifier"); | ||
var processed = optimist | ||
@@ -46,3 +47,8 @@ .usage("Usage: $0 [options] file ...") | ||
describe: "exclude globs from path expansion", | ||
type: "string", | ||
}, | ||
fix: { | ||
describe: "Fixes linting errors for select rules. This may overwrite linted files", | ||
type: "boolean", | ||
}, | ||
force: { | ||
@@ -122,3 +128,3 @@ describe: "return status code 0 even if there are lint errors", | ||
outputStream.write(processed.help()); | ||
var outputString = "\ntslint accepts the following commandline options:\n\n -c, --config:\n The location of the configuration file that tslint will use to\n determine which rules are activated and what options to provide\n to the rules. If no option is specified, the config file named\n tslint.json is used, so long as it exists in the path.\n The format of the file is { rules: { /* rules list */ } },\n where /* rules list */ is a key: value comma-seperated list of\n rulename: rule-options pairs. Rule-options can be either a\n boolean true/false value denoting whether the rule is used or not,\n or a list [boolean, ...] where the boolean provides the same role\n as in the non-list case, and the rest of the list are options passed\n to the rule that will determine what it checks for (such as number\n of characters for the max-line-length rule, or what functions to ban\n for the ban rule).\n\n -e, --exclude:\n A filename or glob which indicates files to exclude from linting.\n This option can be supplied multiple times if you need multiple\n globs to indicate which files to exclude.\n\n --force:\n Return status code 0 even if there are any lint errors.\n Useful while running as npm script.\n\n -i, --init:\n Generates a tslint.json config file in the current working directory.\n\n -o, --out:\n A filename to output the results to. By default, tslint outputs to\n stdout, which is usually the console where you're running it from.\n\n -r, --rules-dir:\n An additional rules directory, for user-created rules.\n tslint will always check its default rules directory, in\n node_modules/tslint/lib/rules, before checking the user-provided\n rules directory, so rules in the user-provided rules directory\n with the same name as the base rules will not be loaded.\n\n -s, --formatters-dir:\n An additional formatters directory, for user-created formatters.\n Formatters are files that will format the tslint output, before\n writing it to stdout or the file passed in --out. The default\n directory, node_modules/tslint/build/formatters, will always be\n checked first, so user-created formatters with the same names\n as the base formatters will not be loaded.\n\n -t, --format:\n The formatter to use to format the results of the linter before\n outputting it to stdout or the file passed in --out. The core\n formatters are prose (human readable), json (machine readable)\n and verbose. prose is the default if this option is not used.\n Other built-in options include pmd, msbuild, checkstyle, and vso.\n Additonal formatters can be added and used if the --formatters-dir\n option is set.\n\n --test:\n Runs tslint on the specified directory and checks if tslint's output matches\n the expected output in .lint files. Automatically loads the tslint.json file in the\n specified directory as the configuration file for the tests. See the\n full tslint documentation for more details on how this can be used to test custom rules.\n\n --project:\n The location of a tsconfig.json file that will be used to determine which\n files will be linted.\n\n --type-check\n Enables the type checker when running linting rules. --project must be\n specified in order to enable type checking.\n\n -v, --version:\n The current version of tslint.\n\n -h, --help:\n Prints this help message.\n"; | ||
var outputString = "\ntslint accepts the following commandline options:\n\n -c, --config:\n The location of the configuration file that tslint will use to\n determine which rules are activated and what options to provide\n to the rules. If no option is specified, the config file named\n tslint.json is used, so long as it exists in the path.\n The format of the file is { rules: { /* rules list */ } },\n where /* rules list */ is a key: value comma-seperated list of\n rulename: rule-options pairs. Rule-options can be either a\n boolean true/false value denoting whether the rule is used or not,\n or a list [boolean, ...] where the boolean provides the same role\n as in the non-list case, and the rest of the list are options passed\n to the rule that will determine what it checks for (such as number\n of characters for the max-line-length rule, or what functions to ban\n for the ban rule).\n\n -e, --exclude:\n A filename or glob which indicates files to exclude from linting.\n This option can be supplied multiple times if you need multiple\n globs to indicate which files to exclude.\n\n --fix:\n Fixes linting errors for select rules. This may overwrite linted files.\n\n --force:\n Return status code 0 even if there are any lint errors.\n Useful while running as npm script.\n\n -i, --init:\n Generates a tslint.json config file in the current working directory.\n\n -o, --out:\n A filename to output the results to. By default, tslint outputs to\n stdout, which is usually the console where you're running it from.\n\n -r, --rules-dir:\n An additional rules directory, for user-created rules.\n tslint will always check its default rules directory, in\n node_modules/tslint/lib/rules, before checking the user-provided\n rules directory, so rules in the user-provided rules directory\n with the same name as the base rules will not be loaded.\n\n -s, --formatters-dir:\n An additional formatters directory, for user-created formatters.\n Formatters are files that will format the tslint output, before\n writing it to stdout or the file passed in --out. The default\n directory, node_modules/tslint/build/formatters, will always be\n checked first, so user-created formatters with the same names\n as the base formatters will not be loaded.\n\n -t, --format:\n The formatter to use to format the results of the linter before\n outputting it to stdout or the file passed in --out. The core\n formatters are prose (human readable), json (machine readable)\n and verbose. prose is the default if this option is not used.\n Other built-in options include pmd, msbuild, checkstyle, and vso.\n Additional formatters can be added and used if the --formatters-dir\n option is set.\n\n --test:\n Runs tslint on the specified directory and checks if tslint's output matches\n the expected output in .lint files. Automatically loads the tslint.json file in the\n specified directory as the configuration file for the tests. See the\n full tslint documentation for more details on how this can be used to test custom rules.\n\n --project:\n The location of a tsconfig.json file that will be used to determine which\n files will be linted.\n\n --type-check\n Enables the type checker when running linting rules. --project must be\n specified in order to enable type checking.\n\n -v, --version:\n The current version of tslint.\n\n -h, --help:\n Prints this help message.\n"; | ||
outputStream.write(outputString); | ||
@@ -135,2 +141,3 @@ process.exit(0); | ||
var linter = new Linter({ | ||
fix: argv.fix, | ||
formatter: argv.t, | ||
@@ -163,4 +170,10 @@ formattersDirectory: argv.s || "", | ||
var contents = fs.readFileSync(file, "utf8"); | ||
var configuration = configuration_1.findConfiguration(possibleConfigAbsolutePath, file); | ||
linter.lint(file, contents, configuration); | ||
var configLoad = configuration_1.findConfiguration(possibleConfigAbsolutePath, file); | ||
if (configLoad.results) { | ||
linter.lint(file, contents, configLoad.results); | ||
} | ||
else { | ||
console.error("Failed to load " + configLoad.path + ": " + configLoad.error.message); | ||
process.exit(1); | ||
} | ||
} | ||
@@ -173,2 +186,6 @@ var lintResult = linter.getResult(); | ||
}); | ||
if (lintResult.format === "prose") { | ||
// Check to see if there are any updates available | ||
updateNotifier_1.updateNotifierCheck(); | ||
} | ||
}; | ||
@@ -209,5 +226,12 @@ // if both files and tsconfig are present, use files | ||
} | ||
var trimSingleQuotes = function (str) { return str.replace(/^'|'$/g, ""); }; | ||
var ignorePatterns = []; | ||
if (argv.e) { | ||
var excludeArguments = Array.isArray(argv.e) ? argv.e : [argv.e]; | ||
ignorePatterns = excludeArguments.map(trimSingleQuotes); | ||
} | ||
files = files | ||
.map(function (file) { return glob.sync(file, { ignore: argv.e, nodir: true }); }) | ||
.map(trimSingleQuotes) | ||
.map(function (file) { return glob.sync(file, { ignore: ignorePatterns, nodir: true }); }) | ||
.reduce(function (a, b) { return a.concat(b); }); | ||
processFiles(files, program); |
@@ -17,3 +17,9 @@ /** | ||
*/ | ||
/** | ||
* Enforces the invariant that the input is an array. | ||
*/ | ||
export declare function arrayify<T>(arg: T | T[]): T[]; | ||
/** | ||
* Enforces the invariant that the input is an object. | ||
*/ | ||
export declare function objectify(arg: any): any; | ||
@@ -20,0 +26,0 @@ /** |
@@ -18,2 +18,5 @@ /** | ||
"use strict"; | ||
/** | ||
* Enforces the invariant that the input is an array. | ||
*/ | ||
function arrayify(arg) { | ||
@@ -31,2 +34,5 @@ if (Array.isArray(arg)) { | ||
exports.arrayify = arrayify; | ||
/** | ||
* Enforces the invariant that the input is an object. | ||
*/ | ||
function objectify(arg) { | ||
@@ -33,0 +39,0 @@ if (typeof arg === "object" && arg != null) { |
{ | ||
"name": "tslint", | ||
"version": "4.0.0-dev.1", | ||
"version": "4.0.0-dev.2", | ||
"description": "An extensible static analysis linter for the TypeScript language", | ||
@@ -8,4 +8,4 @@ "bin": { | ||
}, | ||
"main": "./lib/tslint", | ||
"typings": "./lib/tslint", | ||
"main": "./lib/index.js", | ||
"typings": "./lib/index.d.ts", | ||
"repository": { | ||
@@ -30,7 +30,7 @@ "type": "git", | ||
"lint": "npm-run-all -p lint:core lint:test", | ||
"lint:core": "tslint src/**/*.ts", | ||
"lint:test": "tslint test/**/*.ts -e test/**/*.test.ts", | ||
"lint:core": "tslint \"src/**/*.ts\"", | ||
"lint:test": "tslint \"test/**/*.ts\" -e \"test/**/*.test.ts\"", | ||
"test": "npm-run-all test:pre -p test:mocha test:rules", | ||
"test:pre": "cd ./test/config && npm install", | ||
"test:mocha": "mocha --reporter spec --colors build/test/**/*Tests.js build/test/assert.js", | ||
"test:mocha": "mocha --reporter spec --colors \"build/test/**/*Tests.js\" build/test/assert.js", | ||
"test:rules": "node ./build/test/ruleTestRunner.js", | ||
@@ -46,3 +46,4 @@ "verify": "npm-run-all clean compile lint test docs" | ||
"resolve": "^1.1.7", | ||
"underscore.string": "^3.3.4" | ||
"underscore.string": "^3.3.4", | ||
"update-notifier": "^1.0.2" | ||
}, | ||
@@ -72,8 +73,5 @@ "devDependencies": { | ||
"peerDependencies": { | ||
"typescript": ">=1.7.3 || >=1.8.0-dev || >=1.9.0-dev || >=2.0.0-dev || >=2.1.0-dev || >= 2.2.0-dev" | ||
"typescript": ">=2.0.0-dev || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev" | ||
}, | ||
"license": "Apache-2.0", | ||
"typescript": { | ||
"definition": "lib/tslint.d.ts" | ||
} | ||
"license": "Apache-2.0" | ||
} |
@@ -82,6 +82,12 @@ [![NPM version](https://badge.fury.io/js/tslint.svg)](http://badge.fury.io/js/tslint) | ||
/* | ||
* Any rules specified here will override those from the base config we are extending | ||
* Any rules specified here will override those from the base config we are extending. | ||
*/ | ||
"no-parameter-properties": true | ||
"curly": true | ||
}, | ||
"jsRules": { | ||
/* | ||
* Any rules specified here will override those from the base config we are extending. | ||
*/ | ||
"curly": true | ||
}, | ||
"rulesDirectory": [ | ||
@@ -112,2 +118,4 @@ /* | ||
-c, --config configuration file | ||
-e, --exclude exclude globs from path expansion | ||
--fix Fixes linting errors for select rules. This may overwrite linted files | ||
--force return status code 0 even if there are lint errors | ||
@@ -117,8 +125,7 @@ -h, --help display detailed help | ||
-o, --out output file | ||
--project tsconfig.json file | ||
-r, --rules-dir rules directory | ||
-s, --formatters-dir formatters directory | ||
-e, --exclude exclude globs from path expansion | ||
-t, --format output format (prose, json, verbose, pmd, msbuild, checkstyle) [default: "prose"] | ||
-t, --format output format (prose, json, stylish, verbose, pmd, msbuild, checkstyle, vso, fileslist) [default: "prose"] | ||
--test test that tslint produces the correct output for the specified directory | ||
--project path to tsconfig.json file | ||
--type-check enable type checking when linting a project | ||
@@ -151,2 +158,5 @@ -v, --version current version | ||
--fix: | ||
Fixes linting errors for select rules. This may overwrite linted files. | ||
--force: | ||
@@ -308,11 +318,15 @@ Return status code 0 even if there are any lint errors. | ||
Rule names are always camel-cased and *must* contain the suffix `Rule`. Let us take the example of how to write a new rule to forbid all import statements (you know, *for science*). Let us name the rule file `noImportsRule.ts`. Rules can be referenced in `tslint.json` in their kebab-case forms, so `"no-imports": true` would turn on the rule. | ||
Let us take the example of how to write a new rule to forbid all import statements (you know, *for science*). Let us name the rule file `noImportsRule.ts`. Rules are referenced in `tslint.json` with their kebab-cased identifer, so `"no-imports": true` would configure the rule. | ||
Now, let us first write the rule in TypeScript. A few things to note: | ||
- We import `tslint/lib/lint` to get the whole `Lint` namespace instead of just the `Linter` class. | ||
- The exported class must always be named `Rule` and extend from `Lint.Rules.AbstractRule`. | ||
__Important conventions__: | ||
* Rule identifiers are always kebab-cased. | ||
* Rule files are always camel-cased (`camelCasedRule.ts`). | ||
* Rule files *must* contain the suffix `Rule`. | ||
* The exported class must always be named `Rule` and extend from `Lint.Rules.AbstractRule`. | ||
Now, let us first write the rule in TypeScript: | ||
```typescript | ||
import * as ts from "typescript"; | ||
import * as Lint from "tslint/lib/lint"; | ||
import * as Lint from "tslint"; | ||
@@ -344,3 +358,3 @@ export class Rule extends Lint.Rules.AbstractRule { | ||
```bash | ||
tsc -m commonjs --noImplicitAny noImportsRule.ts node_modules/tslint/lib/tslint.d.ts | ||
tsc --noImplicitAny noImportsRule.ts | ||
``` | ||
@@ -350,2 +364,4 @@ | ||
Finally, enable each custom rule in your [`tslint.json` config file][0] config file. | ||
Final notes: | ||
@@ -383,5 +399,6 @@ | ||
```bash | ||
git clone git@github.com:palantir/tslint.git | ||
git clone git@github.com:palantir/tslint.git --config core.autocrlf=input --config core.eol=lf | ||
npm install | ||
grunt | ||
npm run compile | ||
npm run test | ||
``` | ||
@@ -402,5 +419,7 @@ | ||
2. Add release notes in `CHANGELOG.md` | ||
3. Run `grunt` to build the latest sources | ||
3. `npm run verify` to build the latest sources | ||
4. Commit with message `Prepare release <version>` | ||
5. Run `npm publish` | ||
6. Create a git tag for the new release and push it ([see existing tags here](https://github.com/palantir/tslint/tags)) | ||
[0]: {{site.baseurl | append: "/usage/tslint-json/"}} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
797851
417
15
9
247
16195
+ Addedupdate-notifier@^1.0.2
+ Addedansi-align@1.1.0(transitive)
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedboxen@0.6.0(transitive)
+ Addedcamelcase@2.1.1(transitive)
+ Addedcapture-stack-trace@1.0.2(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedcli-boxes@1.0.0(transitive)
+ Addedcode-point-at@1.1.0(transitive)
+ Addedconfigstore@2.1.0(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedcreate-error-class@3.0.2(transitive)
+ Addeddeep-extend@0.6.0(transitive)
+ Addeddot-prop@3.0.0(transitive)
+ Addedduplexer2@0.1.4(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedfilled-array@1.1.0(transitive)
+ Addedgot@5.7.1(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedimurmurhash@0.1.4(transitive)
+ Addedini@1.3.8(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-finite@1.1.0(transitive)
+ Addedis-fullwidth-code-point@1.0.0(transitive)
+ Addedis-npm@1.0.0(transitive)
+ Addedis-obj@1.0.1(transitive)
+ Addedis-redirect@1.0.0(transitive)
+ Addedis-retry-allowed@1.2.0(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedlatest-version@2.0.0(transitive)
+ Addedlazy-req@1.1.0(transitive)
+ Addedlowercase-keys@1.0.1(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addednode-status-codes@1.0.0(transitive)
+ Addednumber-is-nan@1.0.1(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedos-homedir@1.0.2(transitive)
+ Addedos-tmpdir@1.0.2(transitive)
+ Addedosenv@0.1.5(transitive)
+ Addedpackage-json@2.4.0(transitive)
+ Addedparse-json@2.2.0(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
+ Addedprepend-http@1.0.4(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedrc@1.2.8(transitive)
+ Addedread-all-stream@3.1.0(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedregistry-auth-token@3.4.0(transitive)
+ Addedregistry-url@3.1.0(transitive)
+ Addedrepeating@2.0.1(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedsemver-diff@2.1.0(transitive)
+ Addedslide@1.1.6(transitive)
+ Addedstring-width@1.0.2(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedstrip-json-comments@2.0.1(transitive)
+ Addedsupports-color@2.0.0(transitive)
+ Addedtimed-out@3.1.3(transitive)
+ Addedunzip-response@1.0.2(transitive)
+ Addedupdate-notifier@1.0.3(transitive)
+ Addedurl-parse-lax@1.0.0(transitive)
+ Addeduuid@2.0.3(transitive)
+ Addedwidest-line@1.0.0(transitive)
+ Addedwrite-file-atomic@1.3.4(transitive)
+ Addedxdg-basedir@2.0.0(transitive)