mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 16:02:26 +00:00
Run `npm run format` and `npm run lint`. Fix stylelint configuration to correctly parse variables with units in their names. Migrate raw CSS measurements to tokens in `css/tokens.css` and update usages in `css/tailwind.source.css` and HTML templates. Improve `scripts/check-design-tokens.mjs` to handle variable names with unit-like suffixes. Files changed: - css/tailwind.source.css (formatted and fixed lint) - css/tokens.css (added tokens) - stylelint.config.cjs (fixed regex) - scripts/check-design-tokens.mjs (improved detection logic) - components/profile-modal.html (fixed arbitrary values) - index.html (fixed arbitrary values)
30 lines
1.4 KiB
JavaScript
30 lines
1.4 KiB
JavaScript
const VAR_PATTERN = /^var\(--.*\)$/;
|
|
const CONTAINS_VAR_PATTERN = /var\(--.*\)/;
|
|
const LINEAR_GRADIENT_PATTERN = /^linear-gradient\(/;
|
|
const COLOR_MIX_PATTERN = /^color-mix\([\s\S]+\)$/;
|
|
const NON_TOKEN_LENGTH_PATTERN = /^(?!.*var\().*\b\d*\.?\d+(?:px|rem)\b/;
|
|
|
|
module.exports = {
|
|
ignoreFiles: ['css/tailwind.generated.css'],
|
|
rules: {
|
|
'at-rule-no-unknown': [true, { ignoreAtRules: ['tailwind', 'layer', 'apply'] }],
|
|
'import-notation': 'string',
|
|
'color-no-hex': true,
|
|
'declaration-property-value-allowed-list': {
|
|
color: [VAR_PATTERN, 'inherit', 'currentColor'],
|
|
'background-color': [VAR_PATTERN, 'transparent', 'inherit', 'currentColor', COLOR_MIX_PATTERN],
|
|
background: [VAR_PATTERN, CONTAINS_VAR_PATTERN, LINEAR_GRADIENT_PATTERN, 'none', 'transparent'],
|
|
'border-color': [VAR_PATTERN, CONTAINS_VAR_PATTERN, 'transparent', 'inherit', 'currentColor'],
|
|
'outline-color': [VAR_PATTERN, 'transparent', 'inherit', 'currentColor'],
|
|
fill: [VAR_PATTERN, 'none', 'currentColor', 'inherit'],
|
|
stroke: [VAR_PATTERN, 'none', 'currentColor', 'inherit'],
|
|
'box-shadow': [VAR_PATTERN, CONTAINS_VAR_PATTERN, 'none']
|
|
},
|
|
'declaration-property-value-disallowed-list': {
|
|
'/^((margin|padding)(-.+)?|gap|row-gap|column-gap|font-size|border-radius|outline|outline-offset)$/': [
|
|
NON_TOKEN_LENGTH_PATTERN
|
|
]
|
|
}
|
|
}
|
|
};
|