@master/eslint-plugin-css 2.0.0-rc.77 → 2.0.0-rc.79
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/README.md +39 -20
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -67,12 +67,12 @@ In Visual Studio Code, install the VS Code ESLint extension to surface these dia
|
|
|
67
67
|
Use ESLint flat configuration:
|
|
68
68
|
|
|
69
69
|
```js
|
|
70
|
+
import { defineConfig } from 'eslint/config'
|
|
70
71
|
import css from '@master/eslint-config-css'
|
|
71
72
|
import htmlParser from '@angular-eslint/template-parser'
|
|
72
73
|
import tsParser from '@typescript-eslint/parser'
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
export default [
|
|
75
|
+
export default defineConfig([
|
|
76
76
|
{
|
|
77
77
|
files: ['**/*.html'],
|
|
78
78
|
languageOptions: {
|
|
@@ -93,7 +93,7 @@ export default [
|
|
|
93
93
|
}]
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
]
|
|
96
|
+
])
|
|
97
97
|
```
|
|
98
98
|
|
|
99
99
|
## Rules
|
|
@@ -103,13 +103,15 @@ export default [
|
|
|
103
103
|
Sorts Master CSS classes into a consistent and logical order.
|
|
104
104
|
|
|
105
105
|
```js
|
|
106
|
-
|
|
106
|
+
import { defineConfig } from 'eslint/config'
|
|
107
|
+
|
|
108
|
+
export default defineConfig([
|
|
107
109
|
{
|
|
108
110
|
rules: {
|
|
109
111
|
'@master/css/sort-classes': 'warn'
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
|
-
]
|
|
114
|
+
])
|
|
113
115
|
```
|
|
114
116
|
|
|
115
117
|
### `@master/css/no-invalid-classes`
|
|
@@ -117,19 +119,23 @@ export default [
|
|
|
117
119
|
Disallows invalid Master CSS classes.
|
|
118
120
|
|
|
119
121
|
```js
|
|
120
|
-
|
|
122
|
+
import { defineConfig } from 'eslint/config'
|
|
123
|
+
|
|
124
|
+
export default defineConfig([
|
|
121
125
|
{
|
|
122
126
|
rules: {
|
|
123
127
|
'@master/css/no-invalid-classes': 'error'
|
|
124
128
|
}
|
|
125
129
|
}
|
|
126
|
-
]
|
|
130
|
+
])
|
|
127
131
|
```
|
|
128
132
|
|
|
129
133
|
Set `disallowUnknownClass: true` to reject classes that do not match the active manifest:
|
|
130
134
|
|
|
131
135
|
```js
|
|
132
|
-
|
|
136
|
+
import { defineConfig } from 'eslint/config'
|
|
137
|
+
|
|
138
|
+
export default defineConfig([
|
|
133
139
|
{
|
|
134
140
|
rules: {
|
|
135
141
|
'@master/css/no-invalid-classes': ['error', {
|
|
@@ -137,7 +143,7 @@ export default [
|
|
|
137
143
|
}]
|
|
138
144
|
}
|
|
139
145
|
}
|
|
140
|
-
]
|
|
146
|
+
])
|
|
141
147
|
```
|
|
142
148
|
|
|
143
149
|
### `@master/css/prefer-canonical-classes`
|
|
@@ -145,13 +151,15 @@ export default [
|
|
|
145
151
|
Prefers canonical Master CSS class forms, including semantic utilities, theme tokens, property aliases, composition utilities, and condition suffix order.
|
|
146
152
|
|
|
147
153
|
```js
|
|
148
|
-
|
|
154
|
+
import { defineConfig } from 'eslint/config'
|
|
155
|
+
|
|
156
|
+
export default defineConfig([
|
|
149
157
|
{
|
|
150
158
|
rules: {
|
|
151
159
|
'@master/css/prefer-canonical-classes': 'warn'
|
|
152
160
|
}
|
|
153
161
|
}
|
|
154
|
-
]
|
|
162
|
+
])
|
|
155
163
|
```
|
|
156
164
|
|
|
157
165
|
For example, this rule can fix `text-align:center` to `text-center`, `font:16px` to `font:md`, `margin:md` to `m:md`, `m:1rem|1.5rem` to `m:md|lg`, `fg:var(--color-red-60)` to `fg:red-60`, `w:md h:md` to `size:md`, `mt:md mb:md` to `my:md`, and `block@dark@sm` to `block@sm@dark`.
|
|
@@ -161,9 +169,12 @@ The same canonicalization applies to unquoted `@compose` class lists. In CSS, de
|
|
|
161
169
|
Standalone CSS files are included by default when using `@master/eslint-config-css`:
|
|
162
170
|
|
|
163
171
|
```js
|
|
172
|
+
import { defineConfig } from 'eslint/config'
|
|
164
173
|
import css from '@master/eslint-config-css'
|
|
165
174
|
|
|
166
|
-
export default [
|
|
175
|
+
export default defineConfig([
|
|
176
|
+
...css
|
|
177
|
+
])
|
|
167
178
|
```
|
|
168
179
|
|
|
169
180
|
Direct plugin users can add `css.configs.stylesheet` from `@master/eslint-plugin-css` alongside the recommended config.
|
|
@@ -171,7 +182,9 @@ Direct plugin users can add `css.configs.stylesheet` from `@master/eslint-plugin
|
|
|
171
182
|
You can disable specific canonicalization families:
|
|
172
183
|
|
|
173
184
|
```js
|
|
174
|
-
|
|
185
|
+
import { defineConfig } from 'eslint/config'
|
|
186
|
+
|
|
187
|
+
export default defineConfig([
|
|
175
188
|
{
|
|
176
189
|
rules: {
|
|
177
190
|
'@master/css/prefer-canonical-classes': ['warn', {
|
|
@@ -187,7 +200,7 @@ export default [
|
|
|
187
200
|
}]
|
|
188
201
|
}
|
|
189
202
|
}
|
|
190
|
-
]
|
|
203
|
+
])
|
|
191
204
|
```
|
|
192
205
|
|
|
193
206
|
### `@master/css/no-conflicting-classes`
|
|
@@ -195,13 +208,15 @@ export default [
|
|
|
195
208
|
Disallows classes that emit the same CSS declaration properties for the same variant.
|
|
196
209
|
|
|
197
210
|
```js
|
|
198
|
-
|
|
211
|
+
import { defineConfig } from 'eslint/config'
|
|
212
|
+
|
|
213
|
+
export default defineConfig([
|
|
199
214
|
{
|
|
200
215
|
rules: {
|
|
201
216
|
'@master/css/no-conflicting-classes': 'warn'
|
|
202
217
|
}
|
|
203
218
|
}
|
|
204
|
-
]
|
|
219
|
+
])
|
|
205
220
|
```
|
|
206
221
|
|
|
207
222
|
When two classes conflict, the later class is treated as the effective one and the fix removes the earlier class. For partially overlapping spacing, physical inset, radius, and border width/color/style shorthands, the fix preserves the surviving declarations by splitting the earlier class, such as `mx:md ml:lg` to `mr:md ml:lg` or `b-solid bt-dashed` to `br-solid bb-solid bl-solid bt-dashed`.
|
|
@@ -211,7 +226,9 @@ When two classes conflict, the later class is treated as the effective one and t
|
|
|
211
226
|
Disallows raw values in token-backed utilities unless they are explicitly allowed. This rule is opt-in team policy and is not enabled by the recommended config.
|
|
212
227
|
|
|
213
228
|
```js
|
|
214
|
-
|
|
229
|
+
import { defineConfig } from 'eslint/config'
|
|
230
|
+
|
|
231
|
+
export default defineConfig([
|
|
215
232
|
{
|
|
216
233
|
rules: {
|
|
217
234
|
'@master/css/no-unapproved-raw-values': ['warn', {
|
|
@@ -220,7 +237,7 @@ export default [
|
|
|
220
237
|
}]
|
|
221
238
|
}
|
|
222
239
|
}
|
|
223
|
-
]
|
|
240
|
+
])
|
|
224
241
|
```
|
|
225
242
|
|
|
226
243
|
For example, this rule reports `font:15px`, `m:17px`, and `fg:#123456` when those values are not theme tokens. It does not autofix because there may be no safe token replacement.
|
|
@@ -230,7 +247,9 @@ For example, this rule reports `font:15px`, `m:17px`, and `fg:#123456` when thos
|
|
|
230
247
|
Settings live under the `@master/css` settings key:
|
|
231
248
|
|
|
232
249
|
```js
|
|
233
|
-
|
|
250
|
+
import { defineConfig } from 'eslint/config'
|
|
251
|
+
|
|
252
|
+
export default defineConfig([
|
|
234
253
|
{
|
|
235
254
|
settings: {
|
|
236
255
|
'@master/css': {
|
|
@@ -242,7 +261,7 @@ export default [
|
|
|
242
261
|
}
|
|
243
262
|
}
|
|
244
263
|
}
|
|
245
|
-
]
|
|
264
|
+
])
|
|
246
265
|
```
|
|
247
266
|
|
|
248
267
|
| Setting | Type | Description |
|
package/package.json
CHANGED
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@typescript-eslint/utils": "^8.61.1",
|
|
49
49
|
"typescript-eslint": "^8.61.1",
|
|
50
|
-
"@master/css": "^2.0.0-rc.
|
|
51
|
-
"@master/css-
|
|
52
|
-
"@master/css-
|
|
53
|
-
"@master/css-preset": "^2.0.0-rc.
|
|
54
|
-
"@master/css-
|
|
55
|
-
"@master/css-
|
|
50
|
+
"@master/css": "^2.0.0-rc.79",
|
|
51
|
+
"@master/css-lexer": "^2.0.0-rc.79",
|
|
52
|
+
"@master/css-project": "^2.0.0-rc.79",
|
|
53
|
+
"@master/css-preset": "^2.0.0-rc.79",
|
|
54
|
+
"@master/css-validator": "^2.0.0-rc.79",
|
|
55
|
+
"@master/css-lint": "^2.0.0-rc.79"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@angular-eslint/template-parser": "^21.4.0",
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
"svelte-eslint-parser": "^1.8.0",
|
|
66
66
|
"ts-node": "^10.9.2",
|
|
67
67
|
"vue-eslint-parser": "^10.4.1",
|
|
68
|
-
"@master/css-schema": "^2.0.0-rc.
|
|
68
|
+
"@master/css-schema": "^2.0.0-rc.79"
|
|
69
69
|
},
|
|
70
|
-
"version": "2.0.0-rc.
|
|
70
|
+
"version": "2.0.0-rc.79",
|
|
71
71
|
"scripts": {
|
|
72
72
|
"build": "tsdown --config ../../shared/tsdown-package.config.ts",
|
|
73
73
|
"dev": "tsdown --config ../../shared/tsdown-package.config.ts --watch",
|