@withfig/eslint-plugin-fig-linter
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "@withfig/eslint-plugin-fig-linter", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "This is a eslint plugin which is tailored for fig specs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,29 +8,24 @@ module.exports = { | ||
return { | ||
Property(node) { | ||
const keyName = node.key.name; | ||
if (keyName === "insertValue") { | ||
if (node.parent.type === "ObjectExpression") { | ||
const nameProp = node.parent.properties.find( | ||
(prop) => prop.key.name === "name" | ||
); | ||
'ObjectExpression > Property[key.name="insertValue"]': function (node) { | ||
const nameProp = node.parent.properties.find( | ||
(prop) => prop?.key?.name === "name" | ||
); | ||
if (!nameProp) return; | ||
if (!nameProp) return; | ||
const insertValue = node.value.value; | ||
const nameValue = nameProp.value.value; | ||
const insertValue = node.value.value; | ||
const nameValue = nameProp.value.value; | ||
if (!insertValue || !nameValue) return; | ||
if (insertValue.trim() === nameValue.trim()) { | ||
context.report({ | ||
node, | ||
message: | ||
"The insertValue prop can be omitted if the value is the same as name", | ||
fix(fixer) { | ||
const [start, end] = node.range; | ||
// TODO: check if there is a comma after the prop before removing end + 1 | ||
return fixer.removeRange([start, end + 1]); | ||
}, | ||
}); | ||
} | ||
} | ||
if (!insertValue || !nameValue) return; | ||
if (insertValue.trim() === nameValue.trim()) { | ||
context.report({ | ||
node, | ||
message: | ||
"The insertValue prop can be omitted if the value is the same as name", | ||
fix(fixer) { | ||
const [start, end] = node.range; | ||
// TODO: check if there is a comma after the prop before removing end + 1 | ||
return fixer.removeRange([start, end + 1]); | ||
}, | ||
}); | ||
} | ||
@@ -37,0 +32,0 @@ }, |
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
0
17799
500