Socket
Socket
Sign inDemoInstall

eslint-plugin-functional

Package Overview
Dependencies
Maintainers
1
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 0.5.2 to 0.5.3

10

CHANGELOG.md

@@ -8,6 +8,12 @@ # Changelog

## [Unreleased](https://github.com/jonaskello/eslint-plugin-functional/compare/v0.5.2...HEAD)
## [Unreleased](https://github.com/jonaskello/eslint-plugin-functional/compare/v0.5.3...HEAD)
## [v0.5.2](https://github.com/jonaskello/eslint-plugin-functional/compare/v0.5.1...v0.5.2) - 2019-07-31
## [v0.5.3](https://github.com/jonaskello/eslint-plugin-functional/compare/v0.5.1...v0.5.3) - 2019-08-02
### Fixed
- fix(immutable-data): ignore call expressions on ignored arrays [`#56`](https://github.com/jonaskello/eslint-plugin-functional/issues/56)
## [v0.5.2](https://github.com/jonaskello/eslint-plugin-functional/compare/v0.5.1...v0.5.2) - 2019-07-30
### Merged

@@ -14,0 +20,0 @@

114

lib/index.js

@@ -21,6 +21,6 @@ 'use strict';

"functional/no-loop-statement": "error",
"functional/no-reject": "error",
"functional/no-this": "error",
"functional/no-throw": "error",
"functional/no-try": "error"
"functional/no-promise-reject": "error",
"functional/no-this-expression": "error",
"functional/no-throw-statement": "error",
"functional/no-try-statement": "error"
},

@@ -88,4 +88,4 @@ overrides: [

rules: {
"functional/no-throw": "error",
"functional/no-try": "error"
"functional/no-throw-statement": "error",
"functional/no-try-statement": "error"
}

@@ -96,3 +96,3 @@ });

rules: {
"functional/no-this": "error",
"functional/no-this-expression": "error",
"functional/no-class": "error"

@@ -139,3 +139,3 @@ },

"functional/no-expression-statement": "off",
"functional/no-try": "off"
"functional/no-try-statement": "off"
}

@@ -396,6 +396,6 @@ });

