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

eslint-plugin-unicorn

Package Overview
Dependencies
Maintainers
1
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-unicorn - npm Package Compare versions

Comparing version 30.0.0 to 31.0.0

rules/prefer-module.js

2

index.js

@@ -102,3 +102,5 @@ 'use strict';

'unicorn/prefer-modern-dom-apis': 'error',
'unicorn/prefer-module': 'error',
'unicorn/prefer-negative-index': 'error',
'unicorn/prefer-node-protocol': 'error',
'unicorn/prefer-number-properties': 'error',

@@ -105,0 +107,0 @@ 'unicorn/prefer-optional-catch-binding': 'error',

7

package.json
{
"name": "eslint-plugin-unicorn",
"version": "30.0.0",
"version": "31.0.0",
"description": "Various awesome ESLint rules",

@@ -18,5 +18,5 @@ "license": "MIT",

"test": "xo && nyc ava",
"create-rule": "node ./scripts/create-rule.js && npm run generate-rules-table",
"create-rule": "node ./scripts/create-rule.mjs && npm run generate-rules-table",
"run-rules-on-codebase": "node ./test/run-rules-on-codebase/lint.mjs",
"integration": "node ./test/integration/test.js",
"integration": "node ./test/integration/test.mjs",
"smoke": "eslint-remote-tester --config ./test/smoke/eslint-remote-tester.config.js",

@@ -46,2 +46,3 @@ "generate-rules-table": "node ./scripts/generate-rules-table.mjs"

"import-modules": "^2.1.0",
"is-builtin-module": "^3.1.0",
"lodash": "^4.17.21",

@@ -48,0 +49,0 @@ "pluralize": "^8.0.0",

@@ -93,3 +93,5 @@ # eslint-plugin-unicorn [![Coverage Status](https://codecov.io/gh/sindresorhus/eslint-plugin-unicorn/branch/main/graph/badge.svg)](https://codecov.io/gh/sindresorhus/eslint-plugin-unicorn/branch/main)

"unicorn/prefer-modern-dom-apis": "error",
"unicorn/prefer-module": "error",
"unicorn/prefer-negative-index": "error",
"unicorn/prefer-node-protocol": "error",
"unicorn/prefer-number-properties": "error",

@@ -127,4 +129,4 @@ "unicorn/prefer-optional-catch-binding": "error",

| Name | Description | ✅ | 🔧 |
| :--- | :---------- | :------------------- | :--------------- |
| Name                                          | Description | ✅ | 🔧 |
| :-- | :-- | :-- | :-- |
| [better-regex](docs/rules/better-regex.md) | Improve regexes by making them shorter, consistent, and safer. | ✅ | 🔧 |

@@ -172,4 +174,4 @@ | [catch-error-name](docs/rules/catch-error-name.md) | Enforce a specific parameter name in catch clauses. | ✅ | 🔧 |

| [prefer-array-find](docs/rules/prefer-array-find.md) | Prefer `.find(…)` over the first element from `.filter(…)`. | ✅ | 🔧 |
| [prefer-array-flat](docs/rules/prefer-array-flat.md) | Prefer `.flatMap(…)` over `.map(…).flat()`. | | 🔧 |
| [prefer-array-flat-map](docs/rules/prefer-array-flat-map.md) | Prefer `Array#flat()` over legacy techniques to flatten arrays. | | 🔧 |
| [prefer-array-flat](docs/rules/prefer-array-flat.md) | Prefer `Array#flat()` over legacy techniques to flatten arrays. | | 🔧 |
| [prefer-array-flat-map](docs/rules/prefer-array-flat-map.md) | Prefer `.flatMap(…)` over `.map(…).flat()`. | | 🔧 |
| [prefer-array-index-of](docs/rules/prefer-array-index-of.md) | Prefer `Array#indexOf()` over `Array#findIndex()` when looking for the index of an item. | ✅ | 🔧 |

@@ -187,3 +189,5 @@ | [prefer-array-some](docs/rules/prefer-array-some.md) | Prefer `.some(…)` over `.find(…)`. | ✅ | |

| [prefer-modern-dom-apis](docs/rules/prefer-modern-dom-apis.md) | Prefer `.before()` over `.insertBefore()`, `.replaceWith()` over `.replaceChild()`, prefer one of `.before()`, `.after()`, `.append()` or `.prepend()` over `insertAdjacentText()` and `insertAdjacentElement()`. | ✅ | 🔧 |
| [prefer-module](docs/rules/prefer-module.md) | Prefer JavaScript modules (ESM) over CommonJS. | ✅ | 🔧 |
| [prefer-negative-index](docs/rules/prefer-negative-index.md) | Prefer negative index over `.length - index` for `{String,Array,TypedArray}#slice()` and `Array#splice()`. | ✅ | 🔧 |
| [prefer-node-protocol](docs/rules/prefer-node-protocol.md) | Prefer using the `node:` protocol when importing Node.js builtin modules. | ✅ | 🔧 |
| [prefer-number-properties](docs/rules/prefer-number-properties.md) | Prefer `Number` static properties over global ones. | ✅ | 🔧 |

@@ -190,0 +194,0 @@ | [prefer-optional-catch-binding](docs/rules/prefer-optional-catch-binding.md) | Prefer omitting the `catch` binding parameter. | ✅ | 🔧 |

@@ -174,3 +174,3 @@ 'use strict';

docs: {
description: 'Prefer `Array#flat()` over legacy techniques to flatten arrays.',
description: 'Prefer `.flatMap(…)` over `.map(…).flat()`.',
url: getDocumentationUrl(__filename)

@@ -177,0 +177,0 @@ },

@@ -268,3 +268,3 @@ 'use strict';

docs: {
description: 'Prefer `.flatMap(…)` over `.map(…).flat()`.',
description: 'Prefer `Array#flat()` over legacy techniques to flatten arrays.',
url: getDocumentationUrl(__filename)

@@ -271,0 +271,0 @@ },

@@ -12,2 +12,3 @@ 'use strict';

const renameIdentifier = require('./utils/rename-identifier');
const isStaticRequire = require('./utils/is-static-require');

@@ -449,12 +450,2 @@ const isUpperCase = string => string === string.toUpperCase();

const isStaticRequire = node => Boolean(
node &&
node.callee &&
node.callee.type === 'Identifier' &&
node.callee.name === 'require' &&
node.arguments.length === 1 &&
node.arguments[0].type === 'Literal' &&
typeof node.arguments[0].value === 'string'
);
const isDefaultOrNamespaceImportName = identifier => {

@@ -461,0 +452,0 @@ if (

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