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

eslint-plugin-css

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-css - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

7

dist/rules/color-hex-style.js

@@ -39,4 +39,3 @@ "use strict";

parsedValue.walk(({ value: textValue, type, sourceIndex }) => {
if (type === "function" &&
textValue.toLowerCase() === "url")
if (type === "function" && textValue.toLowerCase() === "url")
return false;

@@ -50,5 +49,3 @@ if (type !== "word")

const sourceCode = context.getSourceCode();
const startIndex = value.expression.range[0] +
sourceIndex +
1;
const startIndex = value.expression.range[0] + sourceIndex + 1;
const endIndex = startIndex + textValue.length;

@@ -55,0 +52,0 @@ const loc = value.directExpression

@@ -75,4 +75,3 @@ "use strict";

const { value: textValue, type, sourceIndex } = node;
if (type === "function" &&
textValue.toLowerCase() === "url")
if (type === "function" && textValue.toLowerCase() === "url")
return false;

@@ -83,4 +82,3 @@ const actual = postcss_value_parser_1.default.stringify(node);

if (type === "word") {
expected =
(0, color_1.parseHexColor)(textValue).toName() || actual;
expected = (0, color_1.parseHexColor)(textValue).toName() || actual;
}

@@ -95,4 +93,3 @@ else if (type === "function") {

else if (option === "never") {
if (type !== "word" ||
/[^A-Za-z]/u.test(textValue)) {
if (type !== "word" || /[^A-Za-z]/u.test(textValue)) {
return undefined;

@@ -109,5 +106,3 @@ }

const sourceCode = context.getSourceCode();
const startIndex = value.expression.range[0] +
sourceIndex +
1;
const startIndex = value.expression.range[0] + sourceIndex + 1;
const endIndex = startIndex + actual.length;

@@ -114,0 +109,0 @@ const loc = value.directExpression

@@ -37,4 +37,3 @@ "use strict";

context.report({
node: report.directExpression ||
report.expression,
node: report.directExpression || report.expression,
messageId: "unexpected",

@@ -41,0 +40,0 @@ data: { name: report.name, other: other.name },

@@ -29,4 +29,3 @@ "use strict";

parsedValue.walk(({ value: textValue, type, sourceIndex }) => {
if (type === "function" &&
textValue.toLowerCase() === "url")
if (type === "function" && textValue.toLowerCase() === "url")
return false;

@@ -42,5 +41,3 @@ if (type !== "word")

const sourceCode = context.getSourceCode();
const startIndex = value.expression.range[0] +
sourceIndex +
1;
const startIndex = value.expression.range[0] + sourceIndex + 1;
const endIndex = startIndex + textValue.length;

@@ -47,0 +44,0 @@ const loc = value.directExpression

@@ -72,4 +72,3 @@ "use strict";

ignorePropName(prop.name) ||
((0, casing_1.isCamelCase)(prop.name) &&
ignorePropName((0, casing_1.kebabCase)(prop.name)))) {
((0, casing_1.isCamelCase)(prop.name) && ignorePropName((0, casing_1.kebabCase)(prop.name)))) {
return;

@@ -124,6 +123,3 @@ }

sourceCode.text.slice(startIndex, endIndex) === unit) {
return fixer.removeRange([
startIndex,
endIndex,
]);
return fixer.removeRange([startIndex, endIndex]);
}

@@ -130,0 +126,0 @@ return null;

@@ -29,4 +29,3 @@ "use strict";

}
if (typeof value.value === "number" ||
!value.value.includes(".")) {
if (typeof value.value === "number" || !value.value.includes(".")) {
return;

@@ -66,6 +65,3 @@ }

/^0+$/u.test(sourceCode.text.slice(startIndex, endIndex))) {
return fixer.removeRange([
startIndex,
endIndex,
]);
return fixer.removeRange([startIndex, endIndex]);
}

@@ -72,0 +68,0 @@ return null;

@@ -76,4 +76,3 @@ "use strict";

if (unit === "x") {
if (((_a = property.getName()) === null || _a === void 0 ? void 0 : _a.name.toLowerCase()) ===
"image-resolution") {
if (((_a = property.getName()) === null || _a === void 0 ? void 0 : _a.name.toLowerCase()) === "image-resolution") {
return undefined;

@@ -85,4 +84,3 @@ }

const imageSetLastNode = imageSet.nodes[imageSet.nodes.length - 1];
if (imageSetLastNode.sourceIndex >=
node.sourceIndex) {
if (imageSetLastNode.sourceIndex >= node.sourceIndex) {
return undefined;

@@ -93,5 +91,3 @@ }

const sourceCode = context.getSourceCode();
const startIndex = value.expression.range[0] +
node.sourceIndex +
1;
const startIndex = value.expression.range[0] + node.sourceIndex + 1;
const endIndex = startIndex + node.value.length;

@@ -98,0 +94,0 @@ const loc = value.directExpression

@@ -35,4 +35,3 @@ "use strict";

const { value: textValue, type, sourceIndex } = node;
if (type === "function" &&
textValue.toLowerCase() === "url")
if (type === "function" && textValue.toLowerCase() === "url")
return false;

@@ -52,5 +51,3 @@ if (type !== "word" && type !== "function")

const sourceCode = context.getSourceCode();
const startIndex = value.expression.range[0] +
sourceIndex +
1;
const startIndex = value.expression.range[0] + sourceIndex + 1;
const endIndex = startIndex + actual.length;

@@ -57,0 +54,0 @@ const loc = value.directExpression

@@ -35,4 +35,3 @@ "use strict";

}
if (typeof value.value === "number" ||
!value.value.includes(".")) {
if (typeof value.value === "number" || !value.value.includes(".")) {
return;

@@ -88,4 +87,3 @@ }

match[0].length -
(match.groups.zero.length +
match.groups.decimal.length) +
(match.groups.zero.length + match.groups.decimal.length) +
1;

@@ -106,6 +104,3 @@ const endIndex = startIndex + match.groups.zero.length;

/^0+$/u.test(sourceCode.text.slice(startIndex, endIndex))) {
return fixer.removeRange([
startIndex,
endIndex,
]);
return fixer.removeRange([startIndex, endIndex]);
}

@@ -112,0 +107,0 @@ return null;

@@ -28,3 +28,5 @@ "use strict";

const option = context.options[0];
const caseType = allowedCaseOptions.includes(option) ? option : "camelCase";
const caseType = allowedCaseOptions.includes(option)
? option
: "camelCase";
const checker = (0, casing_1.getChecker)(caseType);

@@ -53,4 +55,3 @@ function createVisitor(cssContext) {

const quoted = (prop.directExpression.type === "Literal" &&
typeof prop.directExpression.value ===
"string") ||
typeof prop.directExpression.value === "string") ||
prop.directExpression.type === "TemplateLiteral";

@@ -68,6 +69,3 @@ if (!quoted && caseType === "kebab-case") {

if (quoted) {
replaceRange = [
replaceRange[0] + 1,
replaceRange[1] - 1,
];
replaceRange = [replaceRange[0] + 1, replaceRange[1] - 1];
}

@@ -74,0 +72,0 @@ return fixer.replaceTextRange(replaceRange, newName);

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -23,3 +27,3 @@ if (k2 === undefined) k2 = k;

exports.isStringLiteral = exports.isStaticTemplateLiteral = exports.findExpression = exports.getScope = exports.getStaticValue = exports.getPropertyName = exports.findVariable = exports.getParent = void 0;
const eslintUtils = __importStar(require("eslint-utils"));
const eslintUtils = __importStar(require("@eslint-community/eslint-utils"));
function getParent(node) {

@@ -26,0 +30,0 @@ if (!node) {

@@ -52,5 +52,3 @@ "use strict";

const lightness = (0, parser_1.parseNumberUnit)(tokens[2], ["%"]);
if (!hue ||
!(0, parser_1.isPercentRange)(saturation) ||
!(0, parser_1.isPercentRange)(lightness)) {
if (!hue || !(0, parser_1.isPercentRange)(saturation) || !(0, parser_1.isPercentRange)(lightness)) {
return null;

@@ -57,0 +55,0 @@ }

@@ -59,5 +59,3 @@ "use strict";

const blackness = (0, parser_1.parseNumberUnit)(tokens[2], ["%"]);
if (!hue ||
!(0, parser_1.isPercentRange)(whiteness) ||
!(0, parser_1.isPercentRange)(blackness)) {
if (!hue || !(0, parser_1.isPercentRange)(whiteness) || !(0, parser_1.isPercentRange)(blackness)) {
return null;

@@ -64,0 +62,0 @@ }

@@ -47,4 +47,3 @@ "use strict";

var _a;
return ((_a = this.typeCache) !== null && _a !== void 0 ? _a : (this.typeCache = /^[a-z]+$/iu.test(this.input) &&
(0, colord_1.getColorFormat)(this.input) === "name"
return ((_a = this.typeCache) !== null && _a !== void 0 ? _a : (this.typeCache = /^[a-z]+$/iu.test(this.input) && (0, colord_1.getColorFormat)(this.input) === "name"
? "name"

@@ -51,0 +50,0 @@ : "unknown"));

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

@@ -128,5 +128,3 @@ "use strict";

else if (ctx.on === "define-function" || ctx.on === "mark") {
if (visitor.onProperty ||
visitor.onRule ||
visitor["onRule:exit"]) {
if (visitor.onProperty || visitor.onRule || visitor["onRule:exit"]) {
for (const prop of object.properties) {

@@ -322,4 +320,3 @@ if (prop.type === "Property") {

const targetRange = targetNode.range;
return (scopeRange[0] <= targetRange[0] &&
targetRange[1] <= scopeRange[1]);
return (scopeRange[0] <= targetRange[0] && targetRange[1] <= scopeRange[1]);
}

@@ -408,4 +405,3 @@ return false;

if (node.type === "Literal") {
if (typeof node.value === "string" ||
typeof node.value === "number") {
if (typeof node.value === "string" || typeof node.value === "number") {
return {

@@ -412,0 +408,0 @@ value: node.value,

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

@@ -90,7 +90,4 @@ "use strict";

],
["border-top", ["border-top-width", "border-top-style", "border-top-color"]],
[
"border-top",
["border-top-width", "border-top-style", "border-top-color"],
],
[
"border-bottom",

@@ -233,8 +230,3 @@ ["border-bottom-width", "border-bottom-style", "border-bottom-color"],

"grid-area",
[
"grid-row-start",
"grid-column-start",
"grid-row-end",
"grid-column-end",
],
["grid-row-start", "grid-column-start", "grid-row-end", "grid-column-end"],
],

@@ -251,7 +243,3 @@ ["grid-column", ["grid-column-start", "grid-column-end"]],

"text-decoration",
[
"text-decoration-color",
"text-decoration-style",
"text-decoration-line",
],
["text-decoration-color", "text-decoration-style", "text-decoration-line"],
],

@@ -258,0 +246,0 @@ ["text-emphasis", ["text-emphasis-style", "text-emphasis-color"]],

{
"name": "eslint-plugin-css",
"version": "0.6.0",
"description": "An ESLint plugin that provides rules to verify CSS definition objects.",
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"main": "dist/index.js",
"files": [
"dist"
],
"scripts": {
"prebuild": "npm run -s clean",
"build": "tsc --project ./tsconfig.build.json",
"clean": "npx rimraf .nyc_output dist coverage",
"lint": "eslint . --ext .js,.vue,.ts,.json,.yaml,.yml",
"eslint-fix": "eslint . --ext .js,.vue,.ts,.json,.yaml,.yml --fix",
"pretest": "npm run build",
"test:base": "mocha --require ts-node/register \"tests/**/*.ts\" --reporter dot --timeout 60000",
"test": "npm run test:nyc",
"test:nyc": "nyc --reporter=lcov npm run test:base",
"test:debug": "mocha --require ts-node/register/transpile-only \"tests/**/*.ts\" --reporter dot --timeout 60000",
"test:watch": "npm run test:base -- --watch",
"update": "ts-node --transpile-only ./tools/update.ts && npm run eslint-fix",
"new": "ts-node ./tools/new-rule.ts",
"docs:watch": "vuepress dev --debug docs",
"docs:build": "npm run build && vuepress build docs --no-cache",
"preversion": "npm test && git add .",
"version": "env-cmd -e version npm run update && git add ."
},
"repository": {
"type": "git",
"url": "git+https://github.com/ota-meshi/eslint-plugin-css.git"
},
"keywords": [
"eslint",
"eslintplugin",
"eslint-plugin",
"css",
"vue",
"react",
"css-in-js"
],
"author": "Yosuke Ota (https://github.com/ota-meshi)",
"funding": "https://github.com/sponsors/ota-meshi",
"license": "MIT",
"bugs": {
"url": "https://github.com/ota-meshi/eslint-plugin-css/issues"
},
"homepage": "https://github.com/ota-meshi/eslint-plugin-css#readme",
"dependencies": {
"colord": "^2.9.1",
"eslint-utils": "^3.0.0",
"known-css-properties": "^0.24.0",
"postcss-value-parser": "^4.1.0"
},
"peerDependencies": {
"eslint": ">=7.0.0"
},
"devDependencies": {
"@ota-meshi/eslint-plugin": "^0.10.0",
"@types/chai": "^4.2.22",
"@types/eslint": "^8.0.0",
"@types/eslint-scope": "^3.7.1",
"@types/eslint-utils": "^3.0.0",
"@types/estree": "^0.0.50",
"@types/jsdom": "^16.2.13",
"@types/mocha": "^9.0.0",
"@types/node": "^16.10.1",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"chai": "^4.3.4",
"env-cmd": "^10.1.0",
"eslint": "^8.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-eslint-plugin": "^4.0.0",
"eslint-plugin-json-schema-validator": "^2.0.0",
"eslint-plugin-jsonc": "^2.0.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-node-dependencies": "^0.6.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-regexp": "~1.5.0",
"eslint-plugin-vue": "^8.0.0",
"eslint-plugin-yml": "^0.12.0",
"mocha": "^9.1.2",
"mocha-chai-jest-snapshot": "^1.1.3",
"nyc": "^15.1.0",
"prettier": "~2.5.0",
"raw-loader": "^4.0.2",
"stylelint": "^14.0.0",
"stylelint-config-recommended-vue": "^1.0.0",
"stylelint-config-standard": "^24.0.0",
"stylelint-plugin-stylus": "^0.13.0",
"ts-node": "^10.2.1",
"typescript": "~4.5.0",
"vue-eslint-editor": "^1.1.0",
"vue-eslint-parser": "^8.0.0",
"vuepress": "^1.8.2"
}
"name": "eslint-plugin-css",
"version": "0.7.0",
"description": "An ESLint plugin that provides rules to verify CSS definition objects.",
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"main": "dist/index.js",
"files": [
"dist"
],
"scripts": {
"prebuild": "npm run -s clean",
"build": "tsc --project ./tsconfig.build.json",
"clean": "npx rimraf .nyc_output dist coverage",
"lint": "eslint . --ext .js,.vue,.ts,.json,.yaml,.yml",
"eslint-fix": "eslint . --ext .js,.vue,.ts,.json,.yaml,.yml --fix",
"pretest": "npm run build",
"test:base": "mocha --require ts-node/register \"tests/**/*.ts\" --reporter dot --timeout 60000",
"test": "npm run test:nyc",
"test:nyc": "nyc --reporter=lcov npm run test:base",
"test:debug": "mocha --require ts-node/register/transpile-only \"tests/**/*.ts\" --reporter dot --timeout 60000",
"test:watch": "npm run test:base -- --watch",
"update": "ts-node --transpile-only ./tools/update.ts && npm run eslint-fix",
"new": "ts-node ./tools/new-rule.ts",
"docs:watch": "vuepress dev --debug docs",
"docs:build": "npm run build && vuepress build docs --no-cache",
"prerelease": "npm run test && npm run build",
"release": "changeset publish",
"preversion": "npm test && git add .",
"version": "env-cmd -e version npm run update && git add .",
"version:ci": "env-cmd -e version-ci npm run update && changeset version"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ota-meshi/eslint-plugin-css.git"
},
"keywords": [
"eslint",
"eslintplugin",
"eslint-plugin",
"css",
"vue",
"react",
"css-in-js"
],
"author": "Yosuke Ota (https://github.com/ota-meshi)",
"funding": "https://github.com/sponsors/ota-meshi",
"license": "MIT",
"bugs": {
"url": "https://github.com/ota-meshi/eslint-plugin-css/issues"
},
"homepage": "https://github.com/ota-meshi/eslint-plugin-css#readme",
"dependencies": {
"@eslint-community/eslint-utils": "^4.3.0",
"colord": "^2.9.1",
"known-css-properties": "^0.27.0",
"postcss-value-parser": "^4.1.0"
},
"peerDependencies": {
"eslint": ">=7.0.0"
},
"devDependencies": {
"@changesets/changelog-github": "^0.4.6",
"@changesets/cli": "^2.24.2",
"@ota-meshi/eslint-plugin": "^0.13.0",
"@types/chai": "^4.2.22",
"@types/eslint": "^8.0.0",
"@types/eslint-scope": "^3.7.1",
"@types/eslint-community__eslint-utils": "npm:@types/eslint-utils@^3",
"@types/estree": "^1.0.0",
"@types/jsdom": "^21.0.0",
"@types/mocha": "^10.0.0",
"@types/node": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"chai": "^4.3.4",
"env-cmd": "^10.1.0",
"eslint": "^8.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-eslint-plugin": "^5.0.0",
"eslint-plugin-json-schema-validator": "^4.0.0",
"eslint-plugin-jsonc": "^2.0.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-node-dependencies": "^0.10.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-regexp": "^1.9.0",
"eslint-plugin-vue": "^9.0.0",
"eslint-plugin-yml": "^1.0.0",
"mocha": "^10.0.0",
"mocha-chai-jest-snapshot": "^1.1.3",
"nyc": "^15.1.0",
"prettier": "~2.8.0",
"raw-loader": "^4.0.2",
"stylelint": "^15.0.0",
"stylelint-config-recommended-vue": "^1.0.0",
"stylelint-config-standard": "^31.0.0",
"stylelint-stylus": "^0.18.0",
"ts-node": "^10.2.1",
"typescript": "~5.0.0",
"vue-eslint-editor": "^1.1.0",
"vue-eslint-parser": "^9.0.0",
"vuepress": "^1.8.2"
},
"publishConfig": {
"access": "public"
}
}
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