Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-array-func

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-array-func - npm Package Compare versions

Comparing version 4.0.0 to 5.0.0

67

index.js

@@ -5,38 +5,41 @@ /**

*/
"use strict";
import fromMap from "./rules/from-map.js";
import noUnnecessaryThisArgument from "./rules/no-unnecessary-this-arg.js";
import preferArrayFrom from "./rules/prefer-array-from.js";
import avoidReverse from "./rules/avoid-reverse.js";
import preferFlatMap from "./rules/prefer-flat-map.js";
import preferFlat from "./rules/prefer-flat.js";
module.exports = {
const index = {
rules: {
"from-map": require("./rules/from-map"),
"no-unnecessary-this-arg": require("./rules/no-unnecessary-this-arg"),
"prefer-array-from": require("./rules/prefer-array-from"),
"avoid-reverse": require("./rules/avoid-reverse"),
"prefer-flat-map": require("./rules/prefer-flat-map"),
"prefer-flat": require("./rules/prefer-flat")
"from-map": fromMap,
"no-unnecessary-this-arg": noUnnecessaryThisArgument,
"prefer-array-from": preferArrayFrom,
"avoid-reverse": avoidReverse,
"prefer-flat-map": preferFlatMap,
"prefer-flat": preferFlat
},
configs: {
recommended: {
parserOptions: {
ecmaVersion: 2015
},
plugins: [ 'array-func' ],
rules: {
"array-func/from-map": "error",
"array-func/no-unnecessary-this-arg": "error",
"array-func/prefer-array-from": "error",
"array-func/avoid-reverse": "error"
}
},
all: {
parserOptions: {
ecmaVersion: 2018
},
plugins: [ 'array-func' ],
rules: {
"array-func/prefer-flat-map": "error",
"array-func/prefer-flat": "error"
},
extends: [ 'plugin:array-func/recommended' ]
}
configs: {}
};
index.configs.recommended = {
plugins: { "array-func": index },
rules: {
"array-func/from-map": "error",
"array-func/no-unnecessary-this-arg": "error",
"array-func/prefer-array-from": "error",
"array-func/avoid-reverse": "error"
}
};
index.configs.all = {
plugins: { "array-func": index },
rules: {
"array-func/from-map": "error",
"array-func/no-unnecessary-this-arg": "error",
"array-func/prefer-array-from": "error",
"array-func/avoid-reverse": "error",
"array-func/prefer-flat-map": "error",
"array-func/prefer-flat": "error"
}
};
export default index;

@@ -5,13 +5,11 @@ /**

*/
"use strict";
const {
import {
MEMBER_EXPRESSION,
IDENTIFIER
} = require("../type");
} from "../type.js";
// Helper functions for call expression nodes.
exports.isMethod = (node, name) => "callee" in node && node.callee.type === MEMBER_EXPRESSION && node.callee.property.name === name;
export const isMethod = (node, name) => "callee" in node && node.callee.type === MEMBER_EXPRESSION && node.callee.property.name === name;
exports.isOnObject = (node, name) => "object" in node.callee && node.callee.object.type === IDENTIFIER && node.callee.object.name === name;
export const isOnObject = (node, name) => "object" in node.callee && node.callee.object.type === IDENTIFIER && node.callee.object.name === name;

@@ -5,6 +5,5 @@ /**

*/
"use strict";
exports.MEMBER_EXPRESSION = "MemberExpression";
exports.ARROW_FUNCTION_EXPRESSION = "ArrowFunctionExpression";
exports.IDENTIFIER = "Identifier";
export const MEMBER_EXPRESSION = "MemberExpression";
export const ARROW_FUNCTION_EXPRESSION = "ArrowFunctionExpression";
export const IDENTIFIER = "Identifier";
{
"name": "eslint-plugin-array-func",
"version": "4.0.0",
"version": "5.0.0",
"description": "Rules dealing with Array functions and methods.",

@@ -16,13 +16,13 @@ "main": "index.js",

"@freaktechnik/eslint-config-test": "^9.2.1",
"@typescript-eslint/parser": "^6.6.0",
"ava": "^5.3.1",
"eslint": "^8.49.0",
"eslint-ava-rule-tester": "^4.0.0",
"eslint-plugin-eslint-plugin": "^5.1.1",
"@typescript-eslint/parser": "^6.19.1",
"ava": "^6.1.0",
"eslint": "^8.56.0",
"eslint-ava-rule-tester": "^5.0.1",
"eslint-plugin-eslint-plugin": "^5.2.1",
"eslint-plugin-optimize-regex": "^1.2.1",
"nyc": "^15.1.0",
"typescript": "^5.2.2"
"typescript": "^5.3.3"
},
"peerDependencies": {
"eslint": ">=8.40.0"
"eslint": ">=8.51.0"
},

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

"type": "git",
"url": "https://github.com/freaktechnik/eslint-plugin-array-func.git"
"url": "git+https://github.com/freaktechnik/eslint-plugin-array-func.git"
},

@@ -58,3 +58,4 @@ "bugs": {

"provenance": true
}
},
"type": "module"
}

