eslint-plugin-unicorn
Advanced tools
Comparing version 30.0.0 to 31.0.0
@@ -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', |
{ | ||
"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 ( |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
387056
133
12488
243
15
+ Addedis-builtin-module@^3.1.0
+ Added@eslint/config-array@0.19.0(transitive)
+ Added@eslint/core@0.9.0(transitive)
+ Added@eslint/eslintrc@3.2.0(transitive)
+ Added@eslint/js@9.15.0(transitive)
+ Addedbuiltin-modules@3.3.0(transitive)
+ Addedelectron-to-chromium@1.5.61(transitive)
+ Addedeslint@9.15.0(transitive)
+ Addedis-builtin-module@3.2.1(transitive)
- Removed@eslint/config-array@0.18.0(transitive)
- Removed@eslint/core@0.7.0(transitive)
- Removed@eslint/eslintrc@3.1.0(transitive)
- Removed@eslint/js@9.14.0(transitive)
- Removedelectron-to-chromium@1.5.60(transitive)
- Removedeslint@9.14.0(transitive)
- Removedtext-table@0.2.0(transitive)