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

stylelint-suitcss

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylelint-suitcss - npm Package Compare versions

Comparing version 4.0.0 to 5.0.0

4

CHANGELOG.md
### HEAD
### 5.0.0 (17 January, 2022)
* Update `stylelint` to `14.2.0`
### 4.0.0 (August 3, 2021)

@@ -4,0 +8,0 @@

8

index.js
'use strict';
const createPlugin = require('stylelint').createPlugin;
const namespace = require('./utils/namespace');
const rules = require('./rules');
const rulesPlugins = Object.keys(rules).map(ruleName => {
return createPlugin(namespace(ruleName), rules[ruleName]);
});
module.exports = rulesPlugins;
module.exports = Object.values(rules);
'use strict';
const test = require('ava');
const find = require('lodash.find');
const rule = require('./');
test('root-no-standard-properties should exist', t => {
t.truthy(find(rule, {ruleName: 'suitcss/root-no-standard-properties'}));
test('root-no-standard-properties should exist', () => {
expect(find(rule, {ruleName: 'suitcss/root-no-standard-properties'})).toBeTruthy();
});
test('selector-root-no-composition should exist', t => {
t.truthy(find(rule, {ruleName: 'suitcss/selector-root-no-composition'}));
test('selector-root-no-composition should exist', () => {
expect(find(rule, {ruleName: 'suitcss/selector-root-no-composition'})).toBeTruthy();
});
test('custom-property-no-outside-root should exist', t => {
t.truthy(find(rule, {ruleName: 'suitcss/custom-property-no-outside-root'}));
test('custom-property-no-outside-root should exist', () => {
expect(find(rule, {ruleName: 'suitcss/custom-property-no-outside-root'})).toBeTruthy();
});
{
"name": "stylelint-suitcss",
"version": "4.0.0",
"version": "5.0.0",
"description": "A collection of stylelint plugins for SUIT CSS",

@@ -21,6 +21,13 @@ "keywords": [

"main": "index.js",
"jest": {
"preset": "jest-preset-stylelint",
"testMatch": [
"**/index.test.js",
"**/rules/**/test/*.js"
]
},
"scripts": {
"lint": "eslint rules utils",
"pretest": "yarn lint",
"test": "ava index.test.js **/test/*.js"
"test": "jest "
},

@@ -30,13 +37,11 @@ "author": "Simon Smith",

"devDependencies": {
"ava": "^3.15.0",
"eslint": "^7.32.0",
"stylelint-test-rule-ava": "^0.2.0"
"jest": "^27.4.7",
"eslint": "^8.6.0",
"jest-preset-stylelint": "^4.2.0"
},
"dependencies": {
"lodash.find": "^4.6.0",
"postcss-selector-parser": "^6.0.6"
},
"peerDependencies": {
"stylelint": "^13.13.1"
"postcss-selector-parser": "^6.0.8",
"stylelint": "^14.2.0"
}
}
# stylelint-suitcss
[![NPM version](http://img.shields.io/npm/v/stylelint-suitcss.svg)](https://www.npmjs.org/package/stylelint-suitcss) [![Build Status](https://github.com/suitcss/stylelint-suitcss/actions/workflows/ci.yml/badge.svg)](https://github.com/suitcss/stylelint-suitcss/actions/workflows/ci.yml)
[![NPM version](http://img.shields.io/npm/v/stylelint-suitcss.svg)](https://www.npmjs.com/package/stylelint-suitcss) [![Build Status](https://github.com/suitcss/stylelint-suitcss/actions/workflows/ci.yml/badge.svg)](https://github.com/suitcss/stylelint-suitcss/actions/workflows/ci.yml)

@@ -5,0 +5,0 @@ A collection of [stylelint](https://stylelint.io/) plugins for SUIT CSS.

@@ -12,33 +12,34 @@ 'use strict';

function rule(actual) {
return function(root, result) {
const validOptions = stylelint.utils.validateOptions(result, ruleName, {actual});
if (!validOptions) {
return;
}
root.walkRules(rule => {
// Ignore rules whose selector is just `:root`
if (rule.selector.toLowerCase().trim() === ':root') {
module.exports = stylelint.createPlugin(
ruleName,
function(actual) {
return (root, result) => {
const validOptions = stylelint.utils.validateOptions(result, ruleName, {actual});
if (!validOptions) {
return;
}
rule.walkDecls(decl => {
if (!isCustomProperty(decl.prop)) {
root.walkRules(rule => {
// Ignore rules whose selector is just `:root`
if (rule.selector.toLowerCase().trim() === ':root') {
return;
}
stylelint.utils.report({
message: messages.rejected,
node: decl,
result,
ruleName,
rule.walkDecls(decl => {
if (!isCustomProperty(decl.prop)) {
return;
}
stylelint.utils.report({
message: messages.rejected,
node: decl,
result,
ruleName,
});
});
});
});
};
}
};
}
);
rule.ruleName = ruleName;
rule.messages = messages;
module.exports = rule;
module.exports.ruleName = ruleName;
module.exports.messages = messages;
'use strict';
const testRule = require('stylelint-test-rule-ava');
const rule = require('..');
const {ruleName, messages} = require('..');
const messages = rule.messages;
const ruleName = rule.ruleName;
testRule(rule, {
testRule({
plugins: ['./rules/custom-property-no-outside-root/index.js'],
ruleName,

@@ -11,0 +8,0 @@ config: [true],

@@ -14,45 +14,48 @@ 'use strict';

const rule = function(actual) {
return (root, result) => {
const validOptions = stylelint.utils.validateOptions(result, ruleName, {actual});
if (!validOptions) {
return;
}
root.walkRules(rule => {
if (rule.selector.toLowerCase().indexOf(':root') === -1) {
module.exports = stylelint.createPlugin(
ruleName,
function(actual) {
return (root, result) => {
const validOptions = stylelint.utils.validateOptions(result, ruleName, {actual});
if (!validOptions) {
return;
}
parseSelector(rule.selector, result, rule, checkSelector);
function checkSelector(selectorAST) {
if (ignoreRule(selectorAST)) {
root.walkRules(rule => {
if (rule.selector.toLowerCase().indexOf(':root') === -1) {
return;
}
parseSelector(rule.selector, result, rule, checkSelector);
rule.each(function(node) {
if (node.type !== 'decl') {
function checkSelector(selectorAST) {
if (ignoreRule(selectorAST)) {
return;
}
const prop = node.prop;
rule.each(function(node) {
if (node.type !== 'decl') {
return;
}
if (!isStandardSyntaxProperty(prop)) {
return;
}
if (isCustomProperty(prop)) {
return;
}
const prop = node.prop;
stylelint.utils.report({
message: messages.rejected(prop),
node,
result,
ruleName,
if (!isStandardSyntaxProperty(prop)) {
return;
}
if (isCustomProperty(prop)) {
return;
}
stylelint.utils.report({
message: messages.rejected(prop),
node,
result,
ruleName,
});
});
});
}
});
};
};
}
});
};
}
);

@@ -70,4 +73,3 @@ function ignoreRule(selectorAST) {

rule.ruleName = ruleName;
rule.messages = messages;
module.exports = rule;
module.exports.ruleName = ruleName;
module.exports.messages = messages;
'use strict';
const testRule = require('stylelint-test-rule-ava');
const rule = require('..');
const {ruleName, messages} = require('..');
const messages = rule.messages;
const ruleName = rule.ruleName;
testRule(rule, {
testRule({
plugins: ['./rules/root-no-standard-properties/index.js'],
ruleName,

@@ -11,0 +8,0 @@ config: [true],

@@ -11,26 +11,28 @@ 'use strict';

function rule(actual) {
return (root, result) => {
const validOptions = stylelint.utils.validateOptions(result, ruleName, {actual});
if (!validOptions) {
return;
}
root.walkRules(rule => {
if (rule.selector.toLowerCase().indexOf(':root') === -1 || rule.selector.toLowerCase().trim() === ':root') {
module.exports = stylelint.createPlugin(
ruleName,
function(actual) {
return (root, result) => {
const validOptions = stylelint.utils.validateOptions(result, ruleName, {actual});
if (!validOptions) {
return;
}
stylelint.utils.report({
message: messages.rejected,
node: rule,
result,
ruleName,
root.walkRules(rule => {
if (rule.selector.toLowerCase().indexOf(':root') === -1 || rule.selector.toLowerCase().trim() === ':root') {
return;
}
stylelint.utils.report({
message: messages.rejected,
node: rule,
result,
ruleName,
});
});
});
};
}
};
}
);
rule.ruleName = ruleName;
rule.messages = messages;
module.exports = rule;
module.exports.ruleName = ruleName;
module.exports.messages = messages;
'use strict';
const testRule = require('stylelint-test-rule-ava');
const rule = require('..');
const {ruleName, messages} = require('..');
const messages = rule.messages;
const ruleName = rule.ruleName;
testRule(rule, {
testRule({
plugins: ['./rules/selector-root-no-composition/index.js'],
ruleName,

@@ -11,0 +8,0 @@ config: [true],

Sorry, the diff of this file is not supported yet

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