@cssdoc/config 0.1.0 → 0.2.0
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/cssdoc.schema.json +22 -0
- package/dist/index.d.mts +41 -1
- package/dist/index.mjs +51 -3
- package/package.json +2 -2
package/cssdoc.schema.json
CHANGED
|
@@ -36,6 +36,28 @@
|
|
|
36
36
|
"description": "Enable or disable specific tags by name.",
|
|
37
37
|
"type": "object",
|
|
38
38
|
"additionalProperties": { "type": "boolean" }
|
|
39
|
+
},
|
|
40
|
+
"modifierConvention": {
|
|
41
|
+
"description": "How modifier classes are spelled: a preset name (bem, rscss, bare) or a custom convention.",
|
|
42
|
+
"oneOf": [
|
|
43
|
+
{ "enum": ["bem", "rscss", "bare"] },
|
|
44
|
+
{
|
|
45
|
+
"type": "object",
|
|
46
|
+
"additionalProperties": false,
|
|
47
|
+
"required": ["structure", "separator"],
|
|
48
|
+
"properties": {
|
|
49
|
+
"structure": { "enum": ["chained", "suffix", "attribute"] },
|
|
50
|
+
"separator": { "type": "string" },
|
|
51
|
+
"propValue": { "type": "boolean" },
|
|
52
|
+
"propValueSeparator": { "type": "string" }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"rules": {
|
|
58
|
+
"description": "Per-rule severity overrides (off/warn/error).",
|
|
59
|
+
"type": "object",
|
|
60
|
+
"additionalProperties": { "enum": ["off", "warn", "error"] }
|
|
39
61
|
}
|
|
40
62
|
}
|
|
41
63
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { CssDocConfiguration, CssDocTagDefinition } from "@cssdoc/core";
|
|
1
|
+
import { CssDocConfiguration, CssDocTagDefinition, ModifierConventionInput } from "@cssdoc/core";
|
|
2
2
|
|
|
3
3
|
//#region src/CssDocConfigFile.d.ts
|
|
4
|
+
/** A per-rule severity override, as spelled in `cssdoc.json`. */
|
|
5
|
+
type RuleSeverityOverride = "off" | "warn" | "error";
|
|
4
6
|
/** The conventional file name loaders look for. */
|
|
5
7
|
declare const CSSDOC_CONFIG_FILENAME = "cssdoc.json";
|
|
6
8
|
/** A loaded `cssdoc.json` (plus the files it `extends`), ready to configure a parser. */
|
|
@@ -19,6 +21,13 @@ declare class CssDocConfigFile {
|
|
|
19
21
|
readonly supportForTags: ReadonlyMap<string, boolean>;
|
|
20
22
|
/** The resolved files this one `extends`, in declaration order. */
|
|
21
23
|
readonly extendsFiles: readonly CssDocConfigFile[];
|
|
24
|
+
/** The modifier convention declared by this file, if any. */
|
|
25
|
+
readonly modifierConvention?: ModifierConventionInput;
|
|
26
|
+
/**
|
|
27
|
+
* The per-rule severity overrides, merged across the `extends` chain (this file wins). Not the
|
|
28
|
+
* resolved severities — pass these to `resolveRuleSeverities` in `@cssdoc/providers`.
|
|
29
|
+
*/
|
|
30
|
+
readonly ruleSeverities: Readonly<Record<string, RuleSeverityOverride>>;
|
|
22
31
|
private constructor();
|
|
23
32
|
/** Whether this file — or any file it extends — reported an error. */
|
|
24
33
|
get hasErrors(): boolean;
|
|
@@ -120,6 +129,37 @@ declare const cssDocSchema: {
|
|
|
120
129
|
readonly type: "boolean";
|
|
121
130
|
};
|
|
122
131
|
};
|
|
132
|
+
readonly modifierConvention: {
|
|
133
|
+
readonly description: "How modifier classes are spelled: a preset name (bem, rscss, bare) or a custom convention.";
|
|
134
|
+
readonly oneOf: readonly [{
|
|
135
|
+
readonly enum: readonly ["bem", "rscss", "bare"];
|
|
136
|
+
}, {
|
|
137
|
+
readonly type: "object";
|
|
138
|
+
readonly additionalProperties: false;
|
|
139
|
+
readonly required: readonly ["structure", "separator"];
|
|
140
|
+
readonly properties: {
|
|
141
|
+
readonly structure: {
|
|
142
|
+
readonly enum: readonly ["chained", "suffix", "attribute"];
|
|
143
|
+
};
|
|
144
|
+
readonly separator: {
|
|
145
|
+
readonly type: "string";
|
|
146
|
+
};
|
|
147
|
+
readonly propValue: {
|
|
148
|
+
readonly type: "boolean";
|
|
149
|
+
};
|
|
150
|
+
readonly propValueSeparator: {
|
|
151
|
+
readonly type: "string";
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
}];
|
|
155
|
+
};
|
|
156
|
+
readonly rules: {
|
|
157
|
+
readonly description: "Per-rule severity overrides (off/warn/error).";
|
|
158
|
+
readonly type: "object";
|
|
159
|
+
readonly additionalProperties: {
|
|
160
|
+
readonly enum: readonly ["off", "warn", "error"];
|
|
161
|
+
};
|
|
162
|
+
};
|
|
123
163
|
};
|
|
124
164
|
};
|
|
125
165
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -63,6 +63,37 @@ const cssDocSchema = {
|
|
|
63
63
|
description: "Enable or disable specific tags by name.",
|
|
64
64
|
type: "object",
|
|
65
65
|
additionalProperties: { type: "boolean" }
|
|
66
|
+
},
|
|
67
|
+
modifierConvention: {
|
|
68
|
+
description: "How modifier classes are spelled: a preset name (bem, rscss, bare) or a custom convention.",
|
|
69
|
+
oneOf: [{ enum: [
|
|
70
|
+
"bem",
|
|
71
|
+
"rscss",
|
|
72
|
+
"bare"
|
|
73
|
+
] }, {
|
|
74
|
+
type: "object",
|
|
75
|
+
additionalProperties: false,
|
|
76
|
+
required: ["structure", "separator"],
|
|
77
|
+
properties: {
|
|
78
|
+
structure: { enum: [
|
|
79
|
+
"chained",
|
|
80
|
+
"suffix",
|
|
81
|
+
"attribute"
|
|
82
|
+
] },
|
|
83
|
+
separator: { type: "string" },
|
|
84
|
+
propValue: { type: "boolean" },
|
|
85
|
+
propValueSeparator: { type: "string" }
|
|
86
|
+
}
|
|
87
|
+
}]
|
|
88
|
+
},
|
|
89
|
+
rules: {
|
|
90
|
+
description: "Per-rule severity overrides (off/warn/error).",
|
|
91
|
+
type: "object",
|
|
92
|
+
additionalProperties: { enum: [
|
|
93
|
+
"off",
|
|
94
|
+
"warn",
|
|
95
|
+
"error"
|
|
96
|
+
] }
|
|
66
97
|
}
|
|
67
98
|
}
|
|
68
99
|
};
|
|
@@ -96,6 +127,13 @@ var CssDocConfigFile = class CssDocConfigFile {
|
|
|
96
127
|
supportForTags;
|
|
97
128
|
/** The resolved files this one `extends`, in declaration order. */
|
|
98
129
|
extendsFiles;
|
|
130
|
+
/** The modifier convention declared by this file, if any. */
|
|
131
|
+
modifierConvention;
|
|
132
|
+
/**
|
|
133
|
+
* The per-rule severity overrides, merged across the `extends` chain (this file wins). Not the
|
|
134
|
+
* resolved severities — pass these to `resolveRuleSeverities` in `@cssdoc/providers`.
|
|
135
|
+
*/
|
|
136
|
+
ruleSeverities;
|
|
99
137
|
constructor(init) {
|
|
100
138
|
this.filePath = init.filePath;
|
|
101
139
|
this.fileNotFound = init.fileNotFound;
|
|
@@ -104,6 +142,11 @@ var CssDocConfigFile = class CssDocConfigFile {
|
|
|
104
142
|
this.tagDefinitions = init.tagDefinitions;
|
|
105
143
|
this.supportForTags = init.supportForTags;
|
|
106
144
|
this.extendsFiles = init.extendsFiles;
|
|
145
|
+
this.modifierConvention = init.modifierConvention;
|
|
146
|
+
const severities = {};
|
|
147
|
+
for (const extended of init.extendsFiles) Object.assign(severities, extended.ruleSeverities);
|
|
148
|
+
Object.assign(severities, init.rules);
|
|
149
|
+
this.ruleSeverities = severities;
|
|
107
150
|
}
|
|
108
151
|
/** Whether this file — or any file it extends — reported an error. */
|
|
109
152
|
get hasErrors() {
|
|
@@ -127,6 +170,7 @@ var CssDocConfigFile = class CssDocConfigFile {
|
|
|
127
170
|
const definition = configuration.tryGetTagDefinition(tagName);
|
|
128
171
|
if (definition) configuration.setSupportForTag(definition, supported);
|
|
129
172
|
}
|
|
173
|
+
if (this.modifierConvention !== void 0) configuration.setModifierConvention(this.modifierConvention);
|
|
130
174
|
}
|
|
131
175
|
/**
|
|
132
176
|
* Build a {@link CssDocConfiguration} from this file. Convenience for the common case.
|
|
@@ -170,7 +214,8 @@ var CssDocConfigFile = class CssDocConfigFile {
|
|
|
170
214
|
noStandardTags: false,
|
|
171
215
|
tagDefinitions: [],
|
|
172
216
|
supportForTags: /* @__PURE__ */ new Map(),
|
|
173
|
-
extendsFiles: []
|
|
217
|
+
extendsFiles: [],
|
|
218
|
+
rules: {}
|
|
174
219
|
});
|
|
175
220
|
}
|
|
176
221
|
static _loadFile(filePath, visited) {
|
|
@@ -182,7 +227,8 @@ var CssDocConfigFile = class CssDocConfigFile {
|
|
|
182
227
|
noStandardTags: false,
|
|
183
228
|
tagDefinitions: [],
|
|
184
229
|
supportForTags: /* @__PURE__ */ new Map(),
|
|
185
|
-
extendsFiles: []
|
|
230
|
+
extendsFiles: [],
|
|
231
|
+
rules: {}
|
|
186
232
|
});
|
|
187
233
|
if (visited.has(filePath)) {
|
|
188
234
|
messages.push("Circular extends reference; skipped.");
|
|
@@ -226,7 +272,9 @@ var CssDocConfigFile = class CssDocConfigFile {
|
|
|
226
272
|
noStandardTags: raw.noStandardTags ?? false,
|
|
227
273
|
tagDefinitions,
|
|
228
274
|
supportForTags: new Map(Object.entries(raw.supportForTags ?? {})),
|
|
229
|
-
extendsFiles
|
|
275
|
+
extendsFiles,
|
|
276
|
+
modifierConvention: raw.modifierConvention,
|
|
277
|
+
rules: raw.rules ?? {}
|
|
230
278
|
});
|
|
231
279
|
}
|
|
232
280
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cssdoc/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Load a cssdoc.json configuration file (custom tags, extends) into an @cssdoc/core CssDocConfiguration — TSDoc-config, for CSS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"ajv": "^8.20.0",
|
|
34
|
-
"@cssdoc/core": "0.
|
|
34
|
+
"@cssdoc/core": "0.2.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^24.13.3",
|