stylelint-high-performance-animation
Advanced tools
Comparing version 1.7.0 to 1.8.0
@@ -0,1 +1,5 @@ | ||
## v1.8.0 | ||
- Added: support for stylelint version 15. | ||
## v1.7.0 | ||
@@ -2,0 +6,0 @@ |
42
index.js
@@ -11,6 +11,6 @@ "use strict"; | ||
rejected: (type, prop) => | ||
`Unexpected use of low performance ${type} property (${prop}).` | ||
`Unexpected use of low performance ${type} property (${prop}).`, | ||
}); | ||
const isString = s => typeof s === "string"; | ||
const isString = (s) => typeof s === "string"; | ||
@@ -24,3 +24,3 @@ // https://drafts.csswg.org/css-timing/ | ||
"ease-in-out", | ||
"cubic-bezier" | ||
"cubic-bezier", | ||
]; | ||
@@ -92,3 +92,3 @@ const cssStepTimingFunctions = ["step-start", "step-end", "steps"]; | ||
"appearance", | ||
"direction" | ||
"direction", | ||
]; | ||
@@ -113,6 +113,6 @@ | ||
"outline-color", | ||
"box-shadow" | ||
"box-shadow", | ||
]; | ||
const getBlacklist = ignore => { | ||
const getBlacklist = (ignore) => { | ||
if (ignore === "paint-properties") { | ||
@@ -134,3 +134,3 @@ return propsThatCauseLayout; | ||
*/ | ||
const unprefixed = prop => { | ||
const unprefixed = (prop) => { | ||
return prop.replace(/^-\w+-/, ""); | ||
@@ -150,5 +150,5 @@ }; | ||
ignore: ["paint-properties"], | ||
ignoreProperties: [isString] | ||
ignoreProperties: [isString], | ||
}, | ||
optional: true | ||
optional: true, | ||
} | ||
@@ -163,4 +163,4 @@ ); | ||
cssRoot.walkDecls("transition-property", decl => { | ||
valueParser(decl.value).walk(node => { | ||
cssRoot.walkDecls("transition-property", (decl) => { | ||
valueParser(decl.value).walk((node) => { | ||
const val = unprefixed(node.value); | ||
@@ -178,3 +178,3 @@ if ( | ||
message: messages.rejected("transition", node.value), | ||
index | ||
index, | ||
}); | ||
@@ -185,10 +185,10 @@ } | ||
cssRoot.walkDecls("transition", decl => { | ||
cssRoot.walkDecls("transition", (decl) => { | ||
const nodes = []; | ||
valueParser(decl.value).walk(node => { | ||
valueParser(decl.value).walk((node) => { | ||
if (node.type === "word" || node.type === "function") | ||
nodes.push({ | ||
index: node.sourceIndex, | ||
value: node.value | ||
value: node.value, | ||
}); | ||
@@ -199,3 +199,3 @@ return false; | ||
if (ignored.indexOf("all") === -1) { | ||
const transitionProp = nodes.filter(node => { | ||
const transitionProp = nodes.filter((node) => { | ||
const isUnit = valueParser.unit(node.value); | ||
@@ -215,3 +215,3 @@ const isTimingFunction = cssTimingFunctionsRE.test(node.value); | ||
message: messages.rejected("transition", "all"), | ||
index: declarationValueIndex(decl) + nodes[0].index | ||
index: declarationValueIndex(decl) + nodes[0].index, | ||
}); | ||
@@ -234,3 +234,3 @@ return; | ||
message: messages.rejected("transition", prop.value), | ||
index | ||
index, | ||
}); | ||
@@ -241,4 +241,4 @@ } | ||
cssRoot.walkAtRules(/^keyframes$/i, atRuleKeyframes => { | ||
atRuleKeyframes.walkDecls(decl => { | ||
cssRoot.walkAtRules(/^keyframes$/i, (atRuleKeyframes) => { | ||
atRuleKeyframes.walkDecls((decl) => { | ||
const val = unprefixed(decl.prop); | ||
@@ -250,3 +250,3 @@ if (ignored.indexOf(val) === -1 && blacklist.indexOf(val) > -1) { | ||
node: decl, | ||
message: messages.rejected("animation", decl.prop) | ||
message: messages.rejected("animation", decl.prop), | ||
}); | ||
@@ -253,0 +253,0 @@ } |
{ | ||
"name": "stylelint-high-performance-animation", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"description": "Stylelint rule for preventing the use of low performance animation and transition properties.", | ||
@@ -43,7 +43,7 @@ "main": "index.js", | ||
"prettify": "prettier --write '**/*.{js,json}'", | ||
"release": "npmpub", | ||
"release": "np", | ||
"test": "jest --coverage" | ||
}, | ||
"peerDependencies": { | ||
"stylelint": "^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0" | ||
"stylelint": "^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0" | ||
}, | ||
@@ -116,13 +116,14 @@ "eslintConfig": { | ||
"babel-eslint": "^10.1.0", | ||
"eslint": "^7.31.0", | ||
"eslint": "^8.34.0", | ||
"eslint-plugin-sort-requires": "^2.1.0", | ||
"husky": "^7.0.1", | ||
"jest-cli": "^27.0.6", | ||
"jest-preset-stylelint": "^4.2.0", | ||
"lint-staged": "^11.0.1", | ||
"npmpub": "^5.0.0", | ||
"postcss-less": "^5.0.0", | ||
"jest": "^29.4.2", | ||
"jest-preset-stylelint": "^6.0.0", | ||
"lint-staged": "^13.1.1", | ||
"np": "^7.6.3", | ||
"postcss": "^8.4.21", | ||
"postcss-less": "^6.0.0", | ||
"postcss-scss": "^4.0.2", | ||
"prettier": "^2.3.2", | ||
"stylelint": "^14.0.1" | ||
"stylelint": "^15.1.0" | ||
}, | ||
@@ -129,0 +130,0 @@ "dependencies": { |
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
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
13723
13