tslint-immutable
Advanced tools
Comparing version 5.0.0 to 5.0.1
{ | ||
"include": [ | ||
"rules/*.js" | ||
], | ||
"exclude": [ | ||
"rules/index.js" | ||
], | ||
"extension": [ | ||
".js" | ||
], | ||
"reporter": [ | ||
"text-summary", | ||
"html", | ||
"lcov" | ||
], | ||
"include": ["rules/*.js"], | ||
"exclude": ["rules/index.js"], | ||
"extension": [".js"], | ||
"reporter": ["json"], | ||
"sourceMap": true, | ||
"all": true | ||
} |
@@ -10,2 +10,8 @@ # Change Log | ||
## [v5.0.1] - 2018-12-15 | ||
### Fixed | ||
* Fixed a regression in the `readonly-array`. See [#104](https://github.com/jonaskello/tslint-immutable/issues/104). | ||
## [v5.0.0] - 2018-11-24 | ||
@@ -12,0 +18,0 @@ |
{ | ||
"name": "tslint-immutable", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "TSLint rules to disable mutation in TypeScript.", | ||
@@ -25,3 +25,3 @@ "main": "tslint-immutable.json", | ||
"@types/node": "^8.0.53", | ||
"coveralls": "^2.13.1", | ||
"codecov": "^3.1.0", | ||
"husky": "^0.14.3", | ||
@@ -46,6 +46,6 @@ "lint-staged": "^5.0.0", | ||
"test": "tslint --test test/rules/**/*", | ||
"test:work": "yarn build && tslint --test test/rules/readonly-array/*", | ||
"test:work": "yarn build && tslint --test test/rules/readonly-array/work", | ||
"verify": "yarn build && yarn lint && yarn coverage", | ||
"coverage": "rimraf coverage .nyc_output && nyc yarn test", | ||
"report-coverage": "cat ./coverage/lcov.info | coveralls", | ||
"report-coverage": "codecov -f coverage/*.json", | ||
"publish:major": "npm run build && node scripts/publish.js major", | ||
@@ -52,0 +52,0 @@ "publish:minor": "npm run build && node scripts/publish.js minor", |
@@ -5,3 +5,3 @@ # tslint-immutable | ||
[![travis build][travis-image]][travis-url] | ||
[![Coverage Status][coveralls-image]][coveralls-url] | ||
[![Coverage Status][codecov-image]][codecov-url] | ||
[![code style: prettier][prettier-image]][prettier-url] | ||
@@ -635,6 +635,6 @@ [![MIT license][license-image]][license-url] | ||
[version-url]: https://www.npmjs.com/package/tslint-immutable | ||
[travis-image]: https://travis-ci.org/jonaskello/tslint-immutable.svg?branch=master&style=flat | ||
[travis-url]: https://travis-ci.org/jonaskello/tslint-immutable | ||
[coveralls-image]: https://coveralls.io/repos/github/jonaskello/tslint-immutable/badge.svg?branch=master | ||
[coveralls-url]: https://coveralls.io/github/jonaskello/tslint-immutable?branch=master | ||
[travis-image]: https://travis-ci.com/jonaskello/tslint-immutable.svg?branch=master&style=flat | ||
[travis-url]: https://travis-ci.com/jonaskello/tslint-immutable | ||
[codecov-image]: https://codecov.io/gh/jonaskello/tslint-immutable/branch/master/graph/badge.svg | ||
[codecov-url]: https://codecov.io/gh/jonaskello/tslint-immutable | ||
[license-image]: https://img.shields.io/github/license/jonaskello/tslint-immutable.svg?style=flat | ||
@@ -644,3 +644,3 @@ [license-url]: https://opensource.org/licenses/MIT | ||
[prettier-url]: https://github.com/prettier/prettier | ||
[type-info-badge]: https://img.shields.io/badge/type_info-requried-d51313.svg?style=flat | ||
[type-info-badge]: https://img.shields.io/badge/type_info-required-d51313.svg?style=flat | ||
[type-info-url]: https://palantir.github.io/tslint/usage/type-checking |
@@ -12,3 +12,3 @@ "use strict"; | ||
return { | ||
invalidNodes: checkArrayType(node, ctx).concat(checkTypeReference(node, ctx), checkVariableLikeImplicitType(node, ctx)) | ||
invalidNodes: checkArrayType(node, ctx).concat(checkTypeReference(node, ctx), checkImplicitType(node, ctx)) | ||
}; | ||
@@ -60,8 +60,8 @@ } | ||
} | ||
function checkVariableLikeImplicitType(node, ctx) { | ||
// The initializer is used to set and implicit type | ||
function checkImplicitType(node, ctx) { | ||
if (Ignore.shouldIgnorePrefix(node, ctx.options, ctx.sourceFile)) { | ||
return []; | ||
} | ||
if (typeguard_1.isVariableLikeDeclaration(node) && | ||
// Check if the initializer is used to set an implicit array type | ||
if (typeguard_1.isVariableOrParameterOrPropertyDeclaration(node) && | ||
isUntypedAndHasArrayLiteralExpressionInitializer(node)) { | ||
@@ -71,16 +71,2 @@ var length_1 = node.name.getWidth(ctx.sourceFile); | ||
var typeArgument = "any"; | ||
// Not sure it is a good idea to guess what the element types are... | ||
// if (node.initializer.elements.length > 0) { | ||
// const element = node.initializer.elements[0]; | ||
// if (utils.isNumericLiteral(element)) { | ||
// typeArgument = "number"; | ||
// } else if (utils.isStringLiteral(element)) { | ||
// typeArgument = "string"; | ||
// } else if ( | ||
// element.kind === ts.SyntaxKind.TrueKeyword || | ||
// element.kind === ts.SyntaxKind.FalseKeyword | ||
// ) { | ||
// typeArgument = "boolean"; | ||
// } | ||
// } | ||
return [ | ||
@@ -94,2 +80,3 @@ check_node_1.createInvalidNode(node.name, [ | ||
} | ||
exports.checkImplicitType = checkImplicitType; | ||
function checkIsReturnType(node) { | ||
@@ -101,8 +88,5 @@ return Boolean(node.parent && | ||
function isUntypedAndHasArrayLiteralExpressionInitializer(node) { | ||
// tslint:disable:no-any | ||
return Boolean(!node.type && | ||
node.initializer && | ||
utils.isArrayLiteralExpression(node.initializer)); | ||
// tslint:enable:no-any | ||
(node.initializer && utils.isArrayLiteralExpression(node.initializer))); | ||
} | ||
//# sourceMappingURL=readonlyArrayRule.js.map |
@@ -33,2 +33,8 @@ "use strict"; | ||
exports.isVariableLikeDeclaration = isVariableLikeDeclaration; | ||
function isVariableOrParameterOrPropertyDeclaration(node) { | ||
return (utils.isVariableDeclaration(node) || | ||
utils.isParameterDeclaration(node) || | ||
utils.isPropertyDeclaration(node)); | ||
} | ||
exports.isVariableOrParameterOrPropertyDeclaration = isVariableOrParameterOrPropertyDeclaration; | ||
//# sourceMappingURL=typeguard.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
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
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
284222
53
1222