stylelint-suitcss
Advanced tools
Comparing version 4.0.0 to 5.0.0
### HEAD | ||
### 5.0.0 (17 January, 2022) | ||
* Update `stylelint` to `14.2.0` | ||
### 4.0.0 (August 3, 2021) | ||
@@ -4,0 +8,0 @@ |
'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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
19098
0
438
+ Addedstylelint@^14.2.0
+ Added@csstools/selector-specificity@2.2.0(transitive)
+ Addedcolord@2.9.3(transitive)
+ Addedcss-functions-list@3.2.3(transitive)
+ Addedis-plain-object@5.0.0(transitive)
+ Addedknown-css-properties@0.26.0(transitive)
+ Addednanoid@3.3.7(transitive)
+ Addednormalize-path@3.0.0(transitive)
+ Addedpostcss@8.4.49(transitive)
+ Addedpostcss-safe-parser@6.0.0(transitive)
+ Addedsource-map-js@1.2.1(transitive)
+ Addedstylelint@14.16.1(transitive)
+ Addedsupports-hyperlinks@2.3.0(transitive)
+ Addedwrite-file-atomic@4.0.2(transitive)
- Removed@ampproject/remapping@2.3.0(transitive)
- Removed@babel/compat-data@7.26.2(transitive)
- Removed@babel/core@7.26.0(transitive)
- Removed@babel/generator@7.26.2(transitive)
- Removed@babel/helper-compilation-targets@7.25.9(transitive)
- Removed@babel/helper-module-imports@7.25.9(transitive)
- Removed@babel/helper-module-transforms@7.26.0(transitive)
- Removed@babel/helper-string-parser@7.25.9(transitive)
- Removed@babel/helper-validator-option@7.25.9(transitive)
- Removed@babel/helpers@7.26.0(transitive)
- Removed@babel/parser@7.26.2(transitive)
- Removed@babel/template@7.25.9(transitive)
- Removed@babel/traverse@7.25.9(transitive)
- Removed@babel/types@7.26.0(transitive)
- Removed@jridgewell/gen-mapping@0.3.5(transitive)
- Removed@jridgewell/resolve-uri@3.1.2(transitive)
- Removed@jridgewell/set-array@1.2.1(transitive)
- Removed@jridgewell/sourcemap-codec@1.5.0(transitive)
- Removed@jridgewell/trace-mapping@0.3.25(transitive)
- Removed@stylelint/postcss-css-in-js@0.37.3(transitive)
- Removed@stylelint/postcss-markdown@0.36.2(transitive)
- Removed@types/mdast@3.0.15(transitive)
- Removed@types/unist@2.0.11(transitive)
- Removedautoprefixer@9.8.8(transitive)
- Removedbail@1.0.5(transitive)
- Removedbrowserslist@4.24.2(transitive)
- Removedcaniuse-lite@1.0.30001680(transitive)
- Removedchalk@4.1.2(transitive)
- Removedcharacter-entities@1.2.4(transitive)
- Removedcharacter-entities-legacy@1.1.4(transitive)
- Removedcharacter-reference-invalid@1.1.4(transitive)
- Removedclone-regexp@2.2.0(transitive)
- Removedconvert-source-map@2.0.0(transitive)
- Removeddom-serializer@0.2.2(transitive)
- Removeddomelementtype@1.3.12.3.0(transitive)
- Removeddomhandler@2.4.2(transitive)
- Removeddomutils@1.7.0(transitive)
- Removedelectron-to-chromium@1.5.55(transitive)
- Removedentities@1.1.22.2.0(transitive)
- Removedescalade@3.2.0(transitive)
- Removedexecall@2.0.0(transitive)
- Removedextend@3.0.2(transitive)
- Removedgensync@1.0.0-beta.2(transitive)
- Removedget-stdin@8.0.0(transitive)
- Removedglobals@11.12.0(transitive)
- Removedgonzales-pe@4.3.0(transitive)
- Removedhtmlparser2@3.10.1(transitive)
- Removedis-alphabetical@1.0.4(transitive)
- Removedis-alphanumerical@1.0.4(transitive)
- Removedis-buffer@2.0.5(transitive)
- Removedis-decimal@1.0.4(transitive)
- Removedis-hexadecimal@1.0.4(transitive)
- Removedis-plain-obj@2.1.0(transitive)
- Removedis-regexp@2.1.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedis-unicode-supported@0.1.0(transitive)
- Removedjsesc@3.0.2(transitive)
- Removedjson5@2.2.3(transitive)
- Removedknown-css-properties@0.21.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedlog-symbols@4.1.0(transitive)
- Removedlongest-streak@2.0.4(transitive)
- Removedlru-cache@5.1.1(transitive)
- Removedmdast-util-from-markdown@0.8.5(transitive)
- Removedmdast-util-to-markdown@0.6.5(transitive)
- Removedmdast-util-to-string@2.0.0(transitive)
- Removedmicromark@2.11.4(transitive)
- Removedminimist@1.2.8(transitive)
- Removednode-releases@2.0.18(transitive)
- Removednormalize-range@0.1.2(transitive)
- Removednormalize-selector@0.2.0(transitive)
- Removednum2fraction@1.2.2(transitive)
- Removedparse-entities@2.0.0(transitive)
- Removedpicocolors@0.2.1(transitive)
- Removedpostcss@7.0.39(transitive)
- Removedpostcss-html@0.36.0(transitive)
- Removedpostcss-less@3.1.4(transitive)
- Removedpostcss-safe-parser@4.0.2(transitive)
- Removedpostcss-sass@0.4.4(transitive)
- Removedpostcss-scss@2.1.1(transitive)
- Removedpostcss-syntax@0.36.2(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedremark@13.0.0(transitive)
- Removedremark-parse@9.0.0(transitive)
- Removedremark-stringify@9.0.1(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsemver@6.3.1(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedspecificity@0.4.1(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedstylelint@13.13.1(transitive)
- Removedsugarss@2.0.0(transitive)
- Removedtrough@1.0.5(transitive)
- Removedtypedarray-to-buffer@3.1.5(transitive)
- Removedunified@9.2.2(transitive)
- Removedunist-util-find-all-after@3.0.2(transitive)
- Removedunist-util-is@4.1.0(transitive)
- Removedunist-util-stringify-position@2.0.3(transitive)
- Removedupdate-browserslist-db@1.1.1(transitive)
- Removedvfile@4.2.1(transitive)
- Removedvfile-message@2.0.4(transitive)
- Removedwrite-file-atomic@3.0.3(transitive)
- Removedyallist@3.1.1(transitive)
- Removedzwitch@1.0.5(transitive)