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 2.4.2 to 2.4.3

.tscache/core_rules/hashes/memberAccessRule.ts-54a5e3700376b525dad7e1b17edd446a

28

build/rules/forinRule.js

@@ -59,3 +59,3 @@ /*

var ifStatement = firstBlockStatement.thenStatement;
if (ForInWalker.nodeIsContinue(ifStatement)) {
if (nodeIsContinue(ifStatement)) {
return;

@@ -69,16 +69,16 @@ }

};
ForInWalker.nodeIsContinue = function (node) {
var kind = node.kind;
if (kind === 190) {
return ForInWalker;
})(Lint.RuleWalker);
function nodeIsContinue(node) {
var kind = node.kind;
if (kind === 190) {
return true;
}
if (kind === 180) {
var blockStatements = node.statements;
if (blockStatements.length === 1 && blockStatements[0].kind === 190) {
return true;
}
if (kind === 180) {
var blockStatements = node.statements;
if (blockStatements.length === 1 && blockStatements[0].kind === 190) {
return true;
}
}
return false;
};
return ForInWalker;
})(Lint.RuleWalker);
}
return false;
}

@@ -28,3 +28,3 @@ /*

Rule.prototype.apply = function (sourceFile) {
return this.applyWithWalker(new LabelPosWalker(sourceFile, this.getOptions()));
return this.applyWithWalker(new LabelPositionWalker(sourceFile, this.getOptions()));
};

@@ -35,8 +35,8 @@ Rule.FAILURE_STRING = "unexpected label on statement";

exports.Rule = Rule;
var LabelPosWalker = (function (_super) {
__extends(LabelPosWalker, _super);
function LabelPosWalker() {
var LabelPositionWalker = (function (_super) {
__extends(LabelPositionWalker, _super);
function LabelPositionWalker() {
_super.apply(this, arguments);
}
LabelPosWalker.prototype.visitLabeledStatement = function (node) {
LabelPositionWalker.prototype.visitLabeledStatement = function (node) {
var statement = node.statement;

@@ -53,3 +53,3 @@ if (statement.kind !== 185

};
return LabelPosWalker;
return LabelPositionWalker;
})(Lint.RuleWalker);

@@ -37,12 +37,6 @@ /*

function getModifiers(isMethod, modifiers) {
var modifierStrings = [];
if (modifiers != null) {
modifierStrings = modifiers.map(function (x) {
return x.getText();
});
}
return {
isInstance: modifierStrings.indexOf("static") === -1,
isInstance: !Lint.hasModifier(modifiers, 109),
isMethod: isMethod,
isPrivate: modifierStrings.indexOf("private") !== -1
isPrivate: Lint.hasModifier(modifiers, 106)
};

@@ -72,15 +66,15 @@ }

MemberOrderingWalker.prototype.visitMethodDeclaration = function (node) {
this.checkAndSetModifiers(node, getModifiers(true, node.modifiers));
this.checkModifiersAndSetPrevious(node, getModifiers(true, node.modifiers));
_super.prototype.visitMethodDeclaration.call(this, node);
};
MemberOrderingWalker.prototype.visitMethodSignature = function (node) {
this.checkAndSetModifiers(node, getModifiers(true, node.modifiers));
this.checkModifiersAndSetPrevious(node, getModifiers(true, node.modifiers));
_super.prototype.visitMethodSignature.call(this, node);
};
MemberOrderingWalker.prototype.visitPropertyDeclaration = function (node) {
this.checkAndSetModifiers(node, getModifiers(false, node.modifiers));
this.checkModifiersAndSetPrevious(node, getModifiers(false, node.modifiers));
_super.prototype.visitPropertyDeclaration.call(this, node);
};
MemberOrderingWalker.prototype.visitPropertySignature = function (node) {
this.checkAndSetModifiers(node, getModifiers(false, node.modifiers));
this.checkModifiersAndSetPrevious(node, getModifiers(false, node.modifiers));
_super.prototype.visitPropertySignature.call(this, node);

@@ -91,3 +85,3 @@ };

MemberOrderingWalker.prototype.resetPreviousModifiers = function () {
this.previous = {
this.previousMember = {
isInstance: false,

@@ -98,22 +92,21 @@ isMethod: false,

};
MemberOrderingWalker.prototype.checkAndSetModifiers = function (node, current) {
if (!this.canAppearAfter(this.previous, current)) {
var message = "Declaration of " + toString(current) +
" not allowed to appear after declaration of " + toString(this.previous);
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), message));
MemberOrderingWalker.prototype.checkModifiersAndSetPrevious = function (node, currentMember) {
if (!this.canAppearAfter(this.previousMember, currentMember)) {
var failure = this.createFailure(node.getStart(), node.getWidth(), "Declaration of " + toString(currentMember) + " not allowed to appear after declaration of " + toString(this.previousMember));
this.addFailure(failure);
}
this.previous = current;
this.previousMember = currentMember;
};
MemberOrderingWalker.prototype.canAppearAfter = function (previous, current) {
if (previous == null || current == null) {
MemberOrderingWalker.prototype.canAppearAfter = function (previousMember, currentMember) {
if (previousMember == null || currentMember == null) {
return true;
}
if (this.hasOption(OPTION_VARIABLES_BEFORE_FUNCTIONS) && previous.isMethod !== current.isMethod) {
return Number(previous.isMethod) < Number(current.isMethod);
if (this.hasOption(OPTION_VARIABLES_BEFORE_FUNCTIONS) && previousMember.isMethod !== currentMember.isMethod) {
return Number(previousMember.isMethod) < Number(currentMember.isMethod);
}
if (this.hasOption(OPTION_STATIC_BEFORE_INSTANCE) && previous.isInstance !== current.isInstance) {
return Number(previous.isInstance) < Number(current.isInstance);
if (this.hasOption(OPTION_STATIC_BEFORE_INSTANCE) && previousMember.isInstance !== currentMember.isInstance) {
return Number(previousMember.isInstance) < Number(currentMember.isInstance);
}
if (this.hasOption(OPTION_PUBLIC_BEFORE_PRIVATE) && previous.isPrivate !== current.isPrivate) {
return Number(previous.isPrivate) < Number(current.isPrivate);
if (this.hasOption(OPTION_PUBLIC_BEFORE_PRIVATE) && previousMember.isPrivate !== currentMember.isPrivate) {
return Number(previousMember.isPrivate) < Number(currentMember.isPrivate);
}

@@ -120,0 +113,0 @@ return true;

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

var currentScope = this.getCurrentScope();
var currentBlockScope = this.getCurrentBlockScope();
if (this.isVarInAnyScope(variableName)) {

@@ -65,0 +64,0 @@ this.addFailureOnIdentifier(variableIdentifier);

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

var sourceFileText = nextCaseOrDefaultStatement.getSourceFile().text;
var childCount = nextCaseOrDefaultStatement.getChildCount();
var firstChild = nextCaseOrDefaultStatement.getChildAt(0);

@@ -68,0 +67,0 @@ var commentRanges = ts.getLeadingCommentRanges(sourceFileText, firstChild.getFullStart());

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

};
var OPTION_LEADING_UNDERSCORE = "no-var-keyword";
var Rule = (function (_super) {

@@ -25,0 +24,0 @@ __extends(Rule, _super);

@@ -57,3 +57,3 @@ /*

if (elseStatement != null) {
var elseKeyword = OneLineWalker.getFirstChildOfKind(node, 76);
var elseKeyword = getFirstChildOfKind(node, 76);
if (elseStatement.kind === 180) {

@@ -150,3 +150,3 @@ var elseOpeningBrace = elseStatement.getChildAt(0);

var nameNode = node.name;
var openBraceToken = OneLineWalker.getFirstChildOfKind(node, 14);
var openBraceToken = getFirstChildOfKind(node, 14);
this.handleOpeningBrace(nameNode, openBraceToken);

@@ -163,3 +163,3 @@ _super.prototype.visitEnumDeclaration.call(this, node);

var nameNode = node.name;
var openBraceToken = OneLineWalker.getFirstChildOfKind(node, 14);
var openBraceToken = getFirstChildOfKind(node, 14);
this.handleOpeningBrace(nameNode, openBraceToken);

@@ -170,3 +170,3 @@ _super.prototype.visitInterfaceDeclaration.call(this, node);

var nameNode = node.name;
var openBraceToken = OneLineWalker.getFirstChildOfKind(node, 14);
var openBraceToken = getFirstChildOfKind(node, 14);
this.handleOpeningBrace(nameNode, openBraceToken);

@@ -190,3 +190,3 @@ _super.prototype.visitClassDeclaration.call(this, node);

if (body != null && body.kind === 180) {
var arrowToken = OneLineWalker.getFirstChildOfKind(node, 32);
var arrowToken = getFirstChildOfKind(node, 32);
var openBraceToken = node.body.getChildAt(0);

@@ -205,3 +205,3 @@ this.handleOpeningBrace(arrowToken, openBraceToken);

else {
var closeParenToken = OneLineWalker.getFirstChildOfKind(node, 17);
var closeParenToken = getFirstChildOfKind(node, 17);
this.handleOpeningBrace(closeParenToken, openBraceToken);

@@ -237,6 +237,6 @@ }

};
OneLineWalker.getFirstChildOfKind = function (node, kind) {
return node.getChildren().filter(function (child) { return child.kind === kind; })[0];
};
return OneLineWalker;
})(Lint.RuleWalker);
function getFirstChildOfKind(node, kind) {
return node.getChildren().filter(function (child) { return child.kind === kind; })[0];
}
Change Log
===
v2.4.3
---
* [new-rule] `no-conditional-assignment` (#507)
* [new-rule] `member-access` (#552)
* [new-rule] `no-internal-module` (#513)
* [bugfix] small fixes to `sample.tslint.json` (#545)
* [bugfix] fix README docs for quotemark and indent (#523)
* [enhancement] update `findup-sync` and `underscore.string` dependencies
* [enhancement] add `"typescript"` field to `package.json` (#560)
* [enhancement] small improvements to CLI help text
* [enhancement] expose raw failures array in the JS API (#477)
v2.4.2

@@ -14,2 +26,4 @@ ---

* [enhancement] CI tests are now run on node v0.12 in addition to v0.10
* **BREAKING**
* `-f` option removed from CLI

@@ -16,0 +30,0 @@ v2.3.1-beta

@@ -16,3 +16,3 @@ {

"forin": true,
"indent": [true, 4],
"indent": [true, "spaces"],
"interface-name": true,

@@ -23,2 +23,3 @@ "jsdoc-format": true,

"max-line-length": [true, 140],
"member-access": true,
"member-ordering": [true,

@@ -32,2 +33,3 @@ "public-before-private",

"no-bitwise": true,
"no-conditional-assignment": true,
"no-console": [true,

@@ -48,2 +50,3 @@ "debug",

"no-eval": true,
"no-internal-module": true,
"no-require-imports": true,

@@ -50,0 +53,0 @@ "no-string-literal": true,

@@ -67,3 +67,3 @@ declare module Lint {

protected visitNode(node: ts.Node): void;
private walkChildren(node);
protected walkChildren(node: ts.Node): void;
}

@@ -186,2 +186,3 @@ }

function isBlockScopedBindingElement(node: ts.BindingElement): boolean;
function isNodeFlagSet(node: ts.Node, flagToCheck: ts.NodeFlags): boolean;
}

@@ -243,2 +244,3 @@ declare module Lint {

failureCount: number;
failures: RuleFailure[];
format: string;

@@ -245,0 +247,0 @@ output: string;

{
"name": "tslint",
"version": "2.4.2",
"version": "2.4.3",
"description": "a static analysis linter for TypeScript",

@@ -9,2 +9,5 @@ "bin": {

"main": "./lib/tslint",
"typescript": {
"definition": "lib/tslint.d.ts"
},
"repository": {

@@ -23,5 +26,5 @@ "type": "git",

"dependencies": {
"findup-sync": "~0.1.2",
"findup-sync": "~0.2.1",
"optimist": "~0.6.0",
"underscore.string": "~2.3.3"
"underscore.string": "~3.1.1"
},

@@ -38,8 +41,8 @@ "devDependencies": {

"grunt-ts": "^4.1.0",
"grunt-tslint": "^2.3.1-beta",
"grunt-tslint": "latest",
"mocha": "^2.2.5",
"tslint": "^2.3.1-beta",
"typescript": "1.5.3"
"tslint": "latest",
"typescript": "latest"
},
"license": "Apache-2.0"
}

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

##### `next` distribution
The [`next` branch of the TSLint repo](https://github.com/palantir/tslint/tree/next) tracks the latest TypeScript
compiler and allows you to lint TS code that uses the latest features of the language. Releases from this branch
are published to npm with the `next` dist-tag, so you can get the latest dev version of TSLint via
`npm install tslint@next`.
Usage

@@ -31,3 +38,3 @@ -----

usage: `tslint [options...] [file ...]`
usage: `tslint [options] [file ...]`

@@ -44,3 +51,3 @@ Options:

tslint accepts the following commandline options:
tslint accepts the following command-line options:

@@ -138,3 +145,5 @@ -c, --config:

* `forin` enforces a `for ... in` statement to be filtered with an `if` statement.*
* `indent` enforces consistent indentation with tabs or spaces.
* `indent` enforces indentation with tabs or spaces. Rule options (one is required):
* `"tabs"` enforces consistent tabs
* `"spaces"` enforces consistent spaces
* `interface-name` enforces the rule that interface names must begin with a capital 'I'

@@ -149,2 +158,3 @@ * `jsdoc-format` enforces basic format rules for jsdoc comments -- comments starting with `/**`

* `max-line-length` sets the maximum length of a line.
* `member-access` enforces using explicit visibility on class members
* `member-ordering` enforces member ordering. Rule options:

@@ -157,2 +167,3 @@ * `public-before-private` All public members must be declared before private members

* `no-bitwise` disallows bitwise operators.
* `no-conditional-assignment` disallows any type of assignment in any conditionals. This applies to `do-while`, `for`, `if`, and `while` statements.
* `no-console` disallows access to the specified functions on `console`. Rule options are functions to ban on the console variable.

@@ -168,2 +179,3 @@ * `no-consecutive-blank-lines` disallows having more than one blank line in a row in a file

* `no-eval` disallows `eval` function invocations.
* `no-internal-module` disallows internal `module`, use `namespace` instead.
* `no-require-imports` disallows require() style imports

@@ -187,3 +199,5 @@ * `no-string-literal` disallows object access via string literals.

* `"check-whitespace"` checks preceding whitespace for the specified tokens.
* `quotemark` enforces consistent single or double quoted string literals.
* `quotemark` enforces consistent single or double quoted string literals. Rule options (one is required):
* `"single"` enforces single quotes
* `"double"` enforces double quotes
* `radix` enforces the radix parameter of `parseInt`

@@ -190,0 +204,0 @@ * `semicolon` enforces semicolons at the end of every statement.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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