eslint-plugin-eslint-plugin
Advanced tools
Comparing version 5.0.7 to 5.0.8
@@ -41,35 +41,14 @@ /** | ||
/** | ||
*compare two test cases despite of properties order. | ||
*@returns {boolean} if eq, return true, else return false. | ||
* Create a unique cache key | ||
* @param {object} test | ||
* @returns {string} | ||
*/ | ||
function eq(testA, testB) { | ||
if (testA.type !== testB.type) { | ||
return false; | ||
function toKey(test) { | ||
if (test.type !== 'ObjectExpression') { | ||
return JSON.stringify([test.type, sourceCode.getText(test)]); | ||
} | ||
if (testA.type !== 'ObjectExpression') { | ||
return sourceCode.getText(testA) === sourceCode.getText(testB); | ||
} | ||
const propertiesA = testA.properties; | ||
const propertiesB = testB.properties; | ||
// if properties length not eq; return false; | ||
if (propertiesA.length !== propertiesB.length) { | ||
return false; | ||
} | ||
const propertiesSetA = new Set(); | ||
propertiesA.forEach((item) => { | ||
const code = sourceCode.getText(item); | ||
propertiesSetA.add(code); | ||
}); | ||
for (const element of propertiesB) { | ||
const code = sourceCode.getText(element); | ||
if (!propertiesSetA.has(code)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
return JSON.stringify([ | ||
test.type, | ||
...test.properties.map((p) => sourceCode.getText(p)).sort(), | ||
]); | ||
} | ||
@@ -81,5 +60,6 @@ | ||
[testRun.valid, testRun.invalid].forEach((tests) => { | ||
const cache = []; | ||
const cache = new Set(); | ||
tests.forEach((test) => { | ||
if (cache.some((item) => eq(item, test))) { | ||
const key = toKey(test); | ||
if (cache.has(key)) { | ||
context.report({ | ||
@@ -101,3 +81,3 @@ node: test, | ||
} else { | ||
cache.push(test); | ||
cache.add(key); | ||
} | ||
@@ -104,0 +84,0 @@ }); |
@@ -115,5 +115,6 @@ /** | ||
// eslint-disable-next-line unicorn/no-negated-condition -- actually more clear like this | ||
messageId: !urlPropNode | ||
? 'missing' | ||
: // eslint-disable-next-line unicorn/no-nested-ternary -- this is fine for now | ||
: // eslint-disable-next-line unicorn/no-nested-ternary,unicorn/no-negated-condition -- this is fine for now | ||
!expectedUrl | ||
@@ -120,0 +121,0 @@ ? 'wrongType' |
{ | ||
"name": "eslint-plugin-eslint-plugin", | ||
"version": "5.0.7", | ||
"version": "5.0.8", | ||
"description": "An ESLint plugin for linting ESLint plugins", | ||
@@ -19,2 +19,3 @@ "author": "Teddy Katz", | ||
"lint:package-json": "npmPkgJsonLint .", | ||
"lint:remote": "eslint-remote-tester", | ||
"release": "release-it", | ||
@@ -66,3 +67,4 @@ "test": "nyc --all --check-coverage --include lib mocha tests --recursive", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-unicorn": "^44.0.0", | ||
"eslint-plugin-unicorn": "^45.0.2", | ||
"eslint-remote-tester": "^3.0.0", | ||
"eslint-scope": "^7.1.1", | ||
@@ -72,3 +74,3 @@ "espree": "^9.4.0", | ||
"lodash": "^4.17.21", | ||
"markdownlint-cli": "^0.32.2", | ||
"markdownlint-cli": "^0.33.0", | ||
"mocha": "^10.0.0", | ||
@@ -75,0 +77,0 @@ "npm-package-json-lint": "^6.3.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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
141095
29
3594
1