Huge News!Announcing our $40M Series B led by Abstract Ventures.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 3.2.0 to 3.3.0

tslint-immutable.json

10

CHANGELOG.md

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

## [v3.3.0] - 2017-05-09
### Fixed
- ignore-local does not work for function assigned to const [#23](https://github.com/jonaskello/tslint-immutable/issues/23)
### Added
- Add default tslint json. Thanks to [@yonbeastie](https://github.com/yonbeastie). (see [#26](https://github.com/jonaskello/tslint-immutable/pull/26))
## [v3.2.0] - 2017-04-10

@@ -76,3 +83,4 @@ ### Fixed

[Unreleased]: https://github.com/jonaskello/tslint-immutable/compare/v3.2.0...master
[Unreleased]: https://github.com/jonaskello/tslint-immutable/compare/v3.3.0...master
[v3.3.0]: https://github.com/jonaskello/tslint-immutable/compare/v3.2.0...v3.3.0
[v3.2.0]: https://github.com/jonaskello/tslint-immutable/compare/v3.1.2...v3.2.0

@@ -79,0 +87,0 @@ [v3.1.2]: https://github.com/jonaskello/tslint-immutable/compare/v3.1.1...v3.1.2

6

package.json
{
"name": "tslint-immutable",
"version": "3.2.0",
"version": "3.3.0",
"description": "TSLint rules to disable mutation in TypeScript.",
"main": "index.js",
"main": "tslint-immutable.js",
"repository": {

@@ -22,3 +22,3 @@ "type": "git",

"shelljs": "^0.7.5",
"tslint": "^5.0.0",
"tslint": "^5.1.0",
"typescript": "^2.2.2"

@@ -25,0 +25,0 @@ },

@@ -11,3 +11,3 @@ # tslint-immutable

In some applications it is important to not mutate any data, for example when using Redux to store state in a React application. Moreover immutable data structures has a lot of advantages in general so I want to use them everywhere in my applications.
In some applications it is important to not mutate any data, for example when using Redux to store state in a React application. Moreover immutable data structures has a lot of advantages in general so I want to use them everywhere in my applications.

@@ -28,3 +28,3 @@ I originally used [immutablejs](https://github.com/facebook/immutable-js/) for this purpose. It is a really nice library but I found it had some drawbacks. Specifically when debugging it was hard to see the structure, creating JSON was not straightforward, and passing parameters to other libraries required converting to regular mutable arrays and objects. The [seamless-immutable](https://github.com/rtfeldman/seamless-immutable) project seems to have the same conclusions and they use regular objects and arrays and check for immutability at run-time. This solves all the aformentioned drawbacks but introduces a new drawback of only being enforced at run-time. (Altough you loose the structural sharing feature of immutablejs with this solution so you would have to consider if that is something you need).

* tslint-immutable 3.x.x is compatible with tslint 5.x.x.
* tslint-immutable 3.x.x is compatible with tslint 5.x.x.
* tslint-immutable 2.x.x is compatible with tslint 4.x.x.

@@ -54,5 +54,5 @@ * tslint-immutable 1.x.x is compatible with tslint 3.x.x.

### Immutability rules
## Immutability rules
#### readonly-interface
### readonly-interface

@@ -85,3 +85,3 @@ This rule enforces having the `readonly` modifier on all interface members.

#### readonly-indexer
### readonly-indexer

@@ -92,8 +92,8 @@ This rule enforces all indexers to have the readonly modifier.

// NOT OK
let foo: { [key:string]: number };
let foo: { [key:string]: number };
// OK
let foo: { readonly [key:string]: number };
let foo: { readonly [key:string]: number };
```
#### readonly-array
### readonly-array

@@ -118,10 +118,10 @@ This rule enforces use of `ReadonlyArray<T>` instead of `Array<T>` or `T[]`.

##### Has Fixer
#### Has Fixer
Yes
##### Options:
#### Options
- [ignore-local](#using-the-ignore-local-option)
- [ignore-prefix](#using-the-ignore-prefix-option)
##### Example config:
#### Example config
```javascript

@@ -137,3 +137,3 @@ "readonly-array": true

#### no-let
### no-let
This rule should be combined with tslint's built-in `no-var-keyword` rule to enforce that all variables are declared as `const`.

@@ -150,4 +150,4 @@

```typescript
const SearchResults =
({ results }) =>
const SearchResults =
({ results }) =>
<ul>{

@@ -158,5 +158,5 @@ results.map(result => <li>result</li>) // <- Who needs let?

### Functional style rules
## Functional style rules
#### no-this, no-class, no-new
### no-this, no-class, no-new
Thanks to libraries like [recompose](https://github.com/acdlite/recompose) and Redux's [React Container components](http://redux.js.org/docs/basics/UsageWithReact.html), there's not much reason to build Components using `React.createClass` or ES6 classes anymore. The `no-this` rule makes this explicit.

@@ -192,7 +192,7 @@

#### no-mixed-interface
### no-mixed-interface
Mixing functions and data properties in the same interface is a sign of object-orientation style. This rule enforces that an inteface only has one type of members, eg. only data properties or only functions.
#### no-expression-statement
### no-expression-statement
When you call a function and don’t use it’s return value, chances are high that it is being called for its side effect. e.g.

@@ -207,16 +207,16 @@

### Other rules
## Other rules
#### no-arguments
### no-arguments
Disallows use of the `arguments` keyword.
#### no-label
### no-label
Disallows the use of labels, and indirectly also `goto`.
#### no-semicolon-interface
### no-semicolon-interface
Ensures that interfaces only use commas as separator instead semicolor.
```typescript

@@ -235,3 +235,3 @@ // This is NOT ok.

#### import-containment
### import-containment

@@ -301,3 +301,5 @@ ECMAScript modules does not have a concept of a library that can span multiple files and share internal members. If you have a set of files that forms an library, and they need to be able to call each other internally without exposing members to other files outside the library set, this rule can be useful.

{
"rulesDirectory": ["./node_modules/tslint-immutable/rules"],
"extends": [
"tslint-immutable"
],
"rules": {

@@ -339,3 +341,3 @@

For new features file an issue. For bugs, file an issue and optionally file a PR with a failing test. Tests are really easy to do, you just have to edit the `*.ts.lint` files under the test directory. Read more here about [tslint testing](https://palantir.github.io/tslint/develop/testing-rules/).
For new features file an issue. For bugs, file an issue and optionally file a PR with a failing test. Tests are really easy to do, you just have to edit the `*.ts.lint` files under the test directory. Read more here about [tslint testing](https://palantir.github.io/tslint/develop/testing-rules/).

@@ -342,0 +344,0 @@ ## How to develop

@@ -48,3 +48,4 @@ "use strict";

// Skip checking in functions if ignore-local is set
if (ctx.options.ignoreLocal && (node.kind === ts.SyntaxKind.FunctionDeclaration || node.kind === ts.SyntaxKind.ArrowFunction)) {
if (ctx.options.ignoreLocal && (node.kind === ts.SyntaxKind.FunctionDeclaration
|| node.kind === ts.SyntaxKind.ArrowFunction || node.kind === ts.SyntaxKind.FunctionExpression)) {
// We still need to check the parameters and return type

@@ -51,0 +52,0 @@ var functionNode = node; //tslint:disable-line

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