🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@hao360/eslint-plugin-cube

Package Overview
Dependencies
Maintainers
8
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hao360/eslint-plugin-cube - npm Package Compare versions

Comparing version
0.1.3
to
0.1.4
+17
-21
lib/rules/no-cube-attributes.js

@@ -14,2 +14,8 @@ "use strict";

create: function(context) {
function checkAttrName(attr, attrName) {
if (attr instanceof RegExp) {
return attr.test(attrName)
}
return attrName === attr
}
return {

@@ -19,23 +25,13 @@ "HTMLAttributeName": function (node) {

let attr = attributes[i];
let attrValue = node.value.toLowerCase();
if (attr instanceof RegExp) {
if (attr.test(attrValue)) {
context.report({
node,
message: `禁止使用${attrValue}属性`,
loc: node.loc,
rang: node.rang
})
break;
}
} else {
if (attrValue === attr) {
context.report({
node,
message: `禁止使用${attrValue}属性`,
loc: node.loc,
rang: node.rang
})
break;
}
let attrName = node.value.toLowerCase();
let attrValue = node.parent.attributeValue ? node.parent.attributeValue.value : '';
let isRegularExpression = /^{{/.test(attrValue.trim());
if (!isRegularExpression && checkAttrName(attr, attrName)) {
context.report({
node,
message: `禁止使用${attrName}属性`,
loc: node.loc,
rang: node.rang
})
break;
}

@@ -42,0 +38,0 @@ }

{
"name": "@hao360/eslint-plugin-cube",
"version": "0.1.3",
"version": "0.1.4",
"description": "cube rule validation plugin",

@@ -5,0 +5,0 @@ "main": "lib/index.js",