mirror of
https://github.com/antebudimir/eslint-plugin-vanilla-extract.git
synced 2026-01-01 09:23:31 +00:00
- Ensure 'src' property always appears first - Sort remaining properties alphabetically - Handle both APIs correctly despite different argument structures - Handles font faces ordering the same in all 3 available CSS rules - Update documentation with fontFace ordering details
25 lines
900 B
TypeScript
25 lines
900 B
TypeScript
import type { Rule } from 'eslint';
|
|
import { createNodeVisitors } from '../shared-utils/order-strategy-visitor-creator.js';
|
|
|
|
const alphabeticalOrderRule: Rule.RuleModule = {
|
|
meta: {
|
|
type: 'suggestion',
|
|
docs: {
|
|
description: 'enforce alphabetical CSS property ordering in vanilla-extract styles',
|
|
category: 'Stylistic Issues',
|
|
recommended: true,
|
|
},
|
|
fixable: 'code',
|
|
schema: [],
|
|
messages: {
|
|
alphabeticalOrder: "Property '{{nextProperty}}' should come before '{{currentProperty}}' in alphabetical order.",
|
|
fontFaceOrder:
|
|
"Properties in fontFace should be ordered with 'src' first, followed by other properties in alphabetical order. Property '{{nextProperty}}' should come before '{{currentProperty}}'.",
|
|
},
|
|
},
|
|
create(context) {
|
|
return createNodeVisitors(context, 'alphabetical');
|
|
},
|
|
};
|
|
|
|
export default alphabeticalOrderRule;
|