Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tslint

Package Overview
Dependencies
Maintainers
1
Versions
182
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tslint - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

12

CHANGELOG.md
Change Log
===
v4.0.1
---
* [bugfix] Removed `no-unused-variable` rule from recommended config, as it was causing spurious deprecation warnings.
v4.0.0-dev.2
---
* Include latest v4.0.0 changes
v4.0.0

@@ -196,2 +204,6 @@ ---

v3.12.0-dev.2
---
* [enhancement] Support TypeScript v2.0.0-dev builds
v3.12.1

@@ -198,0 +210,0 @@ ---

3

lib/configs/recommended.d.ts

@@ -32,2 +32,3 @@ /**

"label-position": boolean;
"max-classes-per-file": (number | boolean)[];
"max-line-length": (number | boolean)[];

@@ -39,3 +40,2 @@ "member-access": boolean;

"new-parens": boolean;
"max-classes-per-file": (number | boolean)[];
"no-any": boolean;

@@ -62,3 +62,2 @@ "no-arg": boolean;

"no-unused-new": boolean;
"no-unused-variable": boolean;
"no-use-before-declare": boolean;

@@ -65,0 +64,0 @@ "no-var-keyword": boolean;

@@ -39,2 +39,3 @@ /**

"label-position": true,
"max-classes-per-file": [true, 1],
"max-line-length": [true, 120],

@@ -46,3 +47,2 @@ "member-access": true,

"new-parens": true,
"max-classes-per-file": [true, 1],
"no-any": false,

@@ -76,4 +76,2 @@ "no-arg": true,

"no-unused-new": true,
// deprecated as of v4.0
"no-unused-variable": false,
// disable this rule as it is very heavy performance-wise and not that useful

@@ -80,0 +78,0 @@ "no-use-before-declare": false,

import * as ts from "typescript";
import { IConfigurationFile, findConfiguration, findConfigurationPath, getRulesDirectories, loadConfigurationFromPath } from "./configuration";
import { findConfiguration, findConfigurationPath, getRulesDirectories, IConfigurationFile, loadConfigurationFromPath } from "./configuration";
import { ILinterOptions, LintResult } from "./index";

@@ -4,0 +4,0 @@ /**

@@ -189,3 +189,3 @@ /**

};
Linter.VERSION = "4.0.0";
Linter.VERSION = "4.0.1";
Linter.findConfiguration = configuration_1.findConfiguration;

@@ -192,0 +192,0 @@ Linter.findConfigurationPath = configuration_1.findConfigurationPath;

@@ -45,3 +45,5 @@ /**

/* 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;

@@ -48,0 +50,0 @@ }(Lint.Rules.AbstractRule));

@@ -17,4 +17,4 @@ /**

*/
import * as ts from "typescript";
import * as Lint from "../index";
import * as ts from "typescript";
export declare class Rule extends Lint.Rules.AbstractRule {

@@ -21,0 +21,0 @@ static DEFAULT_THRESHOLD: number;

@@ -23,4 +23,4 @@ /**

};
var ts = require("typescript");
var Lint = require("../index");
var ts = require("typescript");
var Rule = (function (_super) {

@@ -65,6 +65,6 @@ __extends(Rule, _super);

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;
};

@@ -71,0 +71,0 @@ return Rule;

@@ -0,3 +1,3 @@

import * as ts from "typescript";
import * as Lint from "../index";
import * as ts from "typescript";
export declare class Rule extends Lint.Rules.AbstractRule {

@@ -4,0 +4,0 @@ static metadata: Lint.IRuleMetadata;

@@ -19,3 +19,3 @@ "use strict";

ruleName: "max-classes-per-file",
description: (_a = ["\n A file may not contain more than the specified number of classes \n if the file name does not match the \"ignore-filename-pattern\" option"], _a.raw = ["\n A file may not contain more than the specified number of classes \n if the file name does not match the \"ignore-filename-pattern\" option"], Lint.Utils.dedent(_a)),
description: (_a = ["\n A file may not contain more than the specified number of classes"], _a.raw = ["\n A file may not contain more than the specified number of classes"], Lint.Utils.dedent(_a)),
rationale: (_b = ["\n Ensures that files have a single responsibility so that that classes each exist in their own files"], _b.raw = ["\n Ensures that files have a single responsibility so that that classes each exist in their own files"], Lint.Utils.dedent(_b)),

@@ -22,0 +22,0 @@ optionsDescription: (_c = ["\n The one required argument is an integer indicating the maximum number of classes that can appear in a file."], _c.raw = ["\n The one required argument is an integer indicating the maximum number of classes that can appear in a file."], Lint.Utils.dedent(_c)),

@@ -17,4 +17,4 @@ /**

*/
import * as ts from "typescript";
import * as Lint from "../index";
import * as ts from "typescript";
export declare class Rule extends Lint.Rules.AbstractRule {

@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata;

@@ -7,18 +7,2 @@ "use strict";

};
/**
* @license
* Copyright 2013 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.
*/
var Lint = require("../index");

@@ -25,0 +9,0 @@ var Rule = (function (_super) {

@@ -46,3 +46,5 @@ /**

/* 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;

@@ -49,0 +51,0 @@ var _a, _b;

@@ -54,3 +54,5 @@ /**

/* 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;

@@ -57,0 +59,0 @@ var _a;

@@ -58,3 +58,3 @@ /**

_super.prototype.visitNode.call(this, node);
if (node.kind === ts.SyntaxKind.NullKeyword) {
if (node.kind === ts.SyntaxKind.NullKeyword && !isPartOfType(node)) {
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));

@@ -65,1 +65,11 @@ }

}(Lint.RuleWalker));
function isPartOfType(_a) {
var parent = _a.parent;
while (parent != null) {
if (ts.SyntaxKind.FirstTypeNode <= parent.kind && parent.kind <= ts.SyntaxKind.LastTypeNode) {
return true;
}
parent = parent.parent;
}
return false;
}

@@ -44,3 +44,5 @@ /**

/* 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;

@@ -47,0 +49,0 @@ var _a;

@@ -45,3 +45,5 @@ /**

/* 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;

@@ -48,0 +50,0 @@ }(Lint.Rules.AbstractRule));

@@ -17,4 +17,4 @@ /**

*/
import * as ts from "typescript";
import * as Lint from "../index";
import * as ts from "typescript";
export declare class Rule extends Lint.Rules.AbstractRule {

@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata;

@@ -23,4 +23,4 @@ /**

};
var ts = require("typescript");
var Lint = require("../index");
var ts = require("typescript");
var Rule = (function (_super) {

@@ -51,3 +51,5 @@ __extends(Rule, _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;

@@ -42,3 +42,3 @@ /**

ruleName: "no-unused-variable",
deprecationMessage: "Use the compiler options --noUnusedParameters and --noUnusedLocals instead.",
deprecationMessage: "Use the tsc compiler options --noUnusedParameters and --noUnusedLocals instead.",
description: "Disallows unused imports, variables, functions and private class members.",

@@ -74,3 +74,5 @@ optionsDescription: (_a = ["\n Three optional arguments may be optionally provided:\n\n * `\"check-parameters\"` disallows unused function and constructor parameters.\n * NOTE: this option is experimental and does not work with classes\n that use abstract method declarations, among other things.\n * `\"react\"` relaxes the rule for a namespace import named `React`\n (from either the module `\"react\"` or `\"react/addons\"`).\n Any JSX expression in the file will be treated as a usage of `React`\n (because it expands to `React.createElement `).\n * `{\"ignore-pattern\": \"pattern\"}` where pattern is a case-sensitive regexp.\n Variable names that match the pattern will be ignored."], _a.raw = ["\n Three optional arguments may be optionally provided:\n\n * \\`\"check-parameters\"\\` disallows unused function and constructor parameters.\n * NOTE: this option is experimental and does not work with classes\n that use abstract method declarations, among other things.\n * \\`\"react\"\\` relaxes the rule for a namespace import named \\`React\\`\n (from either the module \\`\"react\"\\` or \\`\"react/addons\"\\`).\n Any JSX expression in the file will be treated as a usage of \\`React\\`\n (because it expands to \\`React.createElement \\`).\n * \\`{\"ignore-pattern\": \"pattern\"}\\` where pattern is a case-sensitive regexp.\n Variable names that match the pattern will be ignored."], Lint.Utils.dedent(_a)),

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;

@@ -77,0 +79,0 @@ var _a;

@@ -0,3 +1,19 @@

/**
* @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 ts from "typescript";
import * as Lint from "../index";
import * as ts from "typescript";
export declare class Rule extends Lint.Rules.AbstractRule {

@@ -4,0 +20,0 @@ static metadata: Lint.IRuleMetadata;

@@ -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,4 +23,4 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ts = require("typescript");
var Lint = require("../index");
var ts = require("typescript");
var Rule = (function (_super) {

@@ -35,4 +51,8 @@ __extends(Rule, _super);

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."); };
Rule.UNNEEDED_QUOTES = function (name) {
return "Unnecessarily quoted property '" + name + "' found.";
};
Rule.UNQUOTED_PROPERTY = function (name) {
return "Unquoted property '" + name + "' found.";
};
return Rule;

@@ -39,0 +59,0 @@ var _a, _b;

@@ -0,3 +1,3 @@

import * as ts from "typescript";
import * as Lint from "../index";
import * as ts from "typescript";
export declare class Rule extends Lint.Rules.AbstractRule {

@@ -4,0 +4,0 @@ static metadata: Lint.IRuleMetadata;

@@ -7,4 +7,4 @@ "use strict";

};
var ts = require("typescript");
var Lint = require("../index");
var ts = require("typescript");
var Rule = (function (_super) {

@@ -11,0 +11,0 @@ __extends(Rule, _super);

@@ -45,3 +45,5 @@ /**

/* 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;

@@ -48,0 +50,0 @@ }(Lint.Rules.AbstractRule));

@@ -184,3 +184,3 @@ /**

var body = node.body;
if (body.kind === ts.SyntaxKind.ModuleBlock) {
if (body != null && body.kind === ts.SyntaxKind.ModuleBlock) {
var openBraceToken = body.getChildAt(0);

@@ -187,0 +187,0 @@ this.handleOpeningBrace(nameNode, openBraceToken);

@@ -123,3 +123,3 @@ /**

var TRANSFORMS = {
any: function () { return ""; },
"any": function () { return ""; },
"case-insensitive": function (x) { return x.toLowerCase(); },

@@ -126,0 +126,0 @@ "lowercase-first": flipCase,

@@ -17,4 +17,4 @@ /**

*/
import * as ts from "typescript";
import * as Lint from "../index";
import * as ts from "typescript";
export declare class Rule extends Lint.Rules.AbstractRule {

@@ -21,0 +21,0 @@ static metadata: Lint.IRuleMetadata;

@@ -23,4 +23,4 @@ /**

};
var ts = require("typescript");
var Lint = require("../index");
var ts = require("typescript");
var Rule = (function (_super) {

@@ -27,0 +27,0 @@ __extends(Rule, _super);

@@ -46,3 +46,5 @@ /**

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;

@@ -49,0 +51,0 @@ }(Lint.Rules.TypedRule));

@@ -35,3 +35,3 @@ /**

"index-signature": SPACE_OPTIONS,
parameter: SPACE_OPTIONS,
"parameter": SPACE_OPTIONS,
"property-declaration": SPACE_OPTIONS,

@@ -76,5 +76,3 @@ "variable-declaration": SPACE_OPTIONS,

TypedefWhitespaceWalker.getColonPosition = function (node) {
var colon = node.getChildren().filter(function (child) {
return child.kind === ts.SyntaxKind.ColonToken;
})[0];
var colon = node.getChildren().filter(function (child) { return child.kind === ts.SyntaxKind.ColonToken; })[0];
return colon == null ? -1 : colon.getStart();

@@ -81,0 +79,0 @@ };

@@ -39,7 +39,7 @@ /**

.options({
c: {
"c": {
alias: "config",
describe: "configuration file",
},
e: {
"e": {
alias: "exclude",

@@ -49,34 +49,34 @@ describe: "exclude globs from path expansion",

},
fix: {
"fix": {
describe: "Fixes linting errors for select rules. This may overwrite linted files",
type: "boolean",
},
force: {
"force": {
describe: "return status code 0 even if there are lint errors",
type: "boolean",
},
h: {
"h": {
alias: "help",
describe: "display detailed help",
},
i: {
"i": {
alias: "init",
describe: "generate a tslint.json config file in the current working directory",
},
o: {
"o": {
alias: "out",
describe: "output file",
},
project: {
"project": {
describe: "tsconfig.json file",
},
r: {
"r": {
alias: "rules-dir",
describe: "rules directory",
},
s: {
"s": {
alias: "formatters-dir",
describe: "formatters directory",
},
t: {
"t": {
alias: "format",

@@ -86,3 +86,3 @@ default: "prose",

},
test: {
"test": {
describe: "test that tslint produces the correct output for the specified directory",

@@ -93,3 +93,3 @@ },

},
v: {
"v": {
alias: "version",

@@ -96,0 +96,0 @@ describe: "current version",

{
"name": "tslint",
"version": "4.0.0",
"version": "4.0.1",
"description": "An extensible static analysis linter for the TypeScript language",

@@ -5,0 +5,0 @@ "bin": {

@@ -358,3 +358,3 @@ [![NPM version](https://badge.fury.io/js/tslint.svg)](http://badge.fury.io/js/tslint)

Finally, enable each custom rule in your [`tslint.json` config file][0] config file.
Finally, enable each custom rule in your [`tslint.json` config file](https://palantir.github.io/tslint/usage/tslint-json/) config file.

@@ -374,3 +374,3 @@ Final notes:

import * as ts from "typescript";
import * as Lint from "tslint/lib/lint";
import * as Lint from "tslint";

@@ -417,3 +417,1 @@ export class Formatter extends Lint.Formatters.AbstractFormatter {

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/"}}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc