create-linkdesk-plugin 0.1.8 → 0.1.9
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/package.json +1 -1
- package/template/scripts/ci-verify.mjs +26 -14
package/package.json
CHANGED
|
@@ -127,29 +127,38 @@ if (report) process.stdout.write(renderPluginLintReport(report) + "\n");
|
|
|
127
127
|
* 但必须响亮打印——静默放过才是真问题。
|
|
128
128
|
*/
|
|
129
129
|
const RULE_NOT_FOUND_RE = /^Definition for rule '.*' was not found/;
|
|
130
|
-
/** 按腿取偏离数(label 与 lint.ts 的 legs 一致) */
|
|
131
|
-
const legCount = (label) => report?.legs.find((l) => l.label === label)?.violations.length ?? 0;
|
|
132
130
|
|
|
133
131
|
const allRows = report?.eslintRows ?? [];
|
|
134
132
|
const ruleNotFound = allRows.filter((r) => RULE_NOT_FOUND_RE.test(r.message));
|
|
135
133
|
const strictEslintRows = allRows.filter((r) => !RULE_NOT_FOUND_RE.test(r.message));
|
|
136
|
-
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
134
|
+
/**
|
|
135
|
+
* 判红的两样:真 eslint 偏离 + check 腿偏离(见下 ②③④⑤)。
|
|
136
|
+
* 🔴 **严格腿 = 除「报表档」外的全部腿**(fail-closed):SDK 新增一条腿(如 check-css-namespace)
|
|
137
|
+
* 自动进严格档——想放宽必须把腿名写进 ADVISORY_LEGS 并说明理由,不许默默不查。
|
|
138
|
+
*/
|
|
139
|
+
const ADVISORY_LEGS = new Set(["check-font-scale", "check-spacing-grid"]);
|
|
140
|
+
const reportLegs = report?.legs ?? [];
|
|
141
|
+
const strictLegs = reportLegs.filter((l) => !ADVISORY_LEGS.has(l.label));
|
|
142
|
+
const strictLegViolations = strictLegs.reduce((sum, l) => sum + l.violations.length, 0);
|
|
143
|
+
const strictLintViolations = strictEslintRows.length + strictLegViolations;
|
|
144
|
+
/** 报表档:字号度量与 4px 节奏——属「审美校准」,存量偏离多且修它们要动插件源码 */
|
|
145
|
+
const advisoryLintViolations = reportLegs
|
|
146
|
+
.filter((l) => ADVISORY_LEGS.has(l.label))
|
|
147
|
+
.reduce((sum, l) => sum + l.violations.length, 0);
|
|
141
148
|
|
|
142
149
|
if (lintNoObject) {
|
|
143
150
|
line(`⏭ ① lint 严格腿:${lintNoObject}——本仓**无对象**(不是「绿」,是「没有可查的东西」)。`);
|
|
144
151
|
} else if (strictLintViolations > 0) {
|
|
145
152
|
fail(
|
|
146
|
-
`① lint 严格腿:${strictLintViolations} 处偏离(eslint ${strictEslintRows.length} +
|
|
147
|
-
|
|
153
|
+
`① lint 严格腿:${strictLintViolations} 处偏离(eslint ${strictEslintRows.length} + ` +
|
|
154
|
+
strictLegs.map((l) => `${l.label} ${l.violations.length}`).join(" + ") +
|
|
155
|
+
`)——SDK 的 \`npm run lint\` 只报告不拦,**CI 拦**。逐条见上方报告。`,
|
|
148
156
|
);
|
|
149
157
|
} else {
|
|
150
158
|
line(
|
|
151
|
-
`✅ ① lint 严格腿:eslint 规则腿 ${report.files} 文件 +
|
|
152
|
-
|
|
159
|
+
`✅ ① lint 严格腿:eslint 规则腿 ${report.files} 文件 + ` +
|
|
160
|
+
strictLegs.map((l) => `${l.label} 零偏离`).join(" + ") +
|
|
161
|
+
`(本段判红的是「硬约束」那一档)。`,
|
|
153
162
|
);
|
|
154
163
|
}
|
|
155
164
|
if (ruleNotFound.length > 0) {
|
|
@@ -161,9 +170,12 @@ if (ruleNotFound.length > 0) {
|
|
|
161
170
|
}
|
|
162
171
|
if (advisoryLintViolations > 0) {
|
|
163
172
|
line(
|
|
164
|
-
` ⚠
|
|
165
|
-
|
|
166
|
-
|
|
173
|
+
` ⚠ 附加腿(**报告不拦**):` +
|
|
174
|
+
reportLegs
|
|
175
|
+
.filter((l) => ADVISORY_LEGS.has(l.label))
|
|
176
|
+
.map((l) => `${l.label.replace("check-", "")} ${l.violations.length} 处`)
|
|
177
|
+
.join(" / ") +
|
|
178
|
+
`——字号度量与 4px 节奏属审美校准档,逐条见上方报告;确属有意的用标准 disable 注释写明理由。`,
|
|
167
179
|
);
|
|
168
180
|
}
|
|
169
181
|
|