🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

stylelint-z-index-value-constraint

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylelint-z-index-value-constraint - npm Package Compare versions

Comparing version

to
1.2.0

@@ -0,1 +1,5 @@

## v1.2.0
- Added: support for stylelint versions 11, 12, 13, and 14.
## v1.1.0

@@ -2,0 +6,0 @@

@@ -22,3 +22,3 @@ const stylelint = require("stylelint");

Number.isNaN ||
function(value) {
function (value) {
return value !== value;

@@ -31,65 +31,68 @@ };

module.exports = stylelint.createPlugin(ruleName, function(options, secondary) {
return function(cssRoot, result) {
const validOptions = stylelint.utils.validateOptions(
result,
ruleName,
{
actual: options,
possible: {
min: possibleValueTest,
max: possibleValueTest
module.exports = stylelint.createPlugin(
ruleName,
function (options, secondary) {
return function (cssRoot, result) {
const validOptions = stylelint.utils.validateOptions(
result,
ruleName,
{
actual: options,
possible: {
min: possibleValueTest,
max: possibleValueTest
}
},
{
actual: secondary,
possible: {
ignoreValues: [isNumber]
},
optional: true
}
},
{
actual: secondary,
possible: {
ignoreValues: [isNumber]
},
optional: true
);
if (!validOptions) {
return;
}
);
if (!validOptions) {
return;
}
cssRoot.walkDecls("z-index", function (decl) {
const value = Number(decl.value);
cssRoot.walkDecls("z-index", function(decl) {
const value = Number(decl.value);
if (
_isNaN(value) ||
(secondary &&
Array.isArray(secondary.ignoreValues) &&
secondary.ignoreValues.indexOf(value) > -1)
) {
return;
}
if (
_isNaN(value) ||
(secondary &&
Array.isArray(secondary.ignoreValues) &&
secondary.ignoreValues.indexOf(value) > -1)
) {
return;
}
if (options.max && Math.abs(value) > options.max) {
stylelint.utils.report({
ruleName,
result,
node: decl,
message: messages.largerThanMax(
isNegative(value) ? options.max * -1 : options.max
)
});
}
if (options.max && Math.abs(value) > options.max) {
stylelint.utils.report({
ruleName,
result,
node: decl,
message: messages.largerThanMax(
isNegative(value) ? options.max * -1 : options.max
)
});
}
if (options.min && Math.abs(value) < options.min) {
stylelint.utils.report({
ruleName,
result,
node: decl,
message: messages.smallerThanMin(
isNegative(value) ? options.min * -1 : options.min
)
});
}
});
};
}
);
if (options.min && Math.abs(value) < options.min) {
stylelint.utils.report({
ruleName,
result,
node: decl,
message: messages.smallerThanMin(
isNegative(value) ? options.min * -1 : options.min
)
});
}
});
};
});
module.exports.ruleName = ruleName;
module.exports.messages = messages;
{
"name": "stylelint-z-index-value-constraint",
"version": "1.1.0",
"version": "1.2.0",
"description": "Stylelint rule for setting minimum and maximum constraint value for z-index.",

@@ -26,15 +26,16 @@ "main": "index.js",

"peerDependencies": {
"stylelint": "^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.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"
},
"devDependencies": {
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"babel-eslint": "^10.1.0",
"eslint": "^7.31.0",
"eslint-plugin-sort-requires": "^2.1.0",
"husky": "^1.3.1",
"jest": "^24.7.1",
"jest-cli": "^24.7.1",
"lint-staged": "^8.1.5",
"npmpub": "^4.1.0",
"prettier": "^1.17.0",
"stylelint": "^10.0.1"
"husky": "^7.0.1",
"jest": "^27.0.6",
"jest-cli": "^27.0.6",
"jest-preset-stylelint": "^4.2.0",
"lint-staged": "^11.0.1",
"npmpub": "^5.0.0",
"prettier": "^2.3.2",
"stylelint": "^14.1.0"
},

@@ -41,0 +42,0 @@ "engines": {

# stylelint-z-index-value-constraint
[![Greenkeeper badge](https://badges.greenkeeper.io/kristerkari/stylelint-z-index-value-constraint.svg)](https://greenkeeper.io/)
[![NPM version](https://img.shields.io/npm/v/stylelint-z-index-value-constraint.svg)](https://www.npmjs.com/package/stylelint-z-index-value-constraint)
[![Build Status](https://travis-ci.org/kristerkari/stylelint-z-index-value-constraint.svg?branch=master)](https://travis-ci.org/kristerkari/stylelint-z-index-value-constraint)
[![Build status](https://ci.appveyor.com/api/projects/status/uuutq5xq74a8ko4i/branch/master?svg=true)](https://ci.appveyor.com/project/kristerkari/stylelint-z-index-value-constraint/branch/master)
[![Build Status](https://github.com/kristerkari/stylelint-z-index-value-constraint/workflows/Tests/badge.svg)](https://github.com/kristerkari/stylelint-z-index-value-constraint/actions?workflow=Tests)
[![Downloads per month](https://img.shields.io/npm/dm/stylelint-z-index-value-constraint.svg)](http://npmcharts.com/compare/stylelint-z-index-value-constraint)

@@ -9,0 +6,0 @@ [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github)