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

stylelint-less

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylelint-less - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

lib/utils/__tests__/isLessVariable.test.js

5

lib/index.js

@@ -7,11 +7,6 @@ "use strict";

exports["default"] = void 0;
var _stylelint = require("stylelint");
var _rules = _interopRequireDefault(require("./rules"));
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var rulesPlugins = Object.keys(_rules["default"]).map(function (ruleName) {

@@ -18,0 +13,0 @@ return (0, _stylelint.createPlugin)((0, _utils.namespace)(ruleName), _rules["default"][ruleName]);

22

lib/rules/color-hex-case/index.js

@@ -8,19 +8,9 @@ "use strict";

exports.ruleName = exports.messages = void 0;
var _utils = require("../../utils");
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var stylelint = require("stylelint");
var isStandardSyntaxAtRule = require('stylelint/lib/utils/isStandardSyntaxAtRule');
var validateOptions = require('stylelint/lib/utils/validateOptions');
var postcss = require('postcss');
var isLessv = require("stylelint/lib/utils/isLessVariable");
var ruleName = (0, _utils.namespace)("color-hex-case");

@@ -39,3 +29,2 @@ exports.ruleName = ruleName;

var IGNORED_FUNCTIONS = new Set(['url']);
function _default(expectation, options, context) {

@@ -47,11 +36,8 @@ return function (root, result) {

});
if (!validOptions) {
return;
}
root.walkAtRules(function (node) {
var node = postcss.atRule(node);
var r = isLessv(node);
var r = (0, _utils.isLessVariable)(node);
if (!isStandardSyntaxAtRule(node)) {

@@ -86,13 +72,11 @@ if (!(0, _utils.isValidVariable)(node)) {

}
function isIgnoredFunction(_ref) {
var type = _ref.type,
value = _ref.value;
value = _ref.value;
return type === 'function' && IGNORED_FUNCTIONS.has(value.toLowerCase());
}
function isHexColor(_ref2) {
var type = _ref2.type,
value = _ref2.value;
value = _ref2.value;
return type === 'word' && HEX.test(value);
}

@@ -8,15 +8,8 @@ "use strict";

exports.ruleName = exports.messages = void 0;
var _utils = require("../../utils");
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var stylelint = require("stylelint");
var isStandardSyntaxAtRule = require('stylelint/lib/utils/isStandardSyntaxAtRule');
var validateOptions = require('stylelint/lib/utils/validateOptions');
var ruleName = (0, _utils.namespace)("color-no-hex");

@@ -35,3 +28,2 @@ exports.ruleName = ruleName;

var IGNORED_FUNCTIONS = new Set(['url']);
function _default(actual, options) {

@@ -42,7 +34,5 @@ return function (root, result) {

});
if (!validOptions) {
return;
}
root.walkAtRules(function (node) {

@@ -76,13 +66,11 @@ if (!isStandardSyntaxAtRule(node)) {

}
function isIgnoredFunction(_ref) {
var type = _ref.type,
value = _ref.value;
value = _ref.value;
return type === 'function' && IGNORED_FUNCTIONS.has(value.toLowerCase());
}
function isHexColor(_ref2) {
var type = _ref2.type,
value = _ref2.value;
value = _ref2.value;
return type === 'word' && HEX.test(value);
}

@@ -8,15 +8,8 @@ "use strict";

exports.ruleName = exports.messages = void 0;
var _utils = require("../../utils");
var stylelint = require("stylelint");
var isStandardSyntaxAtRule = require('stylelint/lib/utils/isStandardSyntaxAtRule');
var valueParser = require('postcss-value-parser');
var isValidHex = require('stylelint/lib/utils/isValidHex');
var validateOptions = require('stylelint/lib/utils/validateOptions');
var ruleName = (0, _utils.namespace)("color-no-invalid-hex");

@@ -33,3 +26,2 @@ exports.ruleName = ruleName;

exports.messages = messages;
function _default(actual, options) {

@@ -40,7 +32,5 @@ return function (root, result) {

});
if (!validOptions) {
return;
}
root.walkAtRules(function (node) {

@@ -59,4 +49,4 @@ if (!isStandardSyntaxAtRule(node)) {

var value = _ref.value,
type = _ref.type,
sourceIndex = _ref.sourceIndex;
type = _ref.type,
sourceIndex = _ref.sourceIndex;
if (type === 'function' && value.endsWith('url')) return false;

@@ -81,3 +71,2 @@ if (type !== 'word') return;

}
;

@@ -7,13 +7,7 @@ "use strict";

exports["default"] = void 0;
var _colorNoHex = _interopRequireDefault(require("./color-no-hex"));
var _colorNoInvalidHex = _interopRequireDefault(require("./color-no-invalid-hex"));
var _colorHexCase = _interopRequireDefault(require("./color-hex-case"));
var _noDuplicateVariables = _interopRequireDefault(require("./no-duplicate-variables"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _default = {

@@ -20,0 +14,0 @@ "color-no-hex": _colorNoHex["default"],

@@ -8,11 +8,6 @@ "use strict";

exports.ruleName = exports.messages = void 0;
var _utils = require("../../utils");
var stylelint = require("stylelint");
var isStandardSyntaxAtRule = require('stylelint/lib/utils/isStandardSyntaxAtRule');
var validateOptions = require('stylelint/lib/utils/validateOptions');
var ruleName = (0, _utils.namespace)("no-duplicate-variables");

@@ -29,3 +24,2 @@ exports.ruleName = ruleName;

exports.messages = messages;
function _default(actual, options) {

@@ -36,7 +30,5 @@ return function (root, result) {

});
if (!validOptions) {
return;
}
var globalVariables = [];

@@ -56,3 +48,3 @@ root.walkRules(function (rule) {

});
} else if(!node.mixin){
} else {
if (variables.includes(node.name)) {

@@ -59,0 +51,0 @@ stylelint.utils.report({

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

});
Object.defineProperty(exports, "isLessVariable", {
enumerable: true,
get: function get() {
return _isLessVariable["default"];
}
});
Object.defineProperty(exports, "isValidVariable", {

@@ -19,7 +25,5 @@ enumerable: true,

});
var _namespace = _interopRequireDefault(require("./namespace"));
var _isValidVariable = _interopRequireDefault(require("./isValidVariable"));
var _isLessVariable = _interopRequireDefault(require("./isLessVariable"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -7,3 +7,2 @@ "use strict";

exports["default"] = isValidVariable;
/**

@@ -16,8 +15,12 @@ * Check whether the atrule is valid less variable.

*/
function isValidVariable(atRule) {
if (('variable' in atRule && atRule.raws.afterName.includes(":") || atRule.mixin) || atRule.params.includes('(')) {
// support `each` - http://lesscss.org/functions/#list-functions-each
if (atRule.name === 'each') {
return true;
}
if ('variable' in atRule && atRule.raws.afterName.includes(":") || atRule.mixin) {
return true;
}
return false;
}

@@ -8,5 +8,4 @@ "use strict";

var prefix = "less";
function namespace(ruleName) {
return "".concat(prefix, "/").concat(ruleName);
}
{
"name": "stylelint-less",
"version": "1.0.7",
"version": "1.0.8",
"description": "A collection of Less specific rules for stylelint",

@@ -13,3 +13,4 @@ "babel": {

"prebuild": "rimraf lib",
"build": "babel src --out-dir lib"
"build": "babel src --out-dir lib",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
},

@@ -21,3 +22,3 @@ "dependencies": {

"peerDependencies": {
"stylelint": "^15.9.0"
"stylelint": "^15.10.1"
},

@@ -29,3 +30,5 @@ "devDependencies": {

"babel-plugin-istanbul": "^6.0.0",
"babel-preset-jest": "^25.5.0"
"babel-preset-jest": "^25.5.0",
"jest": "^29.6.0",
"postcss-less": "^6.0.0"
},

@@ -32,0 +35,0 @@ "author": {

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