New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tslint-immutable

Package Overview
Dependencies
Maintainers
1
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 4.0.2 to 4.1.0

rules/noObjectMutationRule.js

9

CHANGELOG.md

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

## [v4.1.0] - 2017-08-21
### Added
- New rule `no-object-mutation`. See [#36](https://github.com/jonaskello/tslint-immutable/pull/36) for background. Thanks to [@miangraham](https://github.com/miangraham) for this rule! (See PR [#37](https://github.com/jonaskello/tslint-immutable/pull/37))
## [v4.0.2] - 2017-07-16

@@ -130,4 +134,5 @@ ### Added

[Unreleased]: https://github.com/jonaskello/tslint-immutable/compare/v4.0.2...master
[v4.0.1]: https://github.com/jonaskello/tslint-immutable/compare/v4.0.1...v4.0.2
[Unreleased]: https://github.com/jonaskello/tslint-immutable/compare/v4.1.0...master
[v4.1.0]: https://github.com/jonaskello/tslint-immutable/compare/v4.0.2...v4.1.0
[v4.0.2]: https://github.com/jonaskello/tslint-immutable/compare/v4.0.1...v4.0.2
[v4.0.1]: https://github.com/jonaskello/tslint-immutable/compare/v4.0.0...v4.0.1

@@ -134,0 +139,0 @@ [v4.0.0]: https://github.com/jonaskello/tslint-immutable/compare/v3.4.2...v4.0.0

{
"name": "tslint-immutable",
"version": "4.0.2",
"version": "4.1.0",
"description": "TSLint rules to disable mutation in TypeScript.",

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

@@ -39,2 +39,3 @@ # tslint-immutable

* [no-let](#no-let)
* [no-object-mutation](#no-object-mutation)
* [Functional style rules](#functional-style-rules)

@@ -167,2 +168,13 @@ * [no-this](#no-this-no-class)

### no-object-mutation
This rule prohibits syntax that mutates existing objects via assignment to or deletion of their properties. While requiring the `readonly` modifier forces declared types to be immutable, it won't stop assignment into or modification of untyped objects or external types declared under different rules. Forbidding forms like `a.b = 'c'` is one way to plug this hole. Inspired by the no-mutation rule of [eslint-plugin-immutable](https://github.com/jhusain/eslint-plugin-immutable).
```typescript
const x = {a: 1};
x.foo = 'bar'; // <- Modifying properties of existing object not allowed.
x.a += 1; // <- Modifying properties of existing object not allowed.
delete x.a; // <- Modifying properties of existing object not allowed.
```
## Functional style rules

@@ -289,2 +301,3 @@

"no-let": true,
"no-object-mutation": true,

@@ -291,0 +304,0 @@ // Functional style rules

@@ -10,4 +10,5 @@ {

"no-mixed-interface": false,
"no-expression-statement": false
"no-expression-statement": false,
"no-object-mutation": false
}
}
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