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

eslint-plugin-eslint-plugin

Package Overview
Dependencies
Maintainers
5
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-eslint-plugin - npm Package Compare versions

Comparing version 5.0.7 to 5.0.8

48

lib/rules/no-identical-tests.js

@@ -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",

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