eslint-plugin-unicorn
Advanced tools
Comparing version 45.0.1 to 45.0.2
{ | ||
"name": "eslint-plugin-unicorn", | ||
"version": "45.0.1", | ||
"version": "45.0.2", | ||
"description": "More than 100 powerful ESLint rules", | ||
@@ -50,3 +50,3 @@ "license": "MIT", | ||
"@babel/helper-validator-identifier": "^7.19.1", | ||
"@eslint-community/eslint-utils": "^4.1.0", | ||
"@eslint-community/eslint-utils": "^4.1.2", | ||
"ci-info": "^3.6.1", | ||
@@ -79,3 +79,3 @@ "clean-regexp": "^1.0.0", | ||
"eslint-ava-rule-tester": "^4.0.0", | ||
"eslint-doc-generator": "^0.24.0", | ||
"eslint-doc-generator": "^1.0.0", | ||
"eslint-plugin-eslint-plugin": "^5.0.6", | ||
@@ -82,0 +82,0 @@ "eslint-plugin-internal-rules": "file:./scripts/internal-rules/", |
@@ -20,4 +20,6 @@ # 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) [![npm version](https://img.shields.io/npm/v/eslint-plugin-unicorn.svg?style=flat)](https://npmjs.com/package/eslint-plugin-unicorn) | ||
Use a [preset config](#preset-configs) or configure each rules in `package.json`. | ||
Use a [preset config](#preset-configs) or configure each rule in `package.json`. | ||
If you don't use the preset, ensure you use the same `env` and `parserOptions` config as below. | ||
```json | ||
@@ -24,0 +26,0 @@ { |
@@ -9,4 +9,6 @@ 'use strict'; | ||
const MESSAGE_ID = 'better-regex'; | ||
const MESSAGE_ID_PARSE_ERROR = 'better-regex/parse-error'; | ||
const messages = { | ||
[MESSAGE_ID]: '{{original}} can be optimized to {{optimized}}.', | ||
[MESSAGE_ID_PARSE_ERROR]: 'Problem parsing {{original}}: {{error}}', | ||
}; | ||
@@ -43,2 +45,3 @@ | ||
node, | ||
messageId: MESSAGE_ID_PARSE_ERROR, | ||
data: { | ||
@@ -48,3 +51,2 @@ original, | ||
}, | ||
message: 'Problem parsing {{original}}: {{error}}', | ||
}; | ||
@@ -51,0 +53,0 @@ } |
@@ -30,8 +30,14 @@ 'use strict'; | ||
const tree = parseRegExp(pattern, flags, { | ||
unicodePropertyEscape: true, | ||
namedGroups: true, | ||
lookbehind: true, | ||
}); | ||
let tree; | ||
try { | ||
tree = parseRegExp(pattern, flags, { | ||
unicodePropertyEscape: true, | ||
namedGroups: true, | ||
lookbehind: true, | ||
}); | ||
} catch { | ||
return; | ||
} | ||
const parts = tree.type === 'alternative' ? tree.body : [tree]; | ||
@@ -38,0 +44,0 @@ if (parts.some(part => part.type !== 'value')) { |
@@ -451,3 +451,8 @@ 'use strict'; | ||
if (variableReplacements.total === 1 && shouldFix(variable) && variableReplacements.samples[0]) { | ||
if ( | ||
variableReplacements.total === 1 | ||
&& shouldFix(variable) | ||
&& variableReplacements.samples[0] | ||
&& !variable.references.some(reference => reference.vueUsedInTemplate) | ||
) { | ||
const [replacement] = variableReplacements.samples; | ||
@@ -454,0 +459,0 @@ |
@@ -12,7 +12,2 @@ 'use strict'; | ||
function getParenthesizedTimes(node, sourceCode) { | ||
// Workaround for https://github.com/mysticatea/eslint-utils/pull/25 | ||
if (!node.parent) { | ||
return 0; | ||
} | ||
let times = 0; | ||
@@ -19,0 +14,0 @@ |
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
580363
18137
219