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

tslint-immutable

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tslint-immutable - npm Package Compare versions

Comparing version 5.5.1 to 5.5.2

4

CHANGELOG.md

@@ -10,2 +10,6 @@ # Change Log

## [v5.5.2] - 2019-03-25
* readonly-array rule with the option ignore-prefix set will now ignore nested arrays within an ignored variable. See [#132](https://github.com/jonaskello/tslint-immutable/issues/132). See PR [#133](https://github.com/jonaskello/tslint-immutable/pull/133)
## [v5.5.1] - 2019-03-22

@@ -12,0 +16,0 @@

2

package.json
{
"name": "tslint-immutable",
"version": "5.5.1",
"version": "5.5.2",
"description": "TSLint rules to disable mutation in TypeScript.",

@@ -5,0 +5,0 @@ "main": "tslint-immutable.json",

@@ -60,5 +60,2 @@ "use strict";

function checkTypedNode(node, ctx, checker) {
return { invalidNodes: getInvalidNodes(node, ctx, checker) };
}
function getInvalidNodes(node, ctx, checker) {
if (utils.isBinaryExpression(node)) {

@@ -79,3 +76,3 @@ return checkBinaryExpression(node, ctx, checker);

}
return [];
return { invalidNodes: [] };
}

@@ -92,6 +89,6 @@ /**

if (isArrayType(leftExpressionType)) {
return [check_node_1.createInvalidNode(node, [])];
return { invalidNodes: [check_node_1.createInvalidNode(node, [])] };
}
}
return [];
return { invalidNodes: [] };
}

@@ -106,6 +103,6 @@ /**

if (isArrayType(expressionType)) {
return [check_node_1.createInvalidNode(node, [])];
return { invalidNodes: [check_node_1.createInvalidNode(node, [])] };
}
}
return [];
return { invalidNodes: [] };
}

@@ -121,6 +118,6 @@ /**

if (isArrayType(operandExpressionType)) {
return [check_node_1.createInvalidNode(node, [])];
return { invalidNodes: [check_node_1.createInvalidNode(node, [])] };
}
}
return [];
return { invalidNodes: [] };
}

@@ -136,6 +133,6 @@ /**

if (isArrayType(operandExpressionType)) {
return [check_node_1.createInvalidNode(node, [])];
return { invalidNodes: [check_node_1.createInvalidNode(node, [])] };
}
}
return [];
return { invalidNodes: [] };
}

@@ -154,6 +151,6 @@ /**

if (isArrayType(expressionType)) {
return [check_node_1.createInvalidNode(node, [])];
return { invalidNodes: [check_node_1.createInvalidNode(node, [])] };
}
}
return [];
return { invalidNodes: [] };
}

@@ -160,0 +157,0 @@ /**

@@ -11,6 +11,9 @@ "use strict";

function checkNode(node, ctx) {
var variableStatementFailures = checkVariableStatement(node, ctx);
var forStatementsFailures = checkForStatements(node, ctx);
var results = [
checkVariableStatement(node, ctx),
checkForStatements(node, ctx)
];
return {
invalidNodes: variableStatementFailures.concat(forStatementsFailures)
invalidNodes: results.reduce(function (merged, result) { return merged.concat(result.invalidNodes); }, []),
skipChildren: results.some(function (result) { return result.skipChildren === true; })
};

@@ -22,3 +25,3 @@ }

}
return [];
return { invalidNodes: [] };
}

@@ -34,3 +37,3 @@ function checkForStatements(node, ctx) {

}
return [];
return { invalidNodes: [] };
}

@@ -59,6 +62,6 @@ function checkDeclarationList(declarationList, ctx) {

}
return invalidVariableDeclarationNodes;
return { invalidNodes: invalidVariableDeclarationNodes };
}
return [];
return { invalidNodes: [] };
}
//# sourceMappingURL=noLetRule.js.map

@@ -12,4 +12,11 @@ "use strict";

function checkNode(node, ctx) {
var results = [
checkArrayType(node, ctx),
checkTypeReference(node, ctx),
checkImplicitType(node, ctx),
checkTupleType(node, ctx)
];
return {
invalidNodes: checkArrayType(node, ctx).concat(checkTypeReference(node, ctx), checkImplicitType(node, ctx), checkTupleType(node, ctx))
invalidNodes: results.reduce(function (merged, result) { return merged.concat(result.invalidNodes); }, []),
skipChildren: results.some(function (result) { return result.skipChildren === true; })
};

@@ -24,7 +31,10 @@ }

node.parent.operator === ts.SyntaxKind.ReadonlyKeyword) {
return [];
return { invalidNodes: [] };
}
if (node.parent &&
Ignore.shouldIgnorePrefix(node.parent, ctx.options, ctx.sourceFile)) {
return [];
return {
invalidNodes: [],
skipChildren: true
};
}

@@ -35,6 +45,6 @@ if (ctx.options.ignoreRestParameters &&

node.parent.dotDotDotToken) {
return [];
return { invalidNodes: [] };
}
if (ctx.options.ignoreReturnType && checkIsReturnTypeOrNestedWithIn(node)) {
return [];
return { invalidNodes: [] };
}

@@ -44,9 +54,11 @@ var _a = ts.version

.map(function (n) { return Number.parseInt(n, 10); }), major = _a[0], minor = _a[1];
return [
check_node_1.createInvalidNode(node, major > 3 || (major === 3 && minor >= 4)
? getReadonlyKeywordFix(node, ctx)
: getReadonlyArrayFix(node, ctx))
];
return {
invalidNodes: [
check_node_1.createInvalidNode(node, major > 3 || (major === 3 && minor >= 4)
? getReadonlyKeywordFix(node, ctx)
: getReadonlyArrayFix(node, ctx))
]
};
}
return [];
return { invalidNodes: [] };
}

@@ -59,18 +71,26 @@ function checkTypeReference(node, ctx) {

Ignore.shouldIgnorePrefix(node.parent, ctx.options, ctx.sourceFile)) {
return [];
return {
invalidNodes: [],
skipChildren: true
};
}
if (ctx.options.ignoreReturnType && checkIsReturnTypeOrNestedWithIn(node)) {
return [];
return { invalidNodes: [] };
}
return [
check_node_1.createInvalidNode(node, [
new Lint.Replacement(node.getStart(ctx.sourceFile), 0, "Readonly")
])
];
return {
invalidNodes: [
check_node_1.createInvalidNode(node, [
new Lint.Replacement(node.getStart(ctx.sourceFile), 0, "Readonly")
])
]
};
}
return [];
return { invalidNodes: [] };
}
function checkImplicitType(node, ctx) {
if (Ignore.shouldIgnorePrefix(node, ctx.options, ctx.sourceFile)) {
return [];
return {
invalidNodes: [],
skipChildren: true
};
}

@@ -83,9 +103,11 @@ // Check if the initializer is used to set an implicit array type

var typeArgument = "any";
return [
check_node_1.createInvalidNode(node.name, [
new Lint.Replacement(node.name.end - length_1, length_1, nameText + ": ReadonlyArray<" + typeArgument + ">")
])
];
return {
invalidNodes: [
check_node_1.createInvalidNode(node.name, [
new Lint.Replacement(node.name.end - length_1, length_1, nameText + ": ReadonlyArray<" + typeArgument + ">")
])
]
};
}
return [];
return { invalidNodes: [] };
}

@@ -113,8 +135,12 @@ exports.checkImplicitType = checkImplicitType;

node.parent.operator === ts.SyntaxKind.ReadonlyKeyword) {
return [];
return { invalidNodes: [] };
}
return [check_node_1.createInvalidNode(node, getReadonlyKeywordFix(node, ctx))];
return {
invalidNodes: [
check_node_1.createInvalidNode(node, getReadonlyKeywordFix(node, ctx))
]
};
}
}
return [];
return { invalidNodes: [] };
}

@@ -121,0 +147,0 @@ function getReadonlyKeywordFix(node, ctx) {

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

function checkNode(node, ctx) {
return { invalidNodes: checkPropertySignatureAndIndexSignature(node, ctx) };
return checkPropertySignatureAndIndexSignature(node, ctx);
}

@@ -27,3 +27,3 @@ function checkPropertySignatureAndIndexSignature(node, ctx) {

if (Ignore.shouldIgnorePrefix(node, ctx.options, ctx.sourceFile)) {
return [];
return { invalidNodes: [] };
}

@@ -33,8 +33,10 @@ var start = utils.isIndexSignatureDeclaration(node)

: node.name.getStart(ctx.sourceFile);
return [
check_node_1.createInvalidNode(node, [new Lint.Replacement(start, 0, "readonly ")])
];
return {
invalidNodes: [
check_node_1.createInvalidNode(node, [new Lint.Replacement(start, 0, "readonly ")])
]
};
}
return [];
return { invalidNodes: [] };
}
//# sourceMappingURL=readonlyKeywordRule.js.map

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

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