mirror of
https://github.com/antebudimir/eslint-plugin-vanilla-extract.git
synced 2026-01-02 01:23:33 +00:00
feat 🥁: add no-unknown-unit rule
Adds a rule to disallow unknown or invalid CSS units in vanilla-extract style objects. - Reports any usage of unrecognized units in property values - Handles all vanilla-extract APIs (style, styleVariants, recipe, etc.) - Ignores valid units in special contexts (e.g., CSS functions, custom properties) No autofix is provided because replacing or removing unknown units may result in unintended or invalid CSS. Manual developer review is required to ensure correctness.
This commit is contained in:
parent
7dc7204749
commit
f880c051ff
11 changed files with 623 additions and 5 deletions
22
src/css-rules/no-unknown-unit/rule-definition.ts
Normal file
22
src/css-rules/no-unknown-unit/rule-definition.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import type { Rule } from 'eslint';
|
||||
import { createUnknownUnitVisitors } from './unknown-unit-visitor-creator.js';
|
||||
|
||||
const noUnknownUnitRule: Rule.RuleModule = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow invalid or unknown CSS units in vanilla-extract style objects',
|
||||
category: 'Possible Errors',
|
||||
recommended: true,
|
||||
},
|
||||
schema: [],
|
||||
messages: {
|
||||
unknownUnit: 'The unit "{{ unit }}" in value "{{ value }}" is not recognized as a valid CSS unit.',
|
||||
},
|
||||
},
|
||||
create(context) {
|
||||
return createUnknownUnitVisitors(context);
|
||||
},
|
||||
};
|
||||
|
||||
export default noUnknownUnitRule;
|
||||
Loading…
Add table
Add a link
Reference in a new issue