@master/eslint-plugin-css 2.0.0-rc.84 → 2.0.0-rc.86
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 +115 -115
- package/dist/configs/base.d.ts +0 -1
- package/dist/configs/legacy.d.ts +0 -1
- package/dist/configs/recommended.d.ts +0 -1
- package/dist/configs/stylesheet.d.ts +0 -1
- package/dist/create-rule.d.ts +1 -6
- package/dist/index.d.ts +0 -1
- package/dist/plugin.d.ts +0 -1
- package/dist/rules/no-conflicting-classes.js +1 -1
- package/dist/rules/no-invalid-classes.d.ts +1 -1
- package/dist/rules/no-unapproved-raw-values.js +1 -1
- package/dist/rules/prefer-canonical-classes.d.ts +0 -1
- package/dist/rules/prefer-canonical-classes.js +1 -1
- package/dist/rules/sort-classes.js +1 -1
- package/dist/settings-schema.d.ts +0 -1
- package/dist/settings.d.ts +1 -2
- package/dist/stylesheet-parser.d.ts +4 -4
- package/dist/utils/define-source-visitors.d.ts +1 -7
- package/dist/utils/define-source-visitors.js +2 -2
- package/dist/utils/define-visitors.d.ts +1 -5
- package/dist/utils/master-css.d.ts +0 -1
- package/dist/utils/report-lint-diagnostics.d.ts +4 -2
- package/dist/utils/report-lint-diagnostics.js +8 -2
- package/dist/utils/resolve-class-node.d.ts +0 -1
- package/dist/utils/resolve-compose-directive-class-nodes.d.ts +0 -1
- package/dist/utils/resolve-context.d.ts +1 -2
- package/dist/utils/with-visit-class-node.d.ts +0 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -2,52 +2,52 @@
|
|
|
2
2
|
<div align="center">
|
|
3
3
|
|
|
4
4
|
<p align="center">
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
<a href="https://css.master.co">
|
|
6
|
+
<picture>
|
|
7
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/33840671/201701649-3bb7d698-abec-4d5f-ac30-ccc4d7bafcd4.svg">
|
|
8
|
+
<source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/33840671/201703010-77bf2373-9899-40cc-98f5-30cf9b546941.svg">
|
|
9
|
+
<img alt="Master CSS" src="https://user-images.githubusercontent.com/33840671/201703010-77bf2373-9899-40cc-98f5-30cf9b546941.svg" width="100%">
|
|
10
|
+
</picture>
|
|
11
|
+
</a>
|
|
12
12
|
</p>
|
|
13
13
|
<p align="center">An ESLint plugin enforcing a consistent coding style for Master CSS</p>
|
|
14
14
|
|
|
15
15
|
<p align="center">
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
16
|
+
<a aria-label="GitHub release (latest by date including pre-releases)" href="https://github.com/master-co/css/releases">
|
|
17
|
+
<picture>
|
|
18
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/github/v/release/master-co/css?include_prereleases&color=212022&label=&style=for-the-badge&logo=github&logoColor=fff">
|
|
19
|
+
<source media="(prefers-color-scheme: light)" srcset="https://img.shields.io/github/v/release/master-co/css?include_prereleases&color=f6f7f8&label=&style=for-the-badge&logo=github&logoColor=%23000">
|
|
20
|
+
<img alt="NPM Version" src="https://img.shields.io/github/v/release/master-co/css?include_prereleases&color=f6f7f8&label=&style=for-the-badge&logo=github">
|
|
21
|
+
</picture>
|
|
22
|
+
</a>
|
|
23
|
+
<a aria-label="NPM Package" href="https://www.npmjs.com/package/@master/eslint-plugin-css">
|
|
24
|
+
<picture>
|
|
25
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/dm/@master/eslint-plugin-css?color=212022&label=%20&logo=npm&style=for-the-badge">
|
|
26
|
+
<source media="(prefers-color-scheme: light)" srcset="https://img.shields.io/npm/dm/@master/eslint-plugin-css?color=f6f7f8&label=%20&logo=npm&style=for-the-badge">
|
|
27
|
+
<img alt="NPM package ( download / month )" src="https://img.shields.io/npm/dm/@master/eslint-plugin-css?color=f6f7f8&label=%20&logo=npm&style=for-the-badge">
|
|
28
|
+
</picture>
|
|
29
|
+
</a>
|
|
30
|
+
<a aria-label="Discord Community" href="https://discord.gg/sZNKpAAAw6">
|
|
31
|
+
<picture>
|
|
32
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/discord/917780624314613760?color=212022&label=%20&logo=discord&style=for-the-badge">
|
|
33
|
+
<source media="(prefers-color-scheme: light)" srcset="https://img.shields.io/discord/917780624314613760?color=f6f7f8&label=%20&logo=discord&style=for-the-badge">
|
|
34
|
+
<img alt="Discord online" src="https://img.shields.io/discord/917780624314613760?color=f6f7f8&label=%20&logo=discord&style=for-the-badge">
|
|
35
|
+
</picture>
|
|
36
|
+
</a>
|
|
37
|
+
<a aria-label="Follow @mastercorg" href="https://twitter.com/mastercorg">
|
|
38
|
+
<picture>
|
|
39
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/static/v1?label=%20&message=twitter&color=212022&logo=twitter&style=for-the-badge">
|
|
40
|
+
<source media="(prefers-color-scheme: light)" srcset="https://img.shields.io/static/v1?label=%20&message=twitter&color=f6f7f8&logo=twitter&style=for-the-badge">
|
|
41
|
+
<img alt="Follow @mastercorg" src="https://img.shields.io/static/v1?label=%20&message=twitter&color=f6f7f8&logo=twitter&style=for-the-badge">
|
|
42
|
+
</picture>
|
|
43
|
+
</a>
|
|
44
|
+
<a aria-label="Github Actions" href="https://github.com/master-co/css/actions/workflows/ci-release.yml">
|
|
45
|
+
<picture>
|
|
46
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/github/actions/workflow/status/master-co/css/ci-release.yml?branch=rc&label=%20&message=twitter&color=212022&logo=githubactions&style=for-the-badge">
|
|
47
|
+
<source media="(prefers-color-scheme: light)" srcset="https://img.shields.io/github/actions/workflow/status/master-co/css/ci-release.yml?branch=rc&label=%20&message=twitter&color=f6f7f8&logo=githubactions&style=for-the-badge&logoColor=%23000">
|
|
48
|
+
<img alt="Github release actions" src="https://img.shields.io/github/actions/workflow/status/master-co/css/ci-release.yml?branch=rc&label=%20&message=twitter&color=f6f7f8&logo=githubactions&style=for-the-badge&logoColor=%23000">
|
|
49
|
+
</picture>
|
|
50
|
+
</a>
|
|
51
51
|
</p>
|
|
52
52
|
|
|
53
53
|
</div>
|
|
@@ -73,26 +73,26 @@ import htmlParser from '@angular-eslint/template-parser'
|
|
|
73
73
|
import tsParser from '@typescript-eslint/parser'
|
|
74
74
|
|
|
75
75
|
export default defineConfig([
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
files: ['**/*.{ts,tsx}'],
|
|
84
|
-
languageOptions: {
|
|
85
|
-
parser: tsParser
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
...css,
|
|
89
|
-
{
|
|
90
|
-
rules: {
|
|
91
|
-
'@master/css/no-invalid-classes': ['error', {
|
|
92
|
-
disallowUnknownClass: true
|
|
93
|
-
}]
|
|
94
|
-
}
|
|
76
|
+
{
|
|
77
|
+
files: ['**/*.html'],
|
|
78
|
+
languageOptions: {
|
|
79
|
+
parser: htmlParser
|
|
95
80
|
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
files: ['**/*.{ts,tsx}'],
|
|
84
|
+
languageOptions: {
|
|
85
|
+
parser: tsParser
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
...css,
|
|
89
|
+
{
|
|
90
|
+
rules: {
|
|
91
|
+
'@master/css/no-invalid-classes': ['error', {
|
|
92
|
+
disallowUnknownClass: true
|
|
93
|
+
}]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
96
|
])
|
|
97
97
|
```
|
|
98
98
|
|
|
@@ -106,11 +106,11 @@ Sorts Master CSS classes into a consistent and logical order.
|
|
|
106
106
|
import { defineConfig } from 'eslint/config'
|
|
107
107
|
|
|
108
108
|
export default defineConfig([
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
109
|
+
{
|
|
110
|
+
rules: {
|
|
111
|
+
'@master/css/sort-classes': 'warn'
|
|
113
112
|
}
|
|
113
|
+
}
|
|
114
114
|
])
|
|
115
115
|
```
|
|
116
116
|
|
|
@@ -122,11 +122,11 @@ Disallows invalid Master CSS classes.
|
|
|
122
122
|
import { defineConfig } from 'eslint/config'
|
|
123
123
|
|
|
124
124
|
export default defineConfig([
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
125
|
+
{
|
|
126
|
+
rules: {
|
|
127
|
+
'@master/css/no-invalid-classes': 'error'
|
|
129
128
|
}
|
|
129
|
+
}
|
|
130
130
|
])
|
|
131
131
|
```
|
|
132
132
|
|
|
@@ -136,13 +136,13 @@ Set `disallowUnknownClass: true` to reject classes that do not match the active
|
|
|
136
136
|
import { defineConfig } from 'eslint/config'
|
|
137
137
|
|
|
138
138
|
export default defineConfig([
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
139
|
+
{
|
|
140
|
+
rules: {
|
|
141
|
+
'@master/css/no-invalid-classes': ['error', {
|
|
142
|
+
disallowUnknownClass: true
|
|
143
|
+
}]
|
|
145
144
|
}
|
|
145
|
+
}
|
|
146
146
|
])
|
|
147
147
|
```
|
|
148
148
|
|
|
@@ -154,11 +154,11 @@ Prefers canonical Master CSS class forms, including semantic utilities, theme to
|
|
|
154
154
|
import { defineConfig } from 'eslint/config'
|
|
155
155
|
|
|
156
156
|
export default defineConfig([
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
157
|
+
{
|
|
158
|
+
rules: {
|
|
159
|
+
'@master/css/prefer-canonical-classes': 'warn'
|
|
161
160
|
}
|
|
161
|
+
}
|
|
162
162
|
])
|
|
163
163
|
```
|
|
164
164
|
|
|
@@ -173,7 +173,7 @@ import { defineConfig } from 'eslint/config'
|
|
|
173
173
|
import css from '@master/eslint-config-css'
|
|
174
174
|
|
|
175
175
|
export default defineConfig([
|
|
176
|
-
|
|
176
|
+
...css
|
|
177
177
|
])
|
|
178
178
|
```
|
|
179
179
|
|
|
@@ -185,21 +185,21 @@ You can disable specific canonicalization families:
|
|
|
185
185
|
import { defineConfig } from 'eslint/config'
|
|
186
186
|
|
|
187
187
|
export default defineConfig([
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
188
|
+
{
|
|
189
|
+
rules: {
|
|
190
|
+
'@master/css/prefer-canonical-classes': ['warn', {
|
|
191
|
+
preferStaticUtilities: true,
|
|
192
|
+
preferThemeTokens: true,
|
|
193
|
+
preferPropertyAliases: true,
|
|
194
|
+
preferVariableReferences: true,
|
|
195
|
+
preferMultiValueTokens: true,
|
|
196
|
+
preferCompositionUtilities: true,
|
|
197
|
+
preferConditionOrder: true,
|
|
198
|
+
preferNativeDeclarationsInCompose: true,
|
|
199
|
+
preferVariantBlocksInCompose: true
|
|
200
|
+
}]
|
|
202
201
|
}
|
|
202
|
+
}
|
|
203
203
|
])
|
|
204
204
|
```
|
|
205
205
|
|
|
@@ -211,11 +211,11 @@ Disallows classes that emit the same CSS declaration properties for the same var
|
|
|
211
211
|
import { defineConfig } from 'eslint/config'
|
|
212
212
|
|
|
213
213
|
export default defineConfig([
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
214
|
+
{
|
|
215
|
+
rules: {
|
|
216
|
+
'@master/css/no-conflicting-classes': 'warn'
|
|
218
217
|
}
|
|
218
|
+
}
|
|
219
219
|
])
|
|
220
220
|
```
|
|
221
221
|
|
|
@@ -229,14 +229,14 @@ Disallows raw values in token-backed utilities unless they are explicitly allowe
|
|
|
229
229
|
import { defineConfig } from 'eslint/config'
|
|
230
230
|
|
|
231
231
|
export default defineConfig([
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
232
|
+
{
|
|
233
|
+
rules: {
|
|
234
|
+
'@master/css/no-unapproved-raw-values': ['warn', {
|
|
235
|
+
allowProperties: ['width', 'height'],
|
|
236
|
+
allowedPatterns: ['^var\\(', '^calc\\(']
|
|
237
|
+
}]
|
|
239
238
|
}
|
|
239
|
+
}
|
|
240
240
|
])
|
|
241
241
|
```
|
|
242
242
|
|
|
@@ -250,17 +250,17 @@ Settings live under the `@master/css` settings key:
|
|
|
250
250
|
import { defineConfig } from 'eslint/config'
|
|
251
251
|
|
|
252
252
|
export default defineConfig([
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
253
|
+
{
|
|
254
|
+
settings: {
|
|
255
|
+
'@master/css': {
|
|
256
|
+
classAttributes: ['class', 'className'],
|
|
257
|
+
classFunctions: ['clsx', 'classList.add'],
|
|
258
|
+
classDeclarations: ['classes'],
|
|
259
|
+
ignoredKeys: ['compoundVariants', 'defaultVariants'],
|
|
260
|
+
manifest
|
|
261
|
+
}
|
|
263
262
|
}
|
|
263
|
+
}
|
|
264
264
|
])
|
|
265
265
|
```
|
|
266
266
|
|
package/dist/configs/base.d.ts
CHANGED
package/dist/configs/legacy.d.ts
CHANGED
package/dist/create-rule.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
|
-
|
|
3
2
|
//#region src/create-rule.d.ts
|
|
4
|
-
declare const _default: <Options extends readonly unknown[], MessageIds extends string>({
|
|
5
|
-
meta,
|
|
6
|
-
name,
|
|
7
|
-
...rule
|
|
8
|
-
}: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, unknown>>) => ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener> & {
|
|
3
|
+
declare const _default: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, unknown>>) => ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener> & {
|
|
9
4
|
name: string;
|
|
10
5
|
};
|
|
11
6
|
//#endregion
|
package/dist/index.d.ts
CHANGED
package/dist/plugin.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ var no_conflicting_classes_default = create_rule_default({
|
|
|
12
12
|
docs: { description: "Disallow conflicting Master CSS classes" },
|
|
13
13
|
messages: {
|
|
14
14
|
collisionClass: "{{message}}",
|
|
15
|
-
partialCollisionClass: "
|
|
15
|
+
partialCollisionClass: "{{message}}"
|
|
16
16
|
},
|
|
17
17
|
fixable: "code",
|
|
18
18
|
schema: []
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/rules/no-invalid-classes.d.ts
|
|
2
|
-
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"
|
|
2
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"disallowUnknownClass" | "invalidClass", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
3
3
|
name: string;
|
|
4
4
|
};
|
|
5
5
|
//#endregion
|
|
@@ -10,7 +10,7 @@ var no_unapproved_raw_values_default = create_rule_default({
|
|
|
10
10
|
meta: {
|
|
11
11
|
type: "suggestion",
|
|
12
12
|
docs: { description: "Disallow unapproved raw values in token-backed Master CSS classes" },
|
|
13
|
-
messages: { unapprovedRawValue: "
|
|
13
|
+
messages: { unapprovedRawValue: "{{message}}" },
|
|
14
14
|
fixable: null,
|
|
15
15
|
schema: [{
|
|
16
16
|
type: "object",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CanonicalClassNameOptions } from "@master/css-lint";
|
|
2
|
-
|
|
3
2
|
//#region src/rules/prefer-canonical-classes.d.ts
|
|
4
3
|
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferClass", [Required<CanonicalClassNameOptions>], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
5
4
|
name: string;
|
|
@@ -11,7 +11,7 @@ var prefer_canonical_classes_default = create_rule_default({
|
|
|
11
11
|
meta: {
|
|
12
12
|
type: "suggestion",
|
|
13
13
|
docs: { description: "Prefer canonical Master CSS classes" },
|
|
14
|
-
messages: { preferClass: "
|
|
14
|
+
messages: { preferClass: "{{message}}" },
|
|
15
15
|
fixable: "code",
|
|
16
16
|
schema: [{
|
|
17
17
|
type: "object",
|
|
@@ -11,7 +11,7 @@ var sort_classes_default = create_rule_default({
|
|
|
11
11
|
type: "layout",
|
|
12
12
|
fixable: "code",
|
|
13
13
|
docs: { description: "Sort Master CSS classes" },
|
|
14
|
-
messages: { invalidClassOrder: "
|
|
14
|
+
messages: { invalidClassOrder: "{{message}}" },
|
|
15
15
|
schema: []
|
|
16
16
|
},
|
|
17
17
|
defaultOptions: [],
|
package/dist/settings.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { MasterCSSManifest } from "./utils/master-css.js";
|
|
2
|
-
|
|
3
2
|
//#region src/settings.d.ts
|
|
4
3
|
declare const settings: {
|
|
5
|
-
manifest: any;
|
|
6
4
|
classAttributes: string[];
|
|
7
5
|
classFunctions: string[];
|
|
8
6
|
classDeclarations: string[];
|
|
9
7
|
ignoredKeys: string[];
|
|
8
|
+
manifest: any;
|
|
10
9
|
};
|
|
11
10
|
interface Settings {
|
|
12
11
|
classAttributes?: string[];
|
|
@@ -6,9 +6,9 @@ declare const _default: {
|
|
|
6
6
|
parseForESLint(source: string): {
|
|
7
7
|
ast: {
|
|
8
8
|
type: string;
|
|
9
|
-
body:
|
|
10
|
-
comments:
|
|
11
|
-
tokens:
|
|
9
|
+
body: undefined[];
|
|
10
|
+
comments: undefined[];
|
|
11
|
+
tokens: undefined[];
|
|
12
12
|
sourceType: string;
|
|
13
13
|
range: number[];
|
|
14
14
|
loc: {
|
|
@@ -23,7 +23,7 @@ declare const _default: {
|
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
visitorKeys: {
|
|
26
|
-
Program:
|
|
26
|
+
Program: undefined[];
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { MasterCSSLintContentRuleOptions, MasterCSSLintRuleId } from "@master/css-lint";
|
|
2
2
|
import { MasterCSS } from "@master/css-engine";
|
|
3
3
|
import { RuleContext, RuleListener } from "@typescript-eslint/utils/ts-eslint";
|
|
4
|
-
|
|
5
4
|
//#region src/utils/define-source-visitors.d.ts
|
|
6
5
|
type SourceRuleOptions = MasterCSSLintContentRuleOptions[keyof MasterCSSLintContentRuleOptions];
|
|
7
6
|
interface DefineSourceVisitorsOptions {
|
|
@@ -11,11 +10,6 @@ interface DefineSourceVisitorsOptions {
|
|
|
11
10
|
ruleOptions?: SourceRuleOptions;
|
|
12
11
|
}
|
|
13
12
|
declare function shouldUseSourceVisitors(context: RuleContext<any, any[]>): boolean;
|
|
14
|
-
declare function defineSourceVisitors({
|
|
15
|
-
context,
|
|
16
|
-
css,
|
|
17
|
-
ruleId,
|
|
18
|
-
ruleOptions
|
|
19
|
-
}: DefineSourceVisitorsOptions): RuleListener;
|
|
13
|
+
declare function defineSourceVisitors({ context, css, ruleId, ruleOptions }: DefineSourceVisitorsOptions): RuleListener;
|
|
20
14
|
//#endregion
|
|
21
15
|
export { defineSourceVisitors as default, shouldUseSourceVisitors };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { messageIdByCode,
|
|
1
|
+
import { messageIdByCode, stringifyLintDiagnosticMessageData } from "./report-lint-diagnostics.js";
|
|
2
2
|
import { lintMasterCSSContent, masterCSSLintRuleIds } from "@master/css-lint";
|
|
3
3
|
//#region src/utils/define-source-visitors.ts
|
|
4
4
|
const SOURCE_LINT_FILE_RE = /\.mdx$/i;
|
|
@@ -27,7 +27,7 @@ function reportSourceDiagnostic(context, node, diagnostic) {
|
|
|
27
27
|
},
|
|
28
28
|
...messageId ? {
|
|
29
29
|
messageId,
|
|
30
|
-
data:
|
|
30
|
+
data: stringifyLintDiagnosticMessageData(diagnostic)
|
|
31
31
|
} : { message: diagnostic.message }
|
|
32
32
|
};
|
|
33
33
|
if (fix) descriptor.fix = (fixer) => fixer.replaceTextRange([fix.range.start, fix.range.end], fix.text);
|
|
@@ -2,12 +2,8 @@ import { TSESTree } from "@typescript-eslint/utils";
|
|
|
2
2
|
import { Settings } from "../settings.js";
|
|
3
3
|
import { RuleContext, RuleListener } from "@typescript-eslint/utils/ts-eslint";
|
|
4
4
|
import resolveClassNode from "./resolve-class-node.js";
|
|
5
|
-
|
|
6
5
|
//#region src/utils/define-visitors.d.ts
|
|
7
|
-
declare function defineVisitors({
|
|
8
|
-
context,
|
|
9
|
-
settings
|
|
10
|
-
}: {
|
|
6
|
+
declare function defineVisitors({ context, settings }: {
|
|
11
7
|
context: RuleContext<any, any[]>;
|
|
12
8
|
settings: Settings;
|
|
13
9
|
}, visitNode: (node: TSESTree.Node, resolved: ReturnType<typeof resolveClassNode>) => void): RuleListener;
|
|
@@ -2,7 +2,6 @@ import { TSESTree } from "@typescript-eslint/utils";
|
|
|
2
2
|
import { MasterCSSLintDiagnostic, MasterCSSLintFix } from "@master/css-lint";
|
|
3
3
|
import { RuleContext } from "@typescript-eslint/utils/ts-eslint";
|
|
4
4
|
import { ResolvedClassNode } from "./resolve-class-node.js";
|
|
5
|
-
|
|
6
5
|
//#region src/utils/report-lint-diagnostics.d.ts
|
|
7
6
|
type FixRange = [number, number];
|
|
8
7
|
interface ReportLintDiagnosticsOptions {
|
|
@@ -15,6 +14,9 @@ declare const messageIdByCode: Record<string, string>;
|
|
|
15
14
|
declare function stringifyLintDiagnosticData(data?: MasterCSSLintDiagnostic['data']): {
|
|
16
15
|
[k: string]: string;
|
|
17
16
|
};
|
|
17
|
+
declare function stringifyLintDiagnosticMessageData(diagnostic: Pick<MasterCSSLintDiagnostic, 'data' | 'message'>): {
|
|
18
|
+
[k: string]: string;
|
|
19
|
+
};
|
|
18
20
|
declare function reportLintDiagnostics(context: RuleContext<any, any[]>, node: TSESTree.Node, resolved: ResolvedClassNode, diagnostics: MasterCSSLintDiagnostic[], options?: ReportLintDiagnosticsOptions): void;
|
|
19
21
|
//#endregion
|
|
20
|
-
export { reportLintDiagnostics as default, messageIdByCode, stringifyLintDiagnosticData };
|
|
22
|
+
export { reportLintDiagnostics as default, messageIdByCode, stringifyLintDiagnosticData, stringifyLintDiagnosticMessageData };
|
|
@@ -13,6 +13,12 @@ const messageIdByCode = {
|
|
|
13
13
|
function stringifyLintDiagnosticData(data = {}) {
|
|
14
14
|
return Object.fromEntries(Object.entries(data).filter(([, value]) => value !== void 0).map(([key, value]) => [key, Array.isArray(value) ? value.join(", ") : String(value)]));
|
|
15
15
|
}
|
|
16
|
+
function stringifyLintDiagnosticMessageData(diagnostic) {
|
|
17
|
+
return stringifyLintDiagnosticData({
|
|
18
|
+
...diagnostic.data,
|
|
19
|
+
message: diagnostic.message
|
|
20
|
+
});
|
|
21
|
+
}
|
|
16
22
|
function defaultFix(resolved, fix) {
|
|
17
23
|
if (fix.scope === "directive") return;
|
|
18
24
|
return {
|
|
@@ -35,7 +41,7 @@ function reportLintDiagnostics(context, node, resolved, diagnostics, options = {
|
|
|
35
41
|
},
|
|
36
42
|
...messageId ? {
|
|
37
43
|
messageId,
|
|
38
|
-
data:
|
|
44
|
+
data: stringifyLintDiagnosticMessageData(diagnostic)
|
|
39
45
|
} : { message: diagnostic.message }
|
|
40
46
|
};
|
|
41
47
|
if (fix) descriptor.fix = (fixer) => fixer.replaceTextRange(fix.range, fix.text);
|
|
@@ -43,4 +49,4 @@ function reportLintDiagnostics(context, node, resolved, diagnostics, options = {
|
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
//#endregion
|
|
46
|
-
export { reportLintDiagnostics as default, messageIdByCode, stringifyLintDiagnosticData };
|
|
52
|
+
export { reportLintDiagnostics as default, messageIdByCode, stringifyLintDiagnosticData, stringifyLintDiagnosticMessageData };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { RuleContext } from "@typescript-eslint/utils/ts-eslint";
|
|
2
2
|
import { ResolvedClassNode } from "./resolve-class-node.js";
|
|
3
|
-
|
|
4
3
|
//#region src/utils/resolve-compose-directive-class-nodes.d.ts
|
|
5
4
|
interface ResolvedComposeDirectiveClassNode extends ResolvedClassNode {
|
|
6
5
|
directiveStart: number;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { MasterCSS } from "./master-css.js";
|
|
2
2
|
import { RuleContext } from "@typescript-eslint/utils/ts-eslint";
|
|
3
|
-
|
|
4
3
|
//#region src/utils/resolve-context.d.ts
|
|
5
4
|
declare function resolveContext(context: RuleContext<any, any[]>): {
|
|
6
5
|
settings: {
|
|
7
|
-
manifest: any;
|
|
8
6
|
classAttributes: string[];
|
|
9
7
|
classFunctions: string[];
|
|
10
8
|
classDeclarations: string[];
|
|
11
9
|
ignoredKeys: string[];
|
|
10
|
+
manifest: any;
|
|
12
11
|
};
|
|
13
12
|
options: any;
|
|
14
13
|
css: MasterCSS;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TSESTree } from "@typescript-eslint/utils";
|
|
2
2
|
import { RuleContext } from "@typescript-eslint/utils/ts-eslint";
|
|
3
3
|
import resolveClassNode from "./resolve-class-node.js";
|
|
4
|
-
|
|
5
4
|
//#region src/utils/with-visit-class-node.d.ts
|
|
6
5
|
declare function withVisitClassNode(visit: (node: TSESTree.Node, resolved: ReturnType<typeof resolveClassNode>) => void, context: RuleContext<any, any[]>): (node: any) => void;
|
|
7
6
|
//#endregion
|
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-
|
|
54
|
-
"@master/css-
|
|
55
|
-
"@master/css-validator": "^2.0.0-rc.
|
|
50
|
+
"@master/css": "^2.0.0-rc.86",
|
|
51
|
+
"@master/css-lint": "^2.0.0-rc.86",
|
|
52
|
+
"@master/css-project": "^2.0.0-rc.86",
|
|
53
|
+
"@master/css-preset": "^2.0.0-rc.86",
|
|
54
|
+
"@master/css-lexer": "^2.0.0-rc.86",
|
|
55
|
+
"@master/css-validator": "^2.0.0-rc.86"
|
|
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.86"
|
|
69
69
|
},
|
|
70
|
-
"version": "2.0.0-rc.
|
|
70
|
+
"version": "2.0.0-rc.86",
|
|
71
71
|
"scripts": {
|
|
72
72
|
"build": "tsdown --config ../../shared/tsdown-package.config.ts",
|
|
73
73
|
"dev": "tsdown --config ../../shared/tsdown-package.config.ts --watch",
|