stablekit.ts 0.6.3 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/stylelint.cjs +1 -63
- package/dist/stylelint.d.cts +1 -1
- package/dist/stylelint.d.ts +1 -1
- package/dist/stylelint.js +1 -63
- package/package.json +1 -1
package/dist/stylelint.cjs
CHANGED
|
@@ -5856,7 +5856,6 @@ module.exports = __toCommonJS(stylelint_exports);
|
|
|
5856
5856
|
var pluginRuleName = "stablekit/no-functional-in-utility";
|
|
5857
5857
|
var descendantColorRuleName = "stablekit/no-descendant-color-in-state";
|
|
5858
5858
|
var duplicateRulesetRuleName = "stablekit/no-duplicate-ruleset";
|
|
5859
|
-
var nearDuplicateRuleName = "stablekit/no-near-duplicate-ruleset";
|
|
5860
5859
|
var undefinedTokenRuleName = "stablekit/no-undefined-token";
|
|
5861
5860
|
function createFunctionalTokenPlugin(prefixes) {
|
|
5862
5861
|
const rule = (enabled) => {
|
|
@@ -5950,65 +5949,6 @@ Declarations: ${fingerprint}`,
|
|
|
5950
5949
|
rule
|
|
5951
5950
|
};
|
|
5952
5951
|
}
|
|
5953
|
-
function createNearDuplicatePlugin() {
|
|
5954
|
-
function collectDirectDecls(ruleNode) {
|
|
5955
|
-
const map = /* @__PURE__ */ new Map();
|
|
5956
|
-
for (const child of ruleNode.nodes ?? []) {
|
|
5957
|
-
if (child.type === "decl") {
|
|
5958
|
-
map.set(child.prop, child.value);
|
|
5959
|
-
} else if (child.type === "atrule" && child.name === "apply") {
|
|
5960
|
-
map.set(`@apply`, child.params);
|
|
5961
|
-
}
|
|
5962
|
-
}
|
|
5963
|
-
return map;
|
|
5964
|
-
}
|
|
5965
|
-
const rule = (enabled) => {
|
|
5966
|
-
return (root, result) => {
|
|
5967
|
-
if (!enabled) return;
|
|
5968
|
-
const groups = /* @__PURE__ */ new Map();
|
|
5969
|
-
root.walkRules((ruleNode) => {
|
|
5970
|
-
if (ruleNode.parent?.type === "atrule" && ruleNode.parent.name === "keyframes") return;
|
|
5971
|
-
const propMap = collectDirectDecls(ruleNode);
|
|
5972
|
-
if (propMap.size < 2) return;
|
|
5973
|
-
const propKey = [...propMap.keys()].sort().join(", ");
|
|
5974
|
-
const entry = { selector: ruleNode.selector, propKey, propMap, node: ruleNode };
|
|
5975
|
-
const group = groups.get(propKey);
|
|
5976
|
-
if (group) {
|
|
5977
|
-
for (const existing of group) {
|
|
5978
|
-
let diffCount = 0;
|
|
5979
|
-
let diffProp = "";
|
|
5980
|
-
let diffOld = "";
|
|
5981
|
-
let diffNew = "";
|
|
5982
|
-
for (const [prop, value] of entry.propMap) {
|
|
5983
|
-
const existingValue = existing.propMap.get(prop);
|
|
5984
|
-
if (existingValue !== value) {
|
|
5985
|
-
diffCount++;
|
|
5986
|
-
diffProp = prop;
|
|
5987
|
-
diffOld = existingValue ?? "(missing)";
|
|
5988
|
-
diffNew = value;
|
|
5989
|
-
}
|
|
5990
|
-
}
|
|
5991
|
-
if (diffCount === 0) continue;
|
|
5992
|
-
if (diffCount === 1 && diffProp !== "@apply") {
|
|
5993
|
-
result.warn(
|
|
5994
|
-
`Near-duplicate ruleset \u2014 "${ruleNode.selector}" differs from "${existing.selector}" only in ${diffProp} (${diffOld} \u2192 ${diffNew}). Consider consolidating to a single class.`,
|
|
5995
|
-
{ node: ruleNode }
|
|
5996
|
-
);
|
|
5997
|
-
break;
|
|
5998
|
-
}
|
|
5999
|
-
}
|
|
6000
|
-
group.push(entry);
|
|
6001
|
-
} else {
|
|
6002
|
-
groups.set(propKey, [entry]);
|
|
6003
|
-
}
|
|
6004
|
-
});
|
|
6005
|
-
};
|
|
6006
|
-
};
|
|
6007
|
-
return {
|
|
6008
|
-
ruleName: nearDuplicateRuleName,
|
|
6009
|
-
rule
|
|
6010
|
-
};
|
|
6011
|
-
}
|
|
6012
5952
|
function createUndefinedTokenPlugin(runtimePrefixes) {
|
|
6013
5953
|
const varPattern = /var\(--([a-zA-Z0-9_-]+)/g;
|
|
6014
5954
|
const rule = (enabled) => {
|
|
@@ -6055,7 +5995,7 @@ function createStyleLint(options = {}) {
|
|
|
6055
5995
|
runtimeTokens = [],
|
|
6056
5996
|
files = ["src/**/*.css"]
|
|
6057
5997
|
} = options;
|
|
6058
|
-
const plugins = [createDescendantColorPlugin(), createDuplicateRulesetPlugin(),
|
|
5998
|
+
const plugins = [createDescendantColorPlugin(), createDuplicateRulesetPlugin(), createUndefinedTokenPlugin(runtimeTokens)];
|
|
6059
5999
|
if (functionalTokens.length > 0) {
|
|
6060
6000
|
plugins.push(createFunctionalTokenPlugin(functionalTokens));
|
|
6061
6001
|
}
|
|
@@ -6073,8 +6013,6 @@ function createStyleLint(options = {}) {
|
|
|
6073
6013
|
[descendantColorRuleName]: true,
|
|
6074
6014
|
// Flag selectors with identical declarations for consolidation.
|
|
6075
6015
|
[duplicateRulesetRuleName]: true,
|
|
6076
|
-
// Flag near-duplicate rulesets (same props, differ by 1 value).
|
|
6077
|
-
[nearDuplicateRuleName]: true,
|
|
6078
6016
|
// Flag var() references to custom properties not defined in this file.
|
|
6079
6017
|
[undefinedTokenRuleName]: true,
|
|
6080
6018
|
// Ban animating layout properties — causes reflow on every frame.
|
package/dist/stylelint.d.cts
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* top/right/bottom/left). These trigger reflow on every frame.
|
|
28
28
|
* Use transform (scaleY, translateY) or opacity instead.
|
|
29
29
|
*
|
|
30
|
-
* 6. Don't duplicate rulesets — two selectors with
|
|
30
|
+
* 6. Don't duplicate rulesets — two selectors with identical
|
|
31
31
|
* declarations (after sorting) should be consolidated under one
|
|
32
32
|
* shared class name. The warning includes the matched declarations
|
|
33
33
|
* so the developer can see why they were flagged.
|
package/dist/stylelint.d.ts
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* top/right/bottom/left). These trigger reflow on every frame.
|
|
28
28
|
* Use transform (scaleY, translateY) or opacity instead.
|
|
29
29
|
*
|
|
30
|
-
* 6. Don't duplicate rulesets — two selectors with
|
|
30
|
+
* 6. Don't duplicate rulesets — two selectors with identical
|
|
31
31
|
* declarations (after sorting) should be consolidated under one
|
|
32
32
|
* shared class name. The warning includes the matched declarations
|
|
33
33
|
* so the developer can see why they were flagged.
|
package/dist/stylelint.js
CHANGED
|
@@ -5833,7 +5833,6 @@ var require_postcss = __commonJS({
|
|
|
5833
5833
|
var pluginRuleName = "stablekit/no-functional-in-utility";
|
|
5834
5834
|
var descendantColorRuleName = "stablekit/no-descendant-color-in-state";
|
|
5835
5835
|
var duplicateRulesetRuleName = "stablekit/no-duplicate-ruleset";
|
|
5836
|
-
var nearDuplicateRuleName = "stablekit/no-near-duplicate-ruleset";
|
|
5837
5836
|
var undefinedTokenRuleName = "stablekit/no-undefined-token";
|
|
5838
5837
|
function createFunctionalTokenPlugin(prefixes) {
|
|
5839
5838
|
const rule = (enabled) => {
|
|
@@ -5927,65 +5926,6 @@ Declarations: ${fingerprint}`,
|
|
|
5927
5926
|
rule
|
|
5928
5927
|
};
|
|
5929
5928
|
}
|
|
5930
|
-
function createNearDuplicatePlugin() {
|
|
5931
|
-
function collectDirectDecls(ruleNode) {
|
|
5932
|
-
const map = /* @__PURE__ */ new Map();
|
|
5933
|
-
for (const child of ruleNode.nodes ?? []) {
|
|
5934
|
-
if (child.type === "decl") {
|
|
5935
|
-
map.set(child.prop, child.value);
|
|
5936
|
-
} else if (child.type === "atrule" && child.name === "apply") {
|
|
5937
|
-
map.set(`@apply`, child.params);
|
|
5938
|
-
}
|
|
5939
|
-
}
|
|
5940
|
-
return map;
|
|
5941
|
-
}
|
|
5942
|
-
const rule = (enabled) => {
|
|
5943
|
-
return (root, result) => {
|
|
5944
|
-
if (!enabled) return;
|
|
5945
|
-
const groups = /* @__PURE__ */ new Map();
|
|
5946
|
-
root.walkRules((ruleNode) => {
|
|
5947
|
-
if (ruleNode.parent?.type === "atrule" && ruleNode.parent.name === "keyframes") return;
|
|
5948
|
-
const propMap = collectDirectDecls(ruleNode);
|
|
5949
|
-
if (propMap.size < 2) return;
|
|
5950
|
-
const propKey = [...propMap.keys()].sort().join(", ");
|
|
5951
|
-
const entry = { selector: ruleNode.selector, propKey, propMap, node: ruleNode };
|
|
5952
|
-
const group = groups.get(propKey);
|
|
5953
|
-
if (group) {
|
|
5954
|
-
for (const existing of group) {
|
|
5955
|
-
let diffCount = 0;
|
|
5956
|
-
let diffProp = "";
|
|
5957
|
-
let diffOld = "";
|
|
5958
|
-
let diffNew = "";
|
|
5959
|
-
for (const [prop, value] of entry.propMap) {
|
|
5960
|
-
const existingValue = existing.propMap.get(prop);
|
|
5961
|
-
if (existingValue !== value) {
|
|
5962
|
-
diffCount++;
|
|
5963
|
-
diffProp = prop;
|
|
5964
|
-
diffOld = existingValue ?? "(missing)";
|
|
5965
|
-
diffNew = value;
|
|
5966
|
-
}
|
|
5967
|
-
}
|
|
5968
|
-
if (diffCount === 0) continue;
|
|
5969
|
-
if (diffCount === 1 && diffProp !== "@apply") {
|
|
5970
|
-
result.warn(
|
|
5971
|
-
`Near-duplicate ruleset \u2014 "${ruleNode.selector}" differs from "${existing.selector}" only in ${diffProp} (${diffOld} \u2192 ${diffNew}). Consider consolidating to a single class.`,
|
|
5972
|
-
{ node: ruleNode }
|
|
5973
|
-
);
|
|
5974
|
-
break;
|
|
5975
|
-
}
|
|
5976
|
-
}
|
|
5977
|
-
group.push(entry);
|
|
5978
|
-
} else {
|
|
5979
|
-
groups.set(propKey, [entry]);
|
|
5980
|
-
}
|
|
5981
|
-
});
|
|
5982
|
-
};
|
|
5983
|
-
};
|
|
5984
|
-
return {
|
|
5985
|
-
ruleName: nearDuplicateRuleName,
|
|
5986
|
-
rule
|
|
5987
|
-
};
|
|
5988
|
-
}
|
|
5989
5929
|
function createUndefinedTokenPlugin(runtimePrefixes) {
|
|
5990
5930
|
const varPattern = /var\(--([a-zA-Z0-9_-]+)/g;
|
|
5991
5931
|
const rule = (enabled) => {
|
|
@@ -6032,7 +5972,7 @@ function createStyleLint(options = {}) {
|
|
|
6032
5972
|
runtimeTokens = [],
|
|
6033
5973
|
files = ["src/**/*.css"]
|
|
6034
5974
|
} = options;
|
|
6035
|
-
const plugins = [createDescendantColorPlugin(), createDuplicateRulesetPlugin(),
|
|
5975
|
+
const plugins = [createDescendantColorPlugin(), createDuplicateRulesetPlugin(), createUndefinedTokenPlugin(runtimeTokens)];
|
|
6036
5976
|
if (functionalTokens.length > 0) {
|
|
6037
5977
|
plugins.push(createFunctionalTokenPlugin(functionalTokens));
|
|
6038
5978
|
}
|
|
@@ -6050,8 +5990,6 @@ function createStyleLint(options = {}) {
|
|
|
6050
5990
|
[descendantColorRuleName]: true,
|
|
6051
5991
|
// Flag selectors with identical declarations for consolidation.
|
|
6052
5992
|
[duplicateRulesetRuleName]: true,
|
|
6053
|
-
// Flag near-duplicate rulesets (same props, differ by 1 value).
|
|
6054
|
-
[nearDuplicateRuleName]: true,
|
|
6055
5993
|
// Flag var() references to custom properties not defined in this file.
|
|
6056
5994
|
[undefinedTokenRuleName]: true,
|
|
6057
5995
|
// Ban animating layout properties — causes reflow on every frame.
|
package/package.json
CHANGED