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

tslint-microsoft-contrib

Package Overview
Dependencies
Maintainers
4
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tslint-microsoft-contrib - npm Package Compare versions

Comparing version 0.0.4 to 1.0.0

chaiVagueErrorsRule.js

26

exportNameRule.js

@@ -7,3 +7,4 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var Utils = require('./utils/Utils');
var Rule = (function (_super) {

@@ -17,2 +18,11 @@ __extends(Rule, _super);

};
Rule.getExceptions = function (options) {
if (options.ruleArguments instanceof Array) {
return options.ruleArguments[0];
}
if (options instanceof Array) {
return options;
}
return null;
};
Rule.FAILURE_STRING = 'The exported module name must match the file name. Found: ';

@@ -31,5 +41,7 @@ return Rule;

if (!regex.test(this.getFilename())) {
var failureString = Rule.FAILURE_STRING + this.getSourceFile().fileName + ' and ' + exportedName;
var failure = this.createFailure(node.expression.getStart(), node.expression.getWidth(), failureString);
this.addFailure(failure);
if (!this.isSuppressed(exportedName)) {
var failureString = Rule.FAILURE_STRING + this.getSourceFile().fileName + ' and ' + exportedName;
var failure = this.createFailure(node.expression.getStart(), node.expression.getWidth(), failureString);
this.addFailure(failure);
}
}

@@ -46,4 +58,10 @@ _super.prototype.visitExportAssignment.call(this, node);

};
ExportNameWalker.prototype.isSuppressed = function (exportedName) {
var allExceptions = Rule.getExceptions(this.getOptions());
return Utils.exists(allExceptions, function (exception) {
return new RegExp(exception).test(exportedName);
});
};
return ExportNameWalker;
})(ErrorTolerantWalker);
//# sourceMappingURL=exportNameRule.js.map

2

missingOptionalAnnotationRule.js