// Polyfill.
var ignoreLocalOptionSchema = {
var allowLocalMutationOptionSchema = {
type: "object",
properties: {
ignoreLocal: {
allowLocalMutation: {
type: "boolean"

@@ -430,11 +430,2 @@ }

};
var ignoreReturnTypeOptionSchema = {
type: "object",
properties: {
ignoreReturnType: {
type: "boolean"
}
},
additionalProperties: false
};
var ignoreClassOptionSchema = {

@@ -499,3 +490,3 @@ type: "object",

/**
* Should the given text be ignore?
* Should the given text be allowed?
*

@@ -541,3 +532,3 @@ * Test using the given pattern(s).

/**
* Should the given text be ignore?
* Should the given text be allowed?
*

@@ -556,8 +547,14 @@ * Test using the given accessor pattern(s).

/**
* Should the given node be ignored?
* Should the given node be allowed base off the following rule options?
*
* - IgnoreAccessorPatternOption
* - IgnoreClassOption
* - IgnoreInterfaceOption
* - IgnorePatternOption
* - AllowLocalMutationOption
*/
function shouldIgnore(node, context, options) {
return (
// Ignore if in a function and ignoreLocal is set.
(options.ignoreLocal === true && inFunction(node)) ||
// Allow if in a function and allowLocalMutation is set.
(options.allowLocalMutation === true && inFunction(node)) ||
// Ignore if in a class and ignoreClass is set.

@@ -583,3 +580,3 @@ (options.ignoreClass === true && inClass(node)) ||

const version = "0.5.1";
const version = "0.5.3";

@@ -675,3 +672,3 @@ // This function can't be functional as it needs to interact with 3rd-party

},
allowIIFE: {
ignoreIIFE: {
type: "boolean"

@@ -695,3 +692,3 @@ }

count: "atLeastOne",
allowIIFE: false
ignoreIIFE: true
}

@@ -739,3 +736,3 @@ };

typeof enforceParameterCount === "object" &&
enforceParameterCount.allowIIFE &&
enforceParameterCount.ignoreIIFE &&
isIIFE(node))) {

@@ -824,2 +821,5 @@ return [];

properties: {
ignoreImmediateMutation: {
type: "boolean"
},
assumeTypes: {

@@ -851,3 +851,7 @@ oneOf: [

var defaultOptions$1 = {
assumeTypes: true
ignoreImmediateMutation: true,
assumeTypes: {
forArrays: true,
forObjects: true
}
};

@@ -925,3 +929,3 @@ // The possible error messages.

descriptors: isMemberExpression(node.left) &&
// Ignore if in a constructor - allow for field initialization.
// Allow if in a constructor - allow for field initialization.
!inConstructor(node)

@@ -991,8 +995,11 @@ ? [{ node: node, messageId: "generic" }]

? // Potential array mutation?
arrayMutatorMethods.some(function (m) {
return m ===
node.callee
.property.name;
}) &&
!isInChainCallAndFollowsNew(node.callee, context, assumeTypesForArrays) &&
// Check if allowed here - this cannot be automatically checked beforehand.
!shouldIgnore(node.callee.object, context, options) &&
arrayMutatorMethods.some(function (m) {
return m ===
node.callee
.property.name;
}) &&
(!options.ignoreImmediateMutation ||
!isInChainCallAndFollowsNew(node.callee, context, assumeTypesForArrays)) &&
isArrayType(getTypeOfNode(node.callee.object, context), assumeTypesForArrays, node.callee.object)

@@ -1009,3 +1016,3 @@ ? [{ node: node, messageId: "array" }]

isMemberExpression(node.arguments[0])) &&
// Check if ignored here - this cannot be automatically checked beforehand.
// Check if allowed here - this cannot be automatically checked beforehand.
!shouldIgnore(node.arguments[0], context, options) &&

@@ -1224,7 +1231,7 @@ isObjectConstructorType(getTypeOfNode(node.callee.object, context), assumeTypesForObjects, node.callee.object)

var schema$5 = [
deepMerge.all([ignoreLocalOptionSchema, ignorePatternOptionSchema])
deepMerge.all([allowLocalMutationOptionSchema, ignorePatternOptionSchema])
];
// The default options for the rule.
var defaultOptions$5 = {
ignoreLocal: false
allowLocalMutation: false
};

@@ -1428,3 +1435,3 @@ // The possible error messages.

// The name of this rule.
var name$9 = "no-reject";
var name$9 = "no-promise-reject";
// The schema for the rule options.

@@ -1531,3 +1538,3 @@ var schema$9 = [];

// The name of this rule.
var name$b = "no-this";
var name$b = "no-this-expression";
// The schema for the rule options.

@@ -1565,3 +1572,3 @@ var schema$b = [];

// The name of this rule.
var name$c = "no-throw";
var name$c = "no-throw-statement";
// The schema for the rule options.

@@ -1599,3 +1606,3 @@ var schema$c = [];

// The name of this rule.
var name$d = "no-try";
var name$d = "no-try-statement";
// The schema for the rule options.

@@ -1661,10 +1668,12 @@ var schema$d = [

deepMerge.all([
ignoreLocalOptionSchema,
allowLocalMutationOptionSchema,
ignorePatternOptionSchema,
ignoreClassOptionSchema,
ignoreInterfaceOptionSchema,
ignoreReturnTypeOptionSchema,
{
type: "object",
properties: {
allowMutableReturnType: {
type: "boolean"
},
checkImplicit: {

@@ -1683,4 +1692,4 @@ type: "boolean"

ignoreInterface: false,
ignoreLocal: false,
ignoreReturnType: false
allowLocalMutation: false,
allowMutableReturnType: false
};

@@ -1717,3 +1726,3 @@ // The possible error messages.

node.parent.operator !== "readonly") &&
(!options.ignoreReturnType || !isInReturnType(node))
(!options.allowMutableReturnType || !isInReturnType(node))
? [

@@ -1742,3 +1751,4 @@ {

context: context,
descriptors: immutableType_1 && (!options.ignoreReturnType || !isInReturnType(node))
descriptors: immutableType_1 &&
(!options.allowMutableReturnType || !isInReturnType(node))
? [

@@ -1854,6 +1864,8 @@ {

var schema$f = [
deepMerge.all([ignoreLocalOptionSchema, ignorePatternOptionSchema])
deepMerge.all([allowLocalMutationOptionSchema, ignorePatternOptionSchema])
];
// The default options for the rule.
var defaultOptions$f = {};
var defaultOptions$f = {
allowLocalMutation: false
};
// The possible error messages.

@@ -1860,0 +1872,0 @@ var errorMessages$f = {

{
"name": "eslint-plugin-functional",
"version": "0.5.2",
"version": "0.5.3",
"description": "ESLint rules to disable mutation and promote fp in TypeScript.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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