stylelint-config-silverwind 35.0.2 → 35.0.3

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.
Files changed (2) hide show
  1. package/dist/index.js +60 -6
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -8898,7 +8898,7 @@ function resolveId(id2, basedir, {
8898
8898
  });
8899
8899
  }
8900
8900
  async function getCustomPropertiesFromRoot(root2, resolver) {
8901
- let customProperties = {};
8901
+ let customProperties = Object(null);
8902
8902
  let sourceDir = process.cwd();
8903
8903
  if (root2.source && root2.source.input && root2.source.input.file) {
8904
8904
  sourceDir = path$2.dirname(root2.source.input.file);
@@ -8921,6 +8921,59 @@ async function getCustomPropertiesFromRoot(root2, resolver) {
8921
8921
  importPromises.push(promise);
8922
8922
  }
8923
8923
  });
8924
+ root2.walkAtRules("property", (atRule2) => {
8925
+ const nodes = valueParser(atRule2.params).nodes;
8926
+ const names = [];
8927
+ for (let i2 = 0; i2 < nodes.length; i2++) {
8928
+ let node2 = nodes[i2];
8929
+ if (node2.type === "word" && node2.value.startsWith("--")) {
8930
+ names.push(node2.value);
8931
+ while (!(node2.type === "div" && node2.value === ",")) {
8932
+ i2++;
8933
+ node2 = nodes[i2];
8934
+ if (!node2) {
8935
+ break;
8936
+ }
8937
+ }
8938
+ }
8939
+ }
8940
+ const atProperty = {
8941
+ inherits: void 0,
8942
+ syntax: void 0,
8943
+ initialValue: void 0
8944
+ };
8945
+ atRule2.each((descriptor) => {
8946
+ if (descriptor.type !== "decl") {
8947
+ return;
8948
+ }
8949
+ switch (descriptor.prop) {
8950
+ case "initial-value":
8951
+ atProperty.initialValue = descriptor.value;
8952
+ return;
8953
+ case "syntax":
8954
+ atProperty.syntax = descriptor.value.trim();
8955
+ break;
8956
+ case "inherits":
8957
+ atProperty.inherits = descriptor.value.trim();
8958
+ break;
8959
+ }
8960
+ });
8961
+ if (typeof atProperty.inherits === "undefined" || typeof atProperty.syntax === "undefined") {
8962
+ return;
8963
+ }
8964
+ if (atProperty.syntax === "*" || atProperty.syntax === "'*'" || atProperty.syntax === '"*"') {
8965
+ names.forEach((name) => {
8966
+ customProperties[name] = {};
8967
+ });
8968
+ return;
8969
+ }
8970
+ if (typeof atProperty.initialValue === "undefined") {
8971
+ return;
8972
+ }
8973
+ names.forEach((name) => {
8974
+ customProperties[name] = {};
8975
+ });
8976
+ });
8924
8977
  (await Promise.all(importPromises)).forEach((propertiesFromImport) => {
8925
8978
  customProperties = Object.assign(customProperties, propertiesFromImport);
8926
8979
  });
@@ -8928,7 +8981,7 @@ async function getCustomPropertiesFromRoot(root2, resolver) {
8928
8981
  if (!decl.variable || !decl.prop.startsWith("--")) {
8929
8982
  return;
8930
8983
  }
8931
- customProperties[decl.prop] = decl.value;
8984
+ customProperties[decl.prop] = {};
8932
8985
  });
8933
8986
  return customProperties;
8934
8987
  }
@@ -9050,7 +9103,8 @@ const validateValueAST = (ast, { result: result2, customProperties, decl }) => {
9050
9103
  return;
9051
9104
  }
9052
9105
  stylelint.utils.report({
9053
- message: messages$1d.unexpected(propertyName, decl.prop),
9106
+ message: messages$1d.unexpected,
9107
+ messageArgs: [propertyName, decl.prop],
9054
9108
  node: decl,
9055
9109
  result: result2,
9056
9110
  ruleName: ruleName$1d,
@@ -9060,8 +9114,8 @@ const validateValueAST = (ast, { result: result2, customProperties, decl }) => {
9060
9114
  });
9061
9115
  };
9062
9116
  const isVarFunction = (node2) => node2.type === "function" && node2.value === "var" && node2.nodes[0].value.startsWith("--");
9063
- const validateResult = (result2, customProperties) => {
9064
- result2.root.walkDecls((decl) => {
9117
+ const validateResult = (root2, result2, customProperties) => {
9118
+ root2.walkDecls((decl) => {
9065
9119
  if (hasCustomPropertyReference(decl)) {
9066
9120
  validateDecl(decl, { result: result2, customProperties });
9067
9121
  }
@@ -9088,7 +9142,7 @@ const ruleFunction = (method, opts) => {
9088
9142
  await customPropertiesPromise,
9089
9143
  await getCustomPropertiesFromRoot(root2, resolver)
9090
9144
  );
9091
- validateResult(result2, customProperties);
9145
+ validateResult(root2, result2, customProperties);
9092
9146
  }
9093
9147
  };
9094
9148
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stylelint-config-silverwind",
3
- "version": "35.0.2",
3
+ "version": "35.0.3",
4
4
  "description": "Extensive stylelint configuration",
5
5
  "author": "silverwind <me@silverwind.io>",
6
6
  "repository": "silverwind/stylelint-config-silverwind",
@@ -25,10 +25,10 @@
25
25
  "stylelint": "17.0.0",
26
26
  "stylelint-declaration-block-no-ignored-properties": "2.8.0",
27
27
  "stylelint-declaration-strict-value": "1.10.11",
28
- "stylelint-value-no-unknown-custom-properties": "6.0.1",
28
+ "stylelint-value-no-unknown-custom-properties": "6.1.1",
29
29
  "typescript": "5.9.3",
30
30
  "typescript-config-silverwind": "14.0.0",
31
- "updates": "17.0.7",
31
+ "updates": "17.0.8",
32
32
  "versions": "14.0.3",
33
33
  "vite": "7.3.1",
34
34
  "vite-config-silverwind": "6.0.8"