@@ -7,3 +7,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var Rule = (function (_super) {

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

@@ -7,3 +7,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var BannedTermWalker = require('./BannedTermWalker');
var BannedTermWalker = require('./utils/BannedTermWalker');
var Rule = (function (_super) {

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

@@ -7,3 +7,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var Rule = (function (_super) {

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

@@ -7,3 +7,4 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var SyntaxKind = require('./utils/SyntaxKind');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var Rule = (function (_super) {

@@ -29,11 +30,11 @@ __extends(Rule, _super);

_super.prototype.visitExpressionStatement.call(this, node);
if (node.expression.kind === 165) {
if (node.expression.kind === SyntaxKind.current().DeleteExpression) {
var deletedObject = node.expression.getChildren()[1];
if (deletedObject.kind === 157) {
if (deletedObject.kind === SyntaxKind.current().ElementAccessExpression) {
var deletedExpression = deletedObject.expression;
if (deletedExpression.kind !== 156) {
if (deletedExpression.kind !== SyntaxKind.current().PropertyAccessExpression) {
this.addNoDeleteFailure(deletedObject);
}
}
else if (deletedObject.kind !== 156) {
else if (deletedObject.kind !== SyntaxKind.current().PropertyAccessExpression) {
this.addNoDeleteFailure(deletedObject);

@@ -40,0 +41,0 @@ }

@@ -7,4 +7,4 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var AstUtils = require('./AstUtils');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var AstUtils = require('./utils/AstUtils');
var Rule = (function (_super) {

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

@@ -7,4 +7,4 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var AstUtils = require('./AstUtils');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var AstUtils = require('./utils/AstUtils');
var Rule = (function (_super) {

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

@@ -7,3 +7,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var Rule = (function (_super) {

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

@@ -7,4 +7,4 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var AstUtils = require('./AstUtils');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var AstUtils = require('./utils/AstUtils');
var Rule = (function (_super) {

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

@@ -7,4 +7,4 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var AstUtils = require('./AstUtils');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var AstUtils = require('./utils/AstUtils');
var Rule = (function (_super) {

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

@@ -7,3 +7,5 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var SyntaxKind = require('./utils/SyntaxKind');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var Utils = require('./utils/Utils');
var Rule = (function (_super) {

@@ -27,8 +29,10 @@ __extends(Rule, _super);

NoHttpStringWalker.prototype.visitNode = function (node) {
if (node.kind === 8) {
if (node.kind === SyntaxKind.current().StringLiteral) {
var stringText = node.text;
if (/.*http:.*/.test(stringText)) {
var failureString = Rule.FAILURE_STRING + '\'' + stringText + '\'';
var failure = this.createFailure(node.getStart(), node.getWidth(), failureString);
this.addFailure(failure);
if (!this.isSuppressed(stringText)) {
var failureString = Rule.FAILURE_STRING + '\'' + stringText + '\'';
var failure = this.createFailure(node.getStart(), node.getWidth(), failureString);
this.addFailure(failure);
}
}

@@ -38,4 +42,19 @@ }

};
NoHttpStringWalker.prototype.isSuppressed = function (stringText) {
var allExceptions = NoHttpStringWalker.getExceptions(this.getOptions());
return Utils.exists(allExceptions, function (exception) {
return new RegExp(exception).test(stringText);
});
};
NoHttpStringWalker.getExceptions = function (options) {
if (options.ruleArguments instanceof Array) {
return options.ruleArguments[0];
}
if (options instanceof Array) {
return options;
}
return null;
};
return NoHttpStringWalker;
})(ErrorTolerantWalker);
//# sourceMappingURL=noHttpStringRule.js.map

@@ -7,3 +7,4 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var SyntaxKind = require('./utils/SyntaxKind');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var Rule = (function (_super) {

@@ -34,6 +35,6 @@ __extends(Rule, _super);

NoIncrementDecrementWalker.prototype.validateUnaryExpression = function (node) {
if (node.operator === 38) {
if (node.operator === SyntaxKind.current().PlusPlusToken) {
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), 'Forbidden ++ operator'));
}
else if (node.operator === 39) {
else if (node.operator === SyntaxKind.current().MinusMinusToken) {
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), 'Forbidden -- operator'));

@@ -40,0 +41,0 @@ }

@@ -7,3 +7,4 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var SyntaxKind = require('./utils/SyntaxKind');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var Rule = (function (_super) {

@@ -27,3 +28,3 @@ __extends(Rule, _super);

NoMultilineStringWalker.prototype.visitNode = function (node) {
if (node.kind === 10) {
if (node.kind === SyntaxKind.current().NoSubstitutionTemplateLiteral) {
var fullText = node.getFullText();

@@ -30,0 +31,0 @@ var firstLine = fullText.substring(0, fullText.indexOf('\n'));

@@ -7,3 +7,4 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var SyntaxKind = require('./utils/SyntaxKind');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var Rule = (function (_super) {

@@ -28,25 +29,18 @@ __extends(Rule, _super);

NoOctalLiteral.prototype.visitNode = function (node) {
this.handleNode(node);
if (node.kind === SyntaxKind.current().StringLiteral) {
this.failOnOctalString(node);
}
_super.prototype.visitNode.call(this, node);
};
NoOctalLiteral.prototype.handleNode = function (node) {
if (node.kind === 228) {
var text = node.getText();
this.matchRegexAndFail(text, /(".*(\\-?[0-7]{1,3}(?![0-9])).*")/g);
this.matchRegexAndFail(text, /('.*(\\-?[0-7]{1,3}(?![0-9])).*')/g);
NoOctalLiteral.prototype.failOnOctalString = function (node) {
var match = /("|')(.*(\\-?[0-7]{1,3}(?![0-9])).*("|'))/g.exec(node.getText());
if (match) {
var octalValue = match[3];
var startOfMatch = node.getStart() + node.getText().indexOf(octalValue);
var width = octalValue.length;
this.addFailure(this.createFailure(startOfMatch, width, Rule.FAILURE_STRING + octalValue));
}
};
NoOctalLiteral.prototype.matchRegexAndFail = function (text, regex) {
var match;
while (match = regex.exec(text)) {
var startOfMatch = text.indexOf(match[1]);
var failure = void 0;
failure = this.createFailure(startOfMatch, match[2].length, Rule.FAILURE_STRING + match[2]);
if (failure != null) {
this.addFailure(failure);
}
}
};
return NoOctalLiteral;
})(ErrorTolerantWalker);
//# sourceMappingURL=noOctalLiteralRule.js.map

@@ -7,3 +7,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var BannedTermWalker = require('./BannedTermWalker');
var BannedTermWalker = require('./utils/BannedTermWalker');
var Rule = (function (_super) {

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

@@ -7,3 +7,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var NoStringParameterToFunctionCallWalker = require('./NoStringParameterToFunctionCallWalker');
var NoStringParameterToFunctionCallWalker = require('./utils/NoStringParameterToFunctionCallWalker');
var Rule = (function (_super) {

@@ -15,5 +15,4 @@ __extends(Rule, _super);

Rule.prototype.apply = function (sourceFile) {
var languageServiceHost;
var documentRegistry = ts.createDocumentRegistry();
languageServiceHost = Lint.createLanguageServiceHost('file.ts', sourceFile.getFullText());
var languageServiceHost = Lint.createLanguageServiceHost('file.ts', sourceFile.getFullText());
var languageService = ts.createLanguageService(languageServiceHost, documentRegistry);

@@ -20,0 +19,0 @@ var walker = new NoStringParameterToFunctionCallWalker(sourceFile, 'setImmediate', this.getOptions(), languageService);

@@ -7,3 +7,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var NoStringParameterToFunctionCallWalker = require('./NoStringParameterToFunctionCallWalker');
var NoStringParameterToFunctionCallWalker = require('./utils/NoStringParameterToFunctionCallWalker');
var Rule = (function (_super) {

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

@@ -7,3 +7,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var NoStringParameterToFunctionCallWalker = require('./NoStringParameterToFunctionCallWalker');
var NoStringParameterToFunctionCallWalker = require('./utils/NoStringParameterToFunctionCallWalker');
var Rule = (function (_super) {

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

@@ -7,3 +7,4 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var SyntaxKind = require('./utils/SyntaxKind');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var Rule = (function (_super) {

@@ -27,3 +28,3 @@ __extends(Rule, _super);

NoUnnecessarySemicolonsWalker.prototype.visitNode = function (node) {
if (node.kind === 182) {
if (node.kind === SyntaxKind.current().EmptyStatement) {
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));

@@ -30,0 +31,0 @@ }

@@ -7,3 +7,4 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var SyntaxKind = require('./utils/SyntaxKind');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var Rule = (function (_super) {

@@ -38,3 +39,3 @@ __extends(Rule, _super);

var moduleReference = node.moduleReference;
if (moduleReference.kind === 127) {
if (moduleReference.kind === SyntaxKind.current().QualifiedName) {
if (moduleReference.left != null) {

@@ -65,3 +66,3 @@ this.gatherReferenceFromImport(moduleReference.left.text);

NoUnusedImportsWalker.prototype.visitImportEqualsDeclaration = function (node) {
if (!this.hasModifier(node.modifiers, 78)) {
if (!this.hasModifier(node.modifiers, SyntaxKind.current().ExportKeyword)) {
this.validateReferencesForVariable(node.name.text, node.name.getStart());

@@ -68,0 +69,0 @@ }

@@ -7,3 +7,4 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var SyntaxKind = require('./utils/SyntaxKind');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var Rule = (function (_super) {

@@ -23,7 +24,7 @@ __extends(Rule, _super);

__extends(NoWithStatementWalker, _super);
function NoWithStatementWalker(sourceFile, options) {
_super.call(this, sourceFile, options);
function NoWithStatementWalker() {
_super.apply(this, arguments);
}
NoWithStatementWalker.prototype.visitNode = function (node) {
if (node.kind === 193) {
if (node.kind === SyntaxKind.current().WithStatement) {
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));

@@ -30,0 +31,0 @@ }

{
"name": "tslint-microsoft-contrib",
"version": "0.0.4",
"version": "1.0.0",
"description": "TSLint Rules for Microsoft",

@@ -33,3 +33,6 @@ "repository": {

"license": "MIT",
"analyze": true
"analyze": true,
"scripts": {
"test": "grunt all"
}
}

@@ -7,3 +7,4 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var SyntaxKind = require('./utils/SyntaxKind');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var Rule = (function (_super) {

@@ -47,3 +48,3 @@ __extends(Rule, _super);

var keyNode = node.name;
if (keyNode.kind === 65) {
if (keyNode.kind === SyntaxKind.current().Identifier) {
if (keyNode.text === 'dangerouslySetInnerHTML') {

@@ -50,0 +51,0 @@ if (!this.isSuppressed(this.currentMethodName)) {

@@ -0,1 +1,5 @@

[![npm version](https://badge.fury.io/js/tslint-microsoft-contrib.svg)](https://badge.fury.io/js/tslint-microsoft-contrib)
[![Downloads](http://img.shields.io/npm/dm/tslint-microsoft-contrib.svg)](https://npmjs.org/package/tslint-microsoft-contrib)
[![Build Status](https://travis-ci.org/Microsoft/tslint-microsoft-contrib.svg?branch=master)](https://travis-ci.org/Microsoft/tslint-microsoft-contrib)
[![Join the chat at https://gitter.im/Microsoft/tslint-microsoft-contrib](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Microsoft/tslint-microsoft-contrib?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

@@ -7,6 +11,5 @@ tslint-microsoft-contrib

Version 0.0.4
Version 1.0.0
-------------
This software is not yet released with a 1.0 version.
All [release blockers](https://github.com/Microsoft/tslint-microsoft-contrib/issues?q=is%3Aopen+is%3Aissue+milestone%3A1.0) are listed in the issues page.
The project has been in use for at least several months on multiple projects. Please report any bugs or false positives you might find!

@@ -18,2 +21,8 @@ Installation

Alternately, you can download the files directly from GitHub:
* [Latest Development Version](https://github.com/Microsoft/tslint-microsoft-contrib/tree/releases)
* [1.0](https://github.com/Microsoft/tslint-microsoft-contrib/tree/npm-1.0)
* [0.0.4](https://github.com/Microsoft/tslint-microsoft-contrib/tree/npm-0.0.4)
Configuration

@@ -24,3 +33,3 @@ -------------

Add the new rulesDirectory to your tslint task:
Add the new rulesDirectory to your tslint task:

@@ -39,3 +48,3 @@ grunt.initConfig({

The tslint-contrib.json file follows the same conventions as other tslint rules.
The tslint-contrib.json file follows the same conventions as other tslint rules.

@@ -45,29 +54,53 @@ Supported Rules

A sample configuration file with all options is available under tslint-microsoft-contrig/tslint.json
A sample configuration file with all options is available here: [tslint.json](tslint.json)
* `export-name` The name of the exported module must match the filename of the source file. This is case-sensitive but ignores file extension.
* `missing-optional-annotation` A parameter that follows one or more parameters marked as optional is not itself marked optional
* `no-banned-terms` Do not use banned terms: [caller](https://msdn.microsoft.com/library/7t96kt3h(v=vs.94).aspx), [callee](https://msdn.microsoft.com/library/334e1zza(v=vs.94).aspx), [eval](https://msdn.microsoft.com/library/12k71sw7(v=vs.94).aspx), [arguments](https://msdn.microsoft.com/library/he95z461(v=vs.94).aspx). These terms refer to functions or properties that should not be used, so it is best practice to simply avoid them.
* `no-cookies` Do not use cookies
* `no-delete-expression` Do not delete expressions. Only properties should be deleted
* `no-disable-auto-sanitization` Do not disable auto-sanitization of HTML because this opens up your page to an XSS attack. Specifically, do not use the [execUnsafeLocalFunction](https://msdn.microsoft.com/en-us/library/windows/apps/hh767331.aspx) or [setInnerHTMLUnsafe](https://msdn.microsoft.com/en-us/library/windows/apps/br211696.aspx) functions.
* `no-document-write` Do not use document.write
* `no-duplicate-parameter-names` Do not write functions or methods with duplicate parameter names
* `no-exec-script` Do not use the execScript functions
* `no-function-constructor-with-string-args` Do not use the version of the Function constructor that accepts a string argument to define the body of the function
* `no-http-string` Do not use strings that start with 'http:'. URL strings should start with 'https:'. Http strings can be a security problem and indicator that your software may suffer from cookie-stealing attacks.
* `no-increment-decrement` Avoid use of increment and decrement operators particularly as part of complicated expressions
* `no-multiline-string` Do not declare multiline strings
* `no-unnecessary-semicolons` Remove unnecessary semicolons
* `no-octal-literal` Do not use octal literals or escaped octal sequences
* `no-reserved-keywords` Do not use reserved keywords as names of local variables, fields, functions, or other identifiers.
* `no-string-based-set-immediate` Do not use the version of setImmediate that accepts code as a string argument. However, it is acceptable to use the version of setImmediate where a direct reference to a function is provided as the callback argument
* `no-string-based-set-interval` Do not use the version of setInterval that accepts code as a string argument. However, it is acceptable to use the version of setInterval where a direct reference to a function is provided as the callback argument
* `no-string-based-set-timeout` Do not use the version of setTimeout that accepts code as a string argument. However, it is acceptable to use the version of setTimeout where a direct reference to a function is provided as the callback argument
* `no-unused-imports` Remove unused imports
* `no-with-statement` Do not use with statements. Assign the item to a new variable instead
* `react-no-dangerous-html` Do not use React's dangerouslySetInnerHTML API. This rule finds usages of the dangerouslySetInnerHTML API (but not any JSX references). For more info see the [react-no-dangerous-html Rule wiki page](https://github.com/Microsoft/tslint-microsoft-contrib/wiki/react-no-dangerous-html-Rule).
* `use-named-parameter` Do not reference the arguments object by numerical index; instead, use a named parameter. This rule is similar to JSLint's [Use a named parameter](https://jslinterrors.com/use-a-named-parameter) rule.
Rule Name | Description | Since
:---------- | :------------ | -------------
`chai-vague-errors` | Avoid Chai assertions that result in vague errors. For example, asserting `expect(something).to.be.true` will result in the failure message "Expected true received false". This is a vague error message that does not reveal the underlying problem. It is especially vague in TypeScript because stack trace line numbers often do not match the source code. A better pattern to follow is the xUnit Patterns [Assertion Message](http://xunitpatterns.com/Assertion%20Message.html) pattern. The previous code sample could be better written as `expect(something).to.equal(true, 'expected something to have occurred');`| 1.0
`export-name` | The name of the exported module must match the filename of the source file. This is case-sensitive but ignores file extension. Since version 1.0, this rule takes a list of regular expressions as a parameter. Any export name matching that regular expression will be ignored. For example, to allow an exported name like myChartOptions, then configure the rule like this: "export-name": \[true, "myChartOptionsg"\]| 0.0.3
`use-isnan` | Ensures that you use the isNaN() function to check for NaN references instead of a comparison to the NaN constant. Similar to the [use-isnan ESLint rule](http://eslint.org/docs/rules/use-isnan).| 1.0
`jquery-deferred-must-complete` | When a JQuery Deferred instance is created, then either reject() or resolve() must be called on it within all code branches in the scope. For more examples see the [feature request](https://github.com/Microsoft/tslint-microsoft-contrib/issues/26). | 1.0
`missing-jsdoc` | All files must have a top level [JSDoc](http://usejsdoc.org/) comment. A JSDoc comment starts with /** (not one more or one less asterisk) and a JSDoc at the 'top-level' appears without leading spaces. Trailing spaces are acceptable but not recommended. | 1.0
`missing-optional-annotation` | A parameter that follows one or more parameters marked as optional is not itself marked optional | 0.0.1
`mocha-avoid-only` | Do not invoke Mocha's describe.only or it.only functions. These functions are useful ways to run a single unit test or a single test case during your build, but please be careful to not push these methods calls to your version control repositiory because it will turn off any of the other tests.| 1.0
`no-backbone-get-set-outside-model` | Avoid using model.get('x') and model.set('x', value) Backbone accessors outside of the owning model. This breaks type safety and you should define getters and setters for your attributes instead.| 1.0
`no-banned-terms` | Do not use banned terms: [caller](https://msdn.microsoft.com/library/7t96kt3h(v=vs.94).aspx), [callee](https://msdn.microsoft.com/library/334e1zza(v=vs.94).aspx), [eval](https://msdn.microsoft.com/library/12k71sw7(v=vs.94).aspx), [arguments](https://msdn.microsoft.com/library/he95z461(v=vs.94).aspx). These terms refer to functions or properties that should not be used, so it is best practice to simply avoid them. | 0.0.1
`no-constant-condition` | Do not use constant expressions in conditions. Similar to the [ESLint no-constant-condition](http://eslint.org/docs/rules/no-constant-condition) rule | 1.0
`no-control-regex` | Do not use control characters in regular expressions . Similar to the [ESLint no-control-regex](http://eslint.org/docs/rules/no-control-regex) rule | 1.0
`no-cookies` | Do not use cookies | 0.0.1
`no-delete-expression` | Do not delete expressions. Only properties should be deleted | 0.0.2
`no-disable-auto-sanitization` | Do not disable auto-sanitization of HTML because this opens up your page to an XSS attack. Specifically, do not use the [execUnsafeLocalFunction](https://msdn.microsoft.com/en-us/library/windows/apps/hh767331.aspx) or [setInnerHTMLUnsafe](https://msdn.microsoft.com/en-us/library/windows/apps/br211696.aspx) functions. | 0.0.1
`no-document-write` | Do not use document.write | 0.0.1
`no-duplicate-parameter-names` | Do not write functions or methods with duplicate parameter names | 0.0.1
`no-duplicate-case` | Do not use duplicate case labels in switch statements. Similar to the [ESLint no-duplicate-case](http://eslint.org/docs/rules/no-duplicate-case.html) rule | 1.0
`no-empty-interfaces` | Do not use empty interfaces. They are compile-time only artifacts and they serve no useful purpose | 1.0
`no-exec-script` | Do not use the execScript functions | 0.0.1
`no-function-constructor-with-string-args` | Do not use the version of the Function constructor that accepts a string argument to define the body of the function | 0.0.1
`no-function-expression` | Do not use function expressions; use arrow functions (lambdas) instead. In general, lambdas are simpler to use and avoid the confusion about what the 'this' references points to. Function expressions that contain a 'this' reference are allowed and will not create a failure. | 1.0
`no-http-string` | Do not use strings that start with 'http:'. URL strings should start with 'https:'. Http strings can be a security problem and indicator that your software may suffer from cookie-stealing attacks. Since version 1.0, this rule takes a list of regular expressions as a parameter. Any string matching that regular expression will be ignored. For example, to allow http connections to example.com and examples.com, configure your rule like this: "no-http-string": \[true, "http://www.example.com/?.*", "http://www.examples.com/?.*"\]| 0.0.3
`no-increment-decrement` | Avoid use of increment and decrement operators particularly as part of complicated expressions | 0.0.1
`no-for-in` | Avoid use of for-in statements. They can be replaced by Object.keys | 1.0
`no-invalid-regexp` | Do not use invalid regular expression strings in the RegExp constructor. Similar to the [ESLint no-invalid-regexp](http://eslint.org/docs/rules/no-invalid-regexp.html) rule| 1.0
`no-missing-visibility-modifiers` | Class members (both fields and methods) should have visibility modifiers specified. THe Principle of Least Visibility guides us to prefer private methods and fields when possible. If a developer forgets to add a modifier then TypeScript assumes the element should be public, which is the wrong default choice. | 1.0
`no-multiline-string` | Do not declare multiline strings | 0.0.1
`no-multiple-var-decl` | Do not use comma separated variable declarations | 1.0
`no-octal-literal` | Do not use octal literals or escaped octal sequences | 0.0.1
`no-regex-spaces` | Do not use multiple spaces in a regular expression literal. Similar to the [ESLint no-regex-spaces](http://eslint.org/docs/rules/no-regex-spaces.html) rule | 1.0
`no-reserved-keywords` | Do not use reserved keywords as names of local variables, fields, functions, or other identifiers. | 0.0.1
`no-sparse-arrays` | Do not use sparse arrays. Sparse arrays contain empty slots, most frequently due to multiple commas being used in an array literal. Based on the [ESLint no-sparse-arrays](http://eslint.org/docs/rules/no-sparse-arrays) rule | 1.0
`no-string-based-set-immediate` | Do not use the version of setImmediate that accepts code as a string argument. However, it is acceptable to use the version of setImmediate where a direct reference to a function is provided as the callback argument | 0.0.1
`no-string-based-set-interval` | Do not use the version of setInterval that accepts code as a string argument. However, it is acceptable to use the version of setInterval where a direct reference to a function is provided as the callback argument | 0.0.1
`no-string-based-set-timeout` | Do not use the version of setTimeout that accepts code as a string argument. However, it is acceptable to use the version of setTimeout where a direct reference to a function is provided as the callback argument | 0.0.1
`no-unnecessary-semicolons` | Remove unnecessary semicolons | 0.0.1
`no-unnecessary-bind` | Do not bind 'this' as the context for a function literal or lambda expression. If you bind 'this' as the context to a function literal, then you should just use a lambda without the bind. If you bind 'this' as the context to a lambda, then you can remove the bind call because 'this' is already the context for lambdas. Works for Underscore methods as well. | 1.0
`no-unused-imports` | Remove unused imports | 0.0.1
`no-with-statement` | Do not use with statements. Assign the item to a new variable instead | 0.0.1
`prefer-array-literal` | Use array literal syntax when declaring array types instead of the Array object with a generic parameter type. For example, prefer the Javascript from of string[] to the TypeScript form Array<string> | 1.0
`promise-must-complete` | When a Promise instance is created, then either the reject() or resolve() parameter must be called on it within all code branches in the scope. For more examples see the [feature request](https://github.com/Microsoft/tslint-microsoft-contrib/issues/34). | 1.0
`react-no-dangerous-html` | Do not use React's dangerouslySetInnerHTML API. This rule finds usages of the dangerouslySetInnerHTML API (but not any JSX references). For more info see the [react-no-dangerous-html Rule wiki page](https://github.com/Microsoft/tslint-microsoft-contrib/wiki/react-no-dangerous-html-Rule). | 0.0.2
`use-named-parameter` | Do not reference the arguments object by numerical index; instead, use a named parameter. This rule is similar to JSLint's [Use a named parameter](https://jslinterrors.com/use-a-named-parameter) rule. | 0.0.3
`valid-typeof` | Ensures that the results of typeof are compared against a valid string. This rule aims to prevent errors from likely typos by ensuring that when the result of a typeof operation is compared against a string, that the string is a valid value. Similar to the [valid-typeof ESLint rule](http://eslint.org/docs/rules/valid-typeof).| 1.0
Development

@@ -84,3 +117,4 @@ -----------

grunt all
grunt create-rule --rule-name=no-something-or-other
Debug code

@@ -95,11 +129,11 @@ -----------

# on *nix machines:
# on *nix machines:
node --debug-brk /usr/local/bin/grunt mochaTest
# on Windows machines:
# on Windows machines:
node --debug-brk /c/Users/[your alias]/AppData/Roaming/npm/node_modules/grunt-cli/bin/grunt
Open in browser:
http://127.0.0.1:8080/?ws=127.0.0.1:8080&port=5858
Set a breakpoint somewhere in your code and resume execution. Your breakpoint should be hit.

@@ -106,0 +140,0 @@

@@ -7,3 +7,4 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var ErrorTolerantWalker = require('./ErrorTolerantWalker');
var SyntaxKind = require('./utils/SyntaxKind');
var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
var Rule = (function (_super) {

@@ -28,3 +29,3 @@ __extends(Rule, _super);

if (node.argumentExpression != null) {
if (node.argumentExpression.kind === 7) {
if (node.argumentExpression.kind === SyntaxKind.current().NumericLiteral) {
if (node.expression.getText() === 'arguments') {

@@ -31,0 +32,0 @@ var failureString = Rule.FAILURE_STRING + '\'' + node.getText() + '\'';

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