eslint-plugin-functional
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -8,4 +8,42 @@ # Changelog | ||
## [Unreleased](https://github.com/jonaskello/eslint-plugin-functional/compare/v1.0.0-rc.2...HEAD) | ||
## [Unreleased](https://github.com/jonaskello/eslint-plugin-functional/compare/v1.0.2...HEAD) | ||
### Merged | ||
- Local mutation in a function now only refers to within the function's body [`#78`](https://github.com/jonaskello/eslint-plugin-functional/pull/78) | ||
- no-mixed-interface rule does not exist anymore [`#81`](https://github.com/jonaskello/eslint-plugin-functional/pull/81) | ||
### Fixed | ||
- fix(prefer-readonly-type): local mutation in a function only refers to within the function's body [`#75`](https://github.com/jonaskello/eslint-plugin-functional/issues/75) | ||
## [v1.0.2](https://github.com/jonaskello/eslint-plugin-functional/compare/v1.0.1...v1.0.2) - 2019-12-11 | ||
### Merged | ||
- feat(no-expression-statement): allow specifying directive prologues [`#74`](https://github.com/jonaskello/eslint-plugin-functional/pull/74) | ||
### Fixed | ||
- fix(no-expression-statement): allow specifying directive prologues [`#68`](https://github.com/jonaskello/eslint-plugin-functional/issues/68) | ||
## [v1.0.1](https://github.com/jonaskello/eslint-plugin-functional/compare/v1.0.0...v1.0.1) - 2019-12-11 | ||
### Merged | ||
- fix(typeguards): only assume types if type information is not avaliable [`#73`](https://github.com/jonaskello/eslint-plugin-functional/pull/73) | ||
- docs(readme): change tslint-immutable to eslint-plugin-functional #66 [`#69`](https://github.com/jonaskello/eslint-plugin-functional/pull/69) | ||
- docs(readme): fix typos [`#70`](https://github.com/jonaskello/eslint-plugin-functional/pull/70) | ||
### Fixed | ||
- fix(typeguards): only assume types if type information is not avaliable [`#72`](https://github.com/jonaskello/eslint-plugin-functional/issues/72) | ||
## [v1.0.0](https://github.com/jonaskello/eslint-plugin-functional/compare/v1.0.0-rc.2...v1.0.0) - 2019-10-14 | ||
### Merged | ||
- Upgrade typescript-eslint packages [`#65`](https://github.com/jonaskello/eslint-plugin-functional/pull/65) | ||
- Rename to no-mutations [`#62`](https://github.com/jonaskello/eslint-plugin-functional/pull/62) | ||
### Changed | ||
@@ -12,0 +50,0 @@ |
@@ -31,3 +31,3 @@ 'use strict'; | ||
"functional/no-method-signature": "error", | ||
"functional/no-mixed-interface": "error", | ||
"functional/no-mixed-type": "error", | ||
"functional/prefer-readonly-type": "error", | ||
@@ -322,14 +322,15 @@ "functional/prefer-type-literal": "error", | ||
*/ | ||
function getParentOfType(checker, node) { | ||
return checker(node) | ||
function getParentOfType(checker, node, child) { | ||
if (child === void 0) { child = null; } | ||
return checker(node, child) | ||
? node | ||
: node.parent == undefined | ||
? null | ||
: getParentOfType(checker, node.parent); | ||
: getParentOfType(checker, node.parent, node); | ||
} | ||
/** | ||
* Test if the given node is in a function. | ||
* Test if the given node is in a function's body. | ||
*/ | ||
function inFunction(node) { | ||
return getParentOfType(isFunctionLike, node) !== null; | ||
function inFunctionBody(node) { | ||
return (getParentOfType(function (n, c) { return isFunctionLike(n) && n.body === c; }, node) !== null); | ||
} | ||
@@ -553,3 +554,3 @@ /** | ||
// Allow if in a function and allowLocalMutation is set. | ||
(options.allowLocalMutation === true && inFunction(node)) || | ||
(options.allowLocalMutation === true && inFunctionBody(node)) || | ||
// Ignore if in a class and ignoreClass is set. | ||
@@ -575,3 +576,3 @@ (options.ignoreClass === true && inClass(node)) || | ||
const version = "1.0.1"; | ||
const version = "1.0.2"; | ||
@@ -578,0 +579,0 @@ // This function can't be functional as it needs to interact with 3rd-party |
{ | ||
"name": "eslint-plugin-functional", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "ESLint rules to disable mutation and promote fp in TypeScript.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -8,2 +8,3 @@ # eslint-plugin-functional | ||
[![MIT license][license-image]][license-url] | ||
[![Join the community on Spectrum][spectrum-image]][spectrum-url] | ||
@@ -241,1 +242,3 @@ [ESLint](https://eslint.org/) rules to disable mutation and promote functional programming in JavaScript and TypeScript. | ||
[type-info-url]: https://palantir.github.io/tslint/usage/type-checking | ||
[spectrum-image]: https://withspectrum.github.io/badge/badge.svg | ||
[spectrum-url]: https://spectrum.chat/eslint-functional |
Sorry, the diff of this file is not supported yet
154216
3756
243