Socket
Socket
Sign inDemoInstall

eslint-plugin-functional

Package Overview
Dependencies
Maintainers
2
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-functional - npm Package Compare versions

Comparing version 3.4.1 to 3.5.0

10

CHANGELOG.md

@@ -10,6 +10,14 @@ # Changelog

## [v3.4.1](https://github.com/jonaskello/eslint-plugin-functional/compare/v3.4.0...v3.4.1)
## [v3.5.0](https://github.com/jonaskello/eslint-plugin-functional/compare/v3.4.1...v3.5.0)
### Commits
- feat(no-return-void): add option to allow for checking implicit return types [`6fb1604`](https://github.com/jonaskello/eslint-plugin-functional/commit/6fb16047aaa7712d537d64ee26728a0cc85cf0cf)
- docs: update readme for using with typescript [`ba8fe86`](https://github.com/jonaskello/eslint-plugin-functional/commit/ba8fe865bd5e21dcd072dd3f0f727d05420217e2)
- build(deps-dev): bump tsutils from 3.17.1 to 3.21.0 [`1c921ea`](https://github.com/jonaskello/eslint-plugin-functional/commit/1c921ea559809ea653c9ed04549fedea8d690273)
## [v3.4.1](https://github.com/jonaskello/eslint-plugin-functional/compare/v3.4.0...v3.4.1) - 2021-07-31
### Commits
- feat(no-conditional-statement): allow switches that exhaust all types [`35a72f1`](https://github.com/jonaskello/eslint-plugin-functional/commit/35a72f1f9243aa5207851df1b5e5c25f0918e3bc)

@@ -16,0 +24,0 @@

@@ -323,2 +323,11 @@ 'use strict';

}
function isVoidType(type) {
return ts !== undefined && type.flags === ts.TypeFlags.Void;
}
function isNullType(type) {
return ts !== undefined && type.flags === ts.TypeFlags.Null;
}
function isUndefinedType(type) {
return ts !== undefined && type.flags === ts.TypeFlags.Undefined;
}

@@ -510,3 +519,3 @@ function getAncestorOfType(checker, node, child = null) {

const version = "3.4.0";
const version = "3.4.1";

@@ -1302,2 +1311,5 @@ function checkNode(check, context, options) {

},
ignoreImplicit: {
type: "boolean",
},
},

@@ -1310,2 +1322,3 @@ additionalProperties: false,

allowUndefined: true,
ignoreImplicit: true,
};

@@ -1326,12 +1339,30 @@ const errorMessages$6 = {

function checkFunction$1(node, context, options) {
var _a, _b;
if (node.returnType === undefined) {
if (!options.ignoreImplicit && isFunctionLike(node)) {
const functionType = getTypeOfNode(node, context);
const returnType = (_b = (_a = functionType === null || functionType === void 0 ? void 0 : functionType.getCallSignatures()) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.getReturnType();
if (returnType !== undefined &&
(isVoidType(returnType) ||
(!options.allowNull && isNullType(returnType)) ||
(!options.allowUndefined && isUndefinedType(returnType)))) {
return {
context,
descriptors: [{ node, messageId: "generic" }],
};
}
}
}
else if (isTSVoidKeyword(node.returnType.typeAnnotation) ||
(!options.allowNull && isTSNullKeyword(node.returnType.typeAnnotation)) ||
(!options.allowUndefined &&
isTSUndefinedKeyword(node.returnType.typeAnnotation))) {
return {
context,
descriptors: [{ node: node.returnType, messageId: "generic" }],
};
}
return {
context,
descriptors: node.returnType !== undefined &&
(isTSVoidKeyword(node.returnType.typeAnnotation) ||
(!options.allowNull &&
isTSNullKeyword(node.returnType.typeAnnotation)) ||
(!options.allowUndefined &&
isTSUndefinedKeyword(node.returnType.typeAnnotation)))
? [{ node: node.returnType, messageId: "generic" }]
: [],
descriptors: [],
};

@@ -1338,0 +1369,0 @@ }

4

package.json
{
"name": "eslint-plugin-functional",
"version": "3.4.1",
"version": "3.5.0",
"description": "ESLint rules to disable mutation and promote fp in TypeScript.",

@@ -106,3 +106,3 @@ "keywords": [

"tslib": "^2.0.3",
"tsutils": "^3.17.1",
"tsutils": "^3.21.0",
"typescript": "^4.1.3"

@@ -109,0 +109,0 @@ },

@@ -14,3 +14,3 @@ <div align="center">

An [ESLint](http://eslint.org) plugin to disable mutation and promote functional programming in JavaScript and TypeScript.

@@ -74,8 +74,10 @@

Additionally, some rules require [tsutils](https://www.npmjs.com/package/tsutils) as a dependency.
```sh
# Install with npm
npm install eslint @typescript-eslint/parser eslint-plugin-functional --save-dev
npm install eslint @typescript-eslint/parser tsutils eslint-plugin-functional --save-dev
# Install with yarn
yarn add -D eslint @typescript-eslint/parser eslint-plugin-functional
yarn add -D eslint @typescript-eslint/parser tsutils eslint-plugin-functional
```

@@ -82,0 +84,0 @@

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