tslint-immutable
Advanced tools
Comparing version 5.0.1 to 5.1.0
@@ -10,2 +10,8 @@ # Change Log | ||
## [v5.1.0] - 2019-01-15 | ||
### Added | ||
* New option `ignore-new-array` for the `readonly-array` rule. This option replaces the `ignore-mutation-following-accessor` option, however the old option name will remain as an alias and will be removed in the next major release. See [#102](https://github.com/jonaskello/tslint-immutable/issues/102). Thanks to [@RebeccaStevens](https://github.com/RebeccaStevens) for adding this option! (See PR [#110](https://github.com/jonaskello/tslint-immutable/pull/110)) | ||
## [v5.0.1] - 2018-12-15 | ||
@@ -304,3 +310,5 @@ | ||
[unreleased]: https://github.com/jonaskello/tslint-immutable/compare/v5.0.0...master | ||
[unreleased]: https://github.com/jonaskello/tslint-immutable/compare/v5.1.0...master | ||
[v5.1.0]: https://github.com/jonaskello/tslint-immutable/compare/v5.0.1...v5.1.0 | ||
[v5.0.1]: https://github.com/jonaskello/tslint-immutable/compare/v5.0.0...v5.0.1 | ||
[v5.0.0]: https://github.com/jonaskello/tslint-immutable/compare/v4.9.1...v5.0.0 | ||
@@ -307,0 +315,0 @@ [v4.9.1]: https://github.com/jonaskello/tslint-immutable/compare/v4.9.0...v4.9.1 |
@@ -1,2 +0,2 @@ | ||
{"/Users/JonKel/code/github/jonaskello/tslint-immutable/rules/noArrayMutationRule.js": {"path":"/Users/JonKel/code/github/jonaskello/tslint-immutable/rules/noArrayMutationRule.js","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"1":{"start":{"line":3,"column":9},"end":{"line":3,"column":30}},"2":{"start":{"line":4,"column":12},"end":{"line":4,"column":44}},"3":{"start":{"line":5,"column":13},"end":{"line":5,"column":36}},"4":{"start":{"line":6,"column":19},"end":{"line":6,"column":49}},"5":{"start":{"line":7,"column":13},"end":{"line":7,"column":39}},"6":{"start":{"line":8,"column":18},"end":{"line":8,"column":47}},"7":{"start":{"line":10,"column":0},"end":{"line":10,"column":106}},"8":{"start":{"line":12,"column":4},"end":{"line":12,"column":64}},"9":{"start":{"line":14,"column":0},"end":{"line":14,"column":34}},"10":{"start":{"line":15,"column":21},"end":{"line":18,"column":1}},"11":{"start":{"line":24,"column":21},"end":{"line":34,"column":1}},"12":{"start":{"line":40,"column":22},"end":{"line":40,"column":41}},"13":{"start":{"line":42,"column":4},"end":{"line":42,"column":65}},"14":{"start":{"line":45,"column":4},"end":{"line":47,"column":5}},"15":{"start":{"line":46,"column":8},"end":{"line":46,"column":57}},"16":{"start":{"line":48,"column":4},"end":{"line":50,"column":5}},"17":{"start":{"line":49,"column":8},"end":{"line":49,"column":57}},"18":{"start":{"line":51,"column":4},"end":{"line":53,"column":5}},"19":{"start":{"line":52,"column":8},"end":{"line":52,"column":62}},"20":{"start":{"line":54,"column":4},"end":{"line":56,"column":5}},"21":{"start":{"line":55,"column":8},"end":{"line":55,"column":63}},"22":{"start":{"line":57,"column":4},"end":{"line":59,"column":5}},"23":{"start":{"line":58,"column":8},"end":{"line":58,"column":55}},"24":{"start":{"line":60,"column":4},"end":{"line":60,"column":14}},"25":{"start":{"line":67,"column":4},"end":{"line":75,"column":5}},"26":{"start":{"line":71,"column":33},"end":{"line":71,"column":80}},"27":{"start":{"line":72,"column":8},"end":{"line":74,"column":9}},"28":{"start":{"line":73,"column":12},"end":{"line":73,"column":62}},"29":{"start":{"line":76,"column":4},"end":{"line":76,"column":14}},"30":{"start":{"line":82,"column":4},"end":{"line":88,"column":5}},"31":{"start":{"line":84,"column":29},"end":{"line":84,"column":82}},"32":{"start":{"line":85,"column":8},"end":{"line":87,"column":9}},"33":{"start":{"line":86,"column":12},"end":{"line":86,"column":62}},"34":{"start":{"line":89,"column":4},"end":{"line":89,"column":14}},"35":{"start":{"line":95,"column":4},"end":{"line":102,"column":5}},"36":{"start":{"line":97,"column":43},"end":{"line":97,"column":70}},"37":{"start":{"line":98,"column":36},"end":{"line":98,"column":86}},"38":{"start":{"line":99,"column":8},"end":{"line":101,"column":9}},"39":{"start":{"line":100,"column":12},"end":{"line":100,"column":62}},"40":{"start":{"line":103,"column":4},"end":{"line":103,"column":14}},"41":{"start":{"line":109,"column":4},"end":{"line":116,"column":5}},"42":{"start":{"line":111,"column":43},"end":{"line":111,"column":70}},"43":{"start":{"line":112,"column":36},"end":{"line":112,"column":86}},"44":{"start":{"line":113,"column":8},"end":{"line":115,"column":9}},"45":{"start":{"line":114,"column":12},"end":{"line":114,"column":62}},"46":{"start":{"line":117,"column":4},"end":{"line":117,"column":14}},"47":{"start":{"line":123,"column":4},"end":{"line":133,"column":5}},"48":{"start":{"line":127,"column":43},"end":{"line":127,"column":82}},"49":{"start":{"line":129,"column":29},"end":{"line":129,"column":82}},"50":{"start":{"line":130,"column":8},"end":{"line":132,"column":9}},"51":{"start":{"line":131,"column":12},"end":{"line":131,"column":62}},"52":{"start":{"line":134,"column":4},"end":{"line":134,"column":14}},"53":{"start":{"line":143,"column":4},"end":{"line":149,"column":12}},"54":{"start":{"line":146,"column":12},"end":{"line":148,"column":42}}},"fnMap":{"0":{"name":"isArrayType","decl":{"start":{"line":11,"column":9},"end":{"line":11,"column":20}},"loc":{"start":{"line":11,"column":27},"end":{"line":13,"column":1}},"line":11},"1":{"name":"checkTypedNode","decl":{"start":{"line":41,"column":9},"end":{"line":41,"column":23}},"loc":{"start":{"line":41,"column":44},"end":{"line":43,"column":1}},"line":41},"2":{"name":"getInvalidNodes","decl":{"start":{"line":44,"column":9},"end":{"line":44,"column":24}},"loc":{"start":{"line":44,"column":45},"end":{"line":61,"column":1}},"line":44},"3":{"name":"checkBinaryExpression","decl":{"start":{"line":66,"column":9},"end":{"line":66,"column":30}},"loc":{"start":{"line":66,"column":51},"end":{"line":77,"column":1}},"line":66},"4":{"name":"checkDeleteExpression","decl":{"start":{"line":81,"column":9},"end":{"line":81,"column":30}},"loc":{"start":{"line":81,"column":51},"end":{"line":90,"column":1}},"line":81},"5":{"name":"checkPrefixUnaryExpression","decl":{"start":{"line":94,"column":9},"end":{"line":94,"column":35}},"loc":{"start":{"line":94,"column":56},"end":{"line":104,"column":1}},"line":94},"6":{"name":"(anonymous_6)","decl":{"start":{"line":97,"column":28},"end":{"line":97,"column":29}},"loc":{"start":{"line":97,"column":41},"end":{"line":97,"column":72}},"line":97},"7":{"name":"checkPostfixUnaryExpression","decl":{"start":{"line":108,"column":9},"end":{"line":108,"column":36}},"loc":{"start":{"line":108,"column":57},"end":{"line":118,"column":1}},"line":108},"8":{"name":"(anonymous_8)","decl":{"start":{"line":111,"column":28},"end":{"line":111,"column":29}},"loc":{"start":{"line":111,"column":41},"end":{"line":111,"column":72}},"line":111},"9":{"name":"checkCallExpression","decl":{"start":{"line":122,"column":9},"end":{"line":122,"column":28}},"loc":{"start":{"line":122,"column":49},"end":{"line":135,"column":1}},"line":122},"10":{"name":"(anonymous_10)","decl":{"start":{"line":127,"column":28},"end":{"line":127,"column":29}},"loc":{"start":{"line":127,"column":41},"end":{"line":127,"column":84}},"line":127},"11":{"name":"isInChainCallAndFollowsAccessor","decl":{"start":{"line":142,"column":9},"end":{"line":142,"column":40}},"loc":{"start":{"line":142,"column":47},"end":{"line":150,"column":1}},"line":142},"12":{"name":"(anonymous_12)","decl":{"start":{"line":145,"column":29},"end":{"line":145,"column":30}},"loc":{"start":{"line":145,"column":42},"end":{"line":149,"column":9}},"line":145}},"branchMap":{"0":{"loc":{"start":{"line":12,"column":19},"end":{"line":12,"column":62}},"type":"binary-expr","locations":[{"start":{"line":12,"column":19},"end":{"line":12,"column":30}},{"start":{"line":12,"column":34},"end":{"line":12,"column":62}}],"line":12},"1":{"loc":{"start":{"line":45,"column":4},"end":{"line":47,"column":5}},"type":"if","locations":[{"start":{"line":45,"column":4},"end":{"line":47,"column":5}},{"start":{"line":45,"column":4},"end":{"line":47,"column":5}}],"line":45},"2":{"loc":{"start":{"line":48,"column":4},"end":{"line":50,"column":5}},"type":"if","locations":[{"start":{"line":48,"column":4},"end":{"line":50,"column":5}},{"start":{"line":48,"column":4},"end":{"line":50,"column":5}}],"line":48},"3":{"loc":{"start":{"line":51,"column":4},"end":{"line":53,"column":5}},"type":"if","locations":[{"start":{"line":51,"column":4},"end":{"line":53,"column":5}},{"start":{"line":51,"column":4},"end":{"line":53,"column":5}}],"line":51},"4":{"loc":{"start":{"line":54,"column":4},"end":{"line":56,"column":5}},"type":"if","locations":[{"start":{"line":54,"column":4},"end":{"line":56,"column":5}},{"start":{"line":54,"column":4},"end":{"line":56,"column":5}}],"line":54},"5":{"loc":{"start":{"line":57,"column":4},"end":{"line":59,"column":5}},"type":"if","locations":[{"start":{"line":57,"column":4},"end":{"line":59,"column":5}},{"start":{"line":57,"column":4},"end":{"line":59,"column":5}}],"line":57},"6":{"loc":{"start":{"line":67,"column":4},"end":{"line":75,"column":5}},"type":"if","locations":[{"start":{"line":67,"column":4},"end":{"line":75,"column":5}},{"start":{"line":67,"column":4},"end":{"line":75,"column":5}}],"line":67},"7":{"loc":{"start":{"line":67,"column":8},"end":{"line":70,"column":49}},"type":"binary-expr","locations":[{"start":{"line":67,"column":8},"end":{"line":67,"column":93}},{"start":{"line":68,"column":8},"end":{"line":68,"column":38}},{"start":{"line":69,"column":8},"end":{"line":69,"column":56}},{"start":{"line":70,"column":8},"end":{"line":70,"column":49}}],"line":67},"8":{"loc":{"start":{"line":72,"column":8},"end":{"line":74,"column":9}},"type":"if","locations":[{"start":{"line":72,"column":8},"end":{"line":74,"column":9}},{"start":{"line":72,"column":8},"end":{"line":74,"column":9}}],"line":72},"9":{"loc":{"start":{"line":82,"column":4},"end":{"line":88,"column":5}},"type":"if","locations":[{"start":{"line":82,"column":4},"end":{"line":88,"column":5}},{"start":{"line":82,"column":4},"end":{"line":88,"column":5}}],"line":82},"10":{"loc":{"start":{"line":82,"column":8},"end":{"line":83,"column":55}},"type":"binary-expr","locations":[{"start":{"line":82,"column":8},"end":{"line":82,"column":104}},{"start":{"line":83,"column":8},"end":{"line":83,"column":55}}],"line":82},"11":{"loc":{"start":{"line":85,"column":8},"end":{"line":87,"column":9}},"type":"if","locations":[{"start":{"line":85,"column":8},"end":{"line":87,"column":9}},{"start":{"line":85,"column":8},"end":{"line":87,"column":9}}],"line":85},"12":{"loc":{"start":{"line":95,"column":4},"end":{"line":102,"column":5}},"type":"if","locations":[{"start":{"line":95,"column":4},"end":{"line":102,"column":5}},{"start":{"line":95,"column":4},"end":{"line":102,"column":5}}],"line":95},"13":{"loc":{"start":{"line":95,"column":8},"end":{"line":97,"column":73}},"type":"binary-expr","locations":[{"start":{"line":95,"column":8},"end":{"line":95,"column":101}},{"start":{"line":96,"column":8},"end":{"line":96,"column":52}},{"start":{"line":97,"column":8},"end":{"line":97,"column":73}}],"line":95},"14":{"loc":{"start":{"line":99,"column":8},"end":{"line":101,"column":9}},"type":"if","locations":[{"start":{"line":99,"column":8},"end":{"line":101,"column":9}},{"start":{"line":99,"column":8},"end":{"line":101,"column":9}}],"line":99},"15":{"loc":{"start":{"line":109,"column":4},"end":{"line":116,"column":5}},"type":"if","locations":[{"start":{"line":109,"column":4},"end":{"line":116,"column":5}},{"start":{"line":109,"column":4},"end":{"line":116,"column":5}}],"line":109},"16":{"loc":{"start":{"line":109,"column":8},"end":{"line":111,"column":73}},"type":"binary-expr","locations":[{"start":{"line":109,"column":8},"end":{"line":109,"column":93}},{"start":{"line":110,"column":8},"end":{"line":110,"column":52}},{"start":{"line":111,"column":8},"end":{"line":111,"column":73}}],"line":109},"17":{"loc":{"start":{"line":113,"column":8},"end":{"line":115,"column":9}},"type":"if","locations":[{"start":{"line":113,"column":8},"end":{"line":115,"column":9}},{"start":{"line":113,"column":8},"end":{"line":115,"column":9}}],"line":113},"18":{"loc":{"start":{"line":123,"column":4},"end":{"line":133,"column":5}},"type":"if","locations":[{"start":{"line":123,"column":4},"end":{"line":133,"column":5}},{"start":{"line":123,"column":4},"end":{"line":133,"column":5}}],"line":123},"19":{"loc":{"start":{"line":123,"column":8},"end":{"line":127,"column":85}},"type":"binary-expr","locations":[{"start":{"line":123,"column":8},"end":{"line":123,"column":93}},{"start":{"line":124,"column":8},"end":{"line":124,"column":57}},{"start":{"line":125,"column":9},"end":{"line":125,"column":53}},{"start":{"line":126,"column":12},"end":{"line":126,"column":61}},{"start":{"line":127,"column":8},"end":{"line":127,"column":85}}],"line":123},"20":{"loc":{"start":{"line":130,"column":8},"end":{"line":132,"column":9}},"type":"if","locations":[{"start":{"line":130,"column":8},"end":{"line":132,"column":9}},{"start":{"line":130,"column":8},"end":{"line":132,"column":9}}],"line":130},"21":{"loc":{"start":{"line":143,"column":12},"end":{"line":149,"column":10}},"type":"binary-expr","locations":[{"start":{"line":143,"column":12},"end":{"line":143,"column":51}},{"start":{"line":144,"column":8},"end":{"line":144,"column":68}},{"start":{"line":145,"column":8},"end":{"line":149,"column":10}}],"line":143}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0},"f":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0},"b":{"0":[0,0],"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0,0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0,0],"14":[0,0],"15":[0,0],"16":[0,0,0],"17":[0,0],"18":[0,0],"19":[0,0,0,0,0],"20":[0,0],"21":[0,0,0]}} | ||
{"/Users/JonKel/code/github/jonaskello/tslint-immutable/rules/noArrayMutationRule.js": {"path":"/Users/JonKel/code/github/jonaskello/tslint-immutable/rules/noArrayMutationRule.js","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"1":{"start":{"line":3,"column":9},"end":{"line":3,"column":30}},"2":{"start":{"line":4,"column":12},"end":{"line":4,"column":44}},"3":{"start":{"line":5,"column":13},"end":{"line":5,"column":36}},"4":{"start":{"line":6,"column":19},"end":{"line":6,"column":49}},"5":{"start":{"line":7,"column":13},"end":{"line":7,"column":39}},"6":{"start":{"line":8,"column":18},"end":{"line":8,"column":47}},"7":{"start":{"line":10,"column":0},"end":{"line":10,"column":106}},"8":{"start":{"line":12,"column":4},"end":{"line":12,"column":64}},"9":{"start":{"line":14,"column":0},"end":{"line":14,"column":34}},"10":{"start":{"line":16,"column":4},"end":{"line":16,"column":75}},"11":{"start":{"line":18,"column":0},"end":{"line":18,"column":56}},"12":{"start":{"line":19,"column":21},"end":{"line":22,"column":1}},"13":{"start":{"line":28,"column":21},"end":{"line":38,"column":1}},"14":{"start":{"line":45,"column":31},"end":{"line":52,"column":1}},"15":{"start":{"line":58,"column":27},"end":{"line":58,"column":41}},"16":{"start":{"line":60,"column":4},"end":{"line":60,"column":65}},"17":{"start":{"line":63,"column":4},"end":{"line":65,"column":5}},"18":{"start":{"line":64,"column":8},"end":{"line":64,"column":57}},"19":{"start":{"line":66,"column":4},"end":{"line":68,"column":5}},"20":{"start":{"line":67,"column":8},"end":{"line":67,"column":57}},"21":{"start":{"line":69,"column":4},"end":{"line":71,"column":5}},"22":{"start":{"line":70,"column":8},"end":{"line":70,"column":62}},"23":{"start":{"line":72,"column":4},"end":{"line":74,"column":5}},"24":{"start":{"line":73,"column":8},"end":{"line":73,"column":63}},"25":{"start":{"line":75,"column":4},"end":{"line":77,"column":5}},"26":{"start":{"line":76,"column":8},"end":{"line":76,"column":55}},"27":{"start":{"line":78,"column":4},"end":{"line":78,"column":14}},"28":{"start":{"line":85,"column":4},"end":{"line":93,"column":5}},"29":{"start":{"line":89,"column":33},"end":{"line":89,"column":80}},"30":{"start":{"line":90,"column":8},"end":{"line":92,"column":9}},"31":{"start":{"line":91,"column":12},"end":{"line":91,"column":62}},"32":{"start":{"line":94,"column":4},"end":{"line":94,"column":14}},"33":{"start":{"line":100,"column":4},"end":{"line":106,"column":5}},"34":{"start":{"line":102,"column":29},"end":{"line":102,"column":82}},"35":{"start":{"line":103,"column":8},"end":{"line":105,"column":9}},"36":{"start":{"line":104,"column":12},"end":{"line":104,"column":62}},"37":{"start":{"line":107,"column":4},"end":{"line":107,"column":14}},"38":{"start":{"line":113,"column":4},"end":{"line":120,"column":5}},"39":{"start":{"line":115,"column":43},"end":{"line":115,"column":70}},"40":{"start":{"line":116,"column":36},"end":{"line":116,"column":86}},"41":{"start":{"line":117,"column":8},"end":{"line":119,"column":9}},"42":{"start":{"line":118,"column":12},"end":{"line":118,"column":62}},"43":{"start":{"line":121,"column":4},"end":{"line":121,"column":14}},"44":{"start":{"line":127,"column":4},"end":{"line":134,"column":5}},"45":{"start":{"line":129,"column":43},"end":{"line":129,"column":70}},"46":{"start":{"line":130,"column":36},"end":{"line":130,"column":86}},"47":{"start":{"line":131,"column":8},"end":{"line":133,"column":9}},"48":{"start":{"line":132,"column":12},"end":{"line":132,"column":62}},"49":{"start":{"line":135,"column":4},"end":{"line":135,"column":14}},"50":{"start":{"line":141,"column":4},"end":{"line":151,"column":5}},"51":{"start":{"line":145,"column":43},"end":{"line":145,"column":82}},"52":{"start":{"line":147,"column":29},"end":{"line":147,"column":82}},"53":{"start":{"line":148,"column":8},"end":{"line":150,"column":9}},"54":{"start":{"line":149,"column":12},"end":{"line":149,"column":62}},"55":{"start":{"line":152,"column":4},"end":{"line":152,"column":14}},"56":{"start":{"line":161,"column":4},"end":{"line":170,"column":94}},"57":{"start":{"line":176,"column":4},"end":{"line":176,"column":61}},"58":{"start":{"line":176,"column":31},"end":{"line":176,"column":58}}},"fnMap":{"0":{"name":"isArrayType","decl":{"start":{"line":11,"column":9},"end":{"line":11,"column":20}},"loc":{"start":{"line":11,"column":27},"end":{"line":13,"column":1}},"line":11},"1":{"name":"isArrayConstructorType","decl":{"start":{"line":15,"column":9},"end":{"line":15,"column":31}},"loc":{"start":{"line":15,"column":38},"end":{"line":17,"column":1}},"line":15},"2":{"name":"checkTypedNode","decl":{"start":{"line":59,"column":9},"end":{"line":59,"column":23}},"loc":{"start":{"line":59,"column":44},"end":{"line":61,"column":1}},"line":59},"3":{"name":"getInvalidNodes","decl":{"start":{"line":62,"column":9},"end":{"line":62,"column":24}},"loc":{"start":{"line":62,"column":45},"end":{"line":79,"column":1}},"line":62},"4":{"name":"checkBinaryExpression","decl":{"start":{"line":84,"column":9},"end":{"line":84,"column":30}},"loc":{"start":{"line":84,"column":51},"end":{"line":95,"column":1}},"line":84},"5":{"name":"checkDeleteExpression","decl":{"start":{"line":99,"column":9},"end":{"line":99,"column":30}},"loc":{"start":{"line":99,"column":51},"end":{"line":108,"column":1}},"line":99},"6":{"name":"checkPrefixUnaryExpression","decl":{"start":{"line":112,"column":9},"end":{"line":112,"column":35}},"loc":{"start":{"line":112,"column":56},"end":{"line":122,"column":1}},"line":112},"7":{"name":"(anonymous_7)","decl":{"start":{"line":115,"column":28},"end":{"line":115,"column":29}},"loc":{"start":{"line":115,"column":41},"end":{"line":115,"column":72}},"line":115},"8":{"name":"checkPostfixUnaryExpression","decl":{"start":{"line":126,"column":9},"end":{"line":126,"column":36}},"loc":{"start":{"line":126,"column":57},"end":{"line":136,"column":1}},"line":126},"9":{"name":"(anonymous_9)","decl":{"start":{"line":129,"column":28},"end":{"line":129,"column":29}},"loc":{"start":{"line":129,"column":41},"end":{"line":129,"column":72}},"line":129},"10":{"name":"checkCallExpression","decl":{"start":{"line":140,"column":9},"end":{"line":140,"column":28}},"loc":{"start":{"line":140,"column":49},"end":{"line":153,"column":1}},"line":140},"11":{"name":"(anonymous_11)","decl":{"start":{"line":145,"column":28},"end":{"line":145,"column":29}},"loc":{"start":{"line":145,"column":41},"end":{"line":145,"column":84}},"line":145},"12":{"name":"isInChainCallAndFollowsNew","decl":{"start":{"line":160,"column":9},"end":{"line":160,"column":35}},"loc":{"start":{"line":160,"column":51},"end":{"line":171,"column":1}},"line":160},"13":{"name":"isExpected","decl":{"start":{"line":175,"column":9},"end":{"line":175,"column":19}},"loc":{"start":{"line":175,"column":30},"end":{"line":177,"column":1}},"line":175},"14":{"name":"(anonymous_14)","decl":{"start":{"line":176,"column":11},"end":{"line":176,"column":12}},"loc":{"start":{"line":176,"column":29},"end":{"line":176,"column":60}},"line":176}},"branchMap":{"0":{"loc":{"start":{"line":12,"column":19},"end":{"line":12,"column":62}},"type":"binary-expr","locations":[{"start":{"line":12,"column":19},"end":{"line":12,"column":30}},{"start":{"line":12,"column":34},"end":{"line":12,"column":62}}],"line":12},"1":{"loc":{"start":{"line":16,"column":19},"end":{"line":16,"column":73}},"type":"binary-expr","locations":[{"start":{"line":16,"column":19},"end":{"line":16,"column":30}},{"start":{"line":16,"column":34},"end":{"line":16,"column":73}}],"line":16},"2":{"loc":{"start":{"line":63,"column":4},"end":{"line":65,"column":5}},"type":"if","locations":[{"start":{"line":63,"column":4},"end":{"line":65,"column":5}},{"start":{"line":63,"column":4},"end":{"line":65,"column":5}}],"line":63},"3":{"loc":{"start":{"line":66,"column":4},"end":{"line":68,"column":5}},"type":"if","locations":[{"start":{"line":66,"column":4},"end":{"line":68,"column":5}},{"start":{"line":66,"column":4},"end":{"line":68,"column":5}}],"line":66},"4":{"loc":{"start":{"line":69,"column":4},"end":{"line":71,"column":5}},"type":"if","locations":[{"start":{"line":69,"column":4},"end":{"line":71,"column":5}},{"start":{"line":69,"column":4},"end":{"line":71,"column":5}}],"line":69},"5":{"loc":{"start":{"line":72,"column":4},"end":{"line":74,"column":5}},"type":"if","locations":[{"start":{"line":72,"column":4},"end":{"line":74,"column":5}},{"start":{"line":72,"column":4},"end":{"line":74,"column":5}}],"line":72},"6":{"loc":{"start":{"line":75,"column":4},"end":{"line":77,"column":5}},"type":"if","locations":[{"start":{"line":75,"column":4},"end":{"line":77,"column":5}},{"start":{"line":75,"column":4},"end":{"line":77,"column":5}}],"line":75},"7":{"loc":{"start":{"line":85,"column":4},"end":{"line":93,"column":5}},"type":"if","locations":[{"start":{"line":85,"column":4},"end":{"line":93,"column":5}},{"start":{"line":85,"column":4},"end":{"line":93,"column":5}}],"line":85},"8":{"loc":{"start":{"line":85,"column":8},"end":{"line":88,"column":49}},"type":"binary-expr","locations":[{"start":{"line":85,"column":8},"end":{"line":85,"column":93}},{"start":{"line":86,"column":8},"end":{"line":86,"column":38}},{"start":{"line":87,"column":8},"end":{"line":87,"column":56}},{"start":{"line":88,"column":8},"end":{"line":88,"column":49}}],"line":85},"9":{"loc":{"start":{"line":90,"column":8},"end":{"line":92,"column":9}},"type":"if","locations":[{"start":{"line":90,"column":8},"end":{"line":92,"column":9}},{"start":{"line":90,"column":8},"end":{"line":92,"column":9}}],"line":90},"10":{"loc":{"start":{"line":100,"column":4},"end":{"line":106,"column":5}},"type":"if","locations":[{"start":{"line":100,"column":4},"end":{"line":106,"column":5}},{"start":{"line":100,"column":4},"end":{"line":106,"column":5}}],"line":100},"11":{"loc":{"start":{"line":100,"column":8},"end":{"line":101,"column":55}},"type":"binary-expr","locations":[{"start":{"line":100,"column":8},"end":{"line":100,"column":104}},{"start":{"line":101,"column":8},"end":{"line":101,"column":55}}],"line":100},"12":{"loc":{"start":{"line":103,"column":8},"end":{"line":105,"column":9}},"type":"if","locations":[{"start":{"line":103,"column":8},"end":{"line":105,"column":9}},{"start":{"line":103,"column":8},"end":{"line":105,"column":9}}],"line":103},"13":{"loc":{"start":{"line":113,"column":4},"end":{"line":120,"column":5}},"type":"if","locations":[{"start":{"line":113,"column":4},"end":{"line":120,"column":5}},{"start":{"line":113,"column":4},"end":{"line":120,"column":5}}],"line":113},"14":{"loc":{"start":{"line":113,"column":8},"end":{"line":115,"column":73}},"type":"binary-expr","locations":[{"start":{"line":113,"column":8},"end":{"line":113,"column":101}},{"start":{"line":114,"column":8},"end":{"line":114,"column":52}},{"start":{"line":115,"column":8},"end":{"line":115,"column":73}}],"line":113},"15":{"loc":{"start":{"line":117,"column":8},"end":{"line":119,"column":9}},"type":"if","locations":[{"start":{"line":117,"column":8},"end":{"line":119,"column":9}},{"start":{"line":117,"column":8},"end":{"line":119,"column":9}}],"line":117},"16":{"loc":{"start":{"line":127,"column":4},"end":{"line":134,"column":5}},"type":"if","locations":[{"start":{"line":127,"column":4},"end":{"line":134,"column":5}},{"start":{"line":127,"column":4},"end":{"line":134,"column":5}}],"line":127},"17":{"loc":{"start":{"line":127,"column":8},"end":{"line":129,"column":73}},"type":"binary-expr","locations":[{"start":{"line":127,"column":8},"end":{"line":127,"column":93}},{"start":{"line":128,"column":8},"end":{"line":128,"column":52}},{"start":{"line":129,"column":8},"end":{"line":129,"column":73}}],"line":127},"18":{"loc":{"start":{"line":131,"column":8},"end":{"line":133,"column":9}},"type":"if","locations":[{"start":{"line":131,"column":8},"end":{"line":133,"column":9}},{"start":{"line":131,"column":8},"end":{"line":133,"column":9}}],"line":131},"19":{"loc":{"start":{"line":141,"column":4},"end":{"line":151,"column":5}},"type":"if","locations":[{"start":{"line":141,"column":4},"end":{"line":151,"column":5}},{"start":{"line":141,"column":4},"end":{"line":151,"column":5}}],"line":141},"20":{"loc":{"start":{"line":141,"column":8},"end":{"line":145,"column":85}},"type":"binary-expr","locations":[{"start":{"line":141,"column":8},"end":{"line":141,"column":93}},{"start":{"line":142,"column":8},"end":{"line":142,"column":57}},{"start":{"line":143,"column":9},"end":{"line":143,"column":85}},{"start":{"line":144,"column":12},"end":{"line":144,"column":65}},{"start":{"line":145,"column":8},"end":{"line":145,"column":85}}],"line":141},"21":{"loc":{"start":{"line":143,"column":11},"end":{"line":143,"column":84}},"type":"binary-expr","locations":[{"start":{"line":143,"column":11},"end":{"line":143,"column":37}},{"start":{"line":143,"column":41},"end":{"line":143,"column":84}}],"line":143},"22":{"loc":{"start":{"line":148,"column":8},"end":{"line":150,"column":9}},"type":"if","locations":[{"start":{"line":148,"column":8},"end":{"line":150,"column":9}},{"start":{"line":148,"column":8},"end":{"line":150,"column":9}}],"line":148},"23":{"loc":{"start":{"line":161,"column":12},"end":{"line":170,"column":92}},"type":"binary-expr","locations":[{"start":{"line":161,"column":12},"end":{"line":161,"column":59}},{"start":{"line":162,"column":9},"end":{"line":162,"column":47}},{"start":{"line":163,"column":12},"end":{"line":163,"column":89}},{"start":{"line":164,"column":9},"end":{"line":164,"column":48}},{"start":{"line":165,"column":12},"end":{"line":165,"column":72}},{"start":{"line":166,"column":12},"end":{"line":166,"column":87}},{"start":{"line":167,"column":12},"end":{"line":167,"column":100}},{"start":{"line":168,"column":9},"end":{"line":168,"column":48}},{"start":{"line":169,"column":12},"end":{"line":169,"column":72}},{"start":{"line":170,"column":12},"end":{"line":170,"column":91}}],"line":161}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0},"f":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0},"b":{"0":[0,0],"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0,0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0,0],"15":[0,0],"16":[0,0],"17":[0,0,0],"18":[0,0],"19":[0,0],"20":[0,0,0,0,0],"21":[0,0],"22":[0,0],"23":[0,0,0,0,0,0,0,0,0,0]}} | ||
,"/Users/JonKel/code/github/jonaskello/tslint-immutable/rules/noClassRule.js": {"path":"/Users/JonKel/code/github/jonaskello/tslint-immutable/rules/noClassRule.js","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"1":{"start":{"line":3,"column":12},"end":{"line":3,"column":44}},"2":{"start":{"line":4,"column":19},"end":{"line":4,"column":49}},"3":{"start":{"line":6,"column":0},"end":{"line":6,"column":107}},"4":{"start":{"line":8,"column":4},"end":{"line":10,"column":31}}},"fnMap":{"0":{"name":"checkNode","decl":{"start":{"line":7,"column":9},"end":{"line":7,"column":18}},"loc":{"start":{"line":7,"column":31},"end":{"line":11,"column":1}},"line":7}},"branchMap":{"0":{"loc":{"start":{"line":8,"column":11},"end":{"line":10,"column":30}},"type":"cond-expr","locations":[{"start":{"line":9,"column":10},"end":{"line":9,"column":70}},{"start":{"line":10,"column":10},"end":{"line":10,"column":30}}],"line":8}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0},"f":{"0":0},"b":{"0":[0,0]}} | ||
@@ -3,0 +3,0 @@ ,"/Users/JonKel/code/github/jonaskello/tslint-immutable/rules/noDeleteRule.js": {"path":"/Users/JonKel/code/github/jonaskello/tslint-immutable/rules/noDeleteRule.js","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"1":{"start":{"line":3,"column":12},"end":{"line":3,"column":44}},"2":{"start":{"line":4,"column":19},"end":{"line":4,"column":49}},"3":{"start":{"line":6,"column":0},"end":{"line":6,"column":121}},"4":{"start":{"line":8,"column":4},"end":{"line":10,"column":31}}},"fnMap":{"0":{"name":"checkNode","decl":{"start":{"line":7,"column":9},"end":{"line":7,"column":18}},"loc":{"start":{"line":7,"column":31},"end":{"line":11,"column":1}},"line":7}},"branchMap":{"0":{"loc":{"start":{"line":8,"column":11},"end":{"line":10,"column":30}},"type":"cond-expr","locations":[{"start":{"line":9,"column":10},"end":{"line":9,"column":70}},{"start":{"line":10,"column":10},"end":{"line":10,"column":30}}],"line":8}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0},"f":{"0":0},"b":{"0":[0,0]}} |
{ | ||
"name": "tslint-immutable", | ||
"version": "5.0.1", | ||
"version": "5.1.0", | ||
"description": "TSLint rules to disable mutation in TypeScript.", | ||
@@ -5,0 +5,0 @@ "main": "tslint-immutable.json", |
@@ -254,3 +254,4 @@ # tslint-immutable | ||
* [ignore-prefix](#using-the-ignore-prefix-option) | ||
* [ignore-mutation-following-accessor](#using-the-ignore-mutation-following-accessor-option-with-no-array-mutation) | ||
* [ignore-new-array](#using-the-ignore-new-array-option-with-no-array-mutation) | ||
* ~~ignore-mutation-following-accessor~~ - *deprecated in favor of [ignore-new-array](#using-the-ignore-new-array-option-with-no-array-mutation)* | ||
@@ -268,3 +269,3 @@ #### Example config | ||
```javascript | ||
"no-array-mutation": [true, "ignore-mutation-following-accessor"] | ||
"no-array-mutation": [true, "ignore-new-array"] | ||
``` | ||
@@ -537,10 +538,11 @@ | ||
### Using the `ignore-mutation-following-accessor` option with `no-array-mutation` | ||
### Using the `ignore-new-array` option with `no-array-mutation` | ||
This option allows for the use of array mutator methods to be chained to an array accessor method (methods that modify the original array are known as [mutator methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype#Mutator_methods) (eg. `sort`) and methods that return a copy are known as [accessor methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype#Accessor_methods) (eg. `slice` and `concat`)). | ||
This option allows for the use of array mutator methods to be chained to newly created arrays. | ||
For example, an array can be immutably sorted with a single line like so: | ||
For example, an array can be immutably sorted like so: | ||
```typescript | ||
const sorted = ["foo", "bar"].slice().sort((a, b) => a.localeCompare(b)); // This is OK with ignore-mutation-following-accessor | ||
const original = ["foo", "bar", "baz"]; | ||
const sorted = original.slice().sort((a, b) => a.localeCompare(b)); // This is OK with ignore-new-array - note the use of the `slice` method which returns a copy of the original array. | ||
``` | ||
@@ -547,0 +549,0 @@ |
@@ -15,2 +15,6 @@ "use strict"; | ||
exports.isArrayType = isArrayType; | ||
function isArrayConstructorType(type) { | ||
return Boolean(type.symbol && type.symbol.name === "ArrayConstructor"); | ||
} | ||
exports.isArrayConstructorType = isArrayConstructorType; | ||
var forbidUnaryOps = [ | ||
@@ -40,4 +44,18 @@ ts.SyntaxKind.PlusPlusToken, | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype#Methods#Accessor_methods | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype#Iteration_methods | ||
*/ | ||
var accessorMethods = ["concat", "slice"]; | ||
var newArrayReturningMethods = [ | ||
"concat", | ||
"slice", | ||
"filter", | ||
"map", | ||
"reduce", | ||
"reduceRight" | ||
]; | ||
/** | ||
* Functions that create a new array. | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#Methods | ||
*/ | ||
var constructorFunctions = ["from", "of"]; | ||
function checkTypedNode(node, ctx, checker) { | ||
@@ -127,4 +145,4 @@ return { invalidNodes: getInvalidNodes(node, ctx, checker) }; | ||
utils.isPropertyAccessExpression(node.expression) && | ||
(!ctx.options.ignoreMutationFollowingAccessor || | ||
!isInChainCallAndFollowsAccessor(node.expression)) && | ||
(!(ctx.options.ignoreNewArray || ctx.options.ignoreMutationFollowingAccessor) || | ||
!isInChainCallAndFollowsNew(node.expression, checker)) && | ||
mutatorMethods.some(function (m) { return m === node.expression.name.text; })) { | ||
@@ -141,15 +159,24 @@ // Do the type checking as late as possible (as it is expensive). | ||
* Check if the given the given PropertyAccessExpression is part of a chain and | ||
* immediately follows an accessor method call. | ||
* immediately follows a method/function call that returns a new array. | ||
* | ||
* If this is the case, then the given PropertyAccessExpression is allowed to be a mutator method call. | ||
*/ | ||
function isInChainCallAndFollowsAccessor(node) { | ||
return (utils.isCallExpression(node.expression) && | ||
utils.isPropertyAccessExpression(node.expression.expression) && | ||
accessorMethods.some(function (m) { | ||
return m === | ||
node.expression | ||
.expression.name.text; | ||
})); | ||
function isInChainCallAndFollowsNew(node, checker) { | ||
return (utils.isArrayLiteralExpression(node.expression) || | ||
(utils.isNewExpression(node.expression) && | ||
isArrayConstructorType(checker.getTypeAtLocation(node.expression.expression))) || | ||
(utils.isCallExpression(node.expression) && | ||
utils.isPropertyAccessExpression(node.expression.expression) && | ||
constructorFunctions.some(isExpected(node.expression.expression.name.text)) && | ||
isArrayConstructorType(checker.getTypeAtLocation(node.expression.expression.expression))) || | ||
(utils.isCallExpression(node.expression) && | ||
utils.isPropertyAccessExpression(node.expression.expression) && | ||
newArrayReturningMethods.some(isExpected(node.expression.expression.name.text)))); | ||
} | ||
/** | ||
* Returns a function that checks if the given value is the same as the expected value. | ||
*/ | ||
function isExpected(expected) { | ||
return function (actual) { return actual === expected; }; | ||
} | ||
//# sourceMappingURL=noArrayMutationRule.js.map |
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
290302
1256
646