@@ -382,6 +382,4 @@ # eslint-plugin-array-func

### `array-func/recommended` Configuration
### `recommended` Configuration
The recommended configuration will set your parser ECMA Version to 2015, since that's when the Array functions and methods were added.
Rule | Error level | Fixable

@@ -396,17 +394,17 @@ ---- | ----------- | -------

To enable this configuration use the `extends` property in your `.eslintrc.json` config file (may look different for other config file styles):
To enable this configuration, import the plugin and add the config to your eslint config array:
```json
{
"extends": [
"plugin:array-func/recommended"
]
}
```js
import arrayFunc from "eslint-plugin-array-func";
export default [
arrayFunc.configs.recommended,
];
```
### `array-func/all` Configuration
### `all` Configuration
The recommended configuration does not include all rules, since some Array methods
were added after ES2015. The all configuration enables all rules the plugin
contains and sets the ECMA version appropriately.
containsy.

@@ -424,10 +422,10 @@ Rule | Error level | Fixable

To enable this configuration use the `extends` property in your `.eslintrc.json` config file (may look different for other config file styles):
To enable this configuration, import the plugin and add the config to your eslint config array:
```json
{
"extends": [
"plugin:array-func/all"
]
}
```js
import arrayFunc from "eslint-plugin-array-func";
export default [
arrayFunc.configs.all,
];
```

@@ -434,0 +432,0 @@

@@ -5,12 +5,10 @@ /**

*/
"use strict";
import { isMethod } from "../lib/helpers/call-expression.js";
const { isMethod } = require("../lib/helpers/call-expression"),
const REPLACEMENTS = {
reduce: "reduceRight",
reduceRight: "reduce"
};
REPLACEMENTS = {
reduce: "reduceRight",
reduceRight: "reduce"
};
module.exports = {
export default {
meta: {

@@ -17,0 +15,0 @@ docs: {

@@ -5,9 +5,8 @@ /**

*/
"use strict";
import { ARROW_FUNCTION_EXPRESSION } from "../lib/type.js";
const { ARROW_FUNCTION_EXPRESSION } = require("../lib/type"),
ALL_PARAMS = [
{ name: 'item' },
{ name: 'index' }
];
const ALL_PARAMS = [
{ name: 'item' },
{ name: 'index' }
];

@@ -18,3 +17,3 @@ function isFunction(node) {

module.exports = {
export default {
meta: {

@@ -21,0 +20,0 @@ docs: {

@@ -5,11 +5,9 @@ /**

*/
"use strict";
import {
isMethod,
isOnObject
} from "../lib/helpers/call-expression.js";
import { ARROW_FUNCTION_EXPRESSION } from "../lib/type.js";
const {
isMethod,
isOnObject
} = require("../lib/helpers/call-expression"),
{ ARROW_FUNCTION_EXPRESSION } = require("../lib/type"),
arrayFunctions = {
const arrayFunctions = {
from: 3

@@ -76,3 +74,3 @@ },

module.exports = {
export default {
meta: {

@@ -79,0 +77,0 @@ docs: {

@@ -5,3 +5,2 @@ /**

*/
"use strict";

@@ -13,3 +12,3 @@ const firstElement = (array) => {

module.exports = {
export default {
meta: {

@@ -16,0 +15,0 @@ docs: {

@@ -5,5 +5,4 @@ /**

*/
"use strict";
module.exports = {
export default {
meta: {

@@ -10,0 +9,0 @@ docs: {

@@ -5,6 +5,3 @@ /**

*/
"use strict";
//TODO no works.
const

@@ -16,3 +13,3 @@ firstElement = ([ first ]) => first,

module.exports = {
export default {
meta: {

@@ -19,0 +16,0 @@ docs: {

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