@nokecy/qc-ui 2.0.0-beta.17 → 2.0.0-beta.18

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/lint/cli.cjs CHANGED
@@ -16,6 +16,7 @@
16
16
  const path = require('node:path');
17
17
  const fs = require('node:fs');
18
18
  const plugin = require('./index.cjs');
19
+ const { dropForeignRuleNotices } = require('./results.cjs');
19
20
 
20
21
  const cwd = process.cwd();
21
22
  const SCRIPT_EXT = new Set(['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs']);
@@ -118,7 +119,7 @@ async function lintScripts(targets) {
118
119
  }
119
120
  // 显式点名但命中忽略规则的文件(如测试文件)只会得到一条「File ignored」提示,不计入结果
120
121
  const isIgnoredNotice = (r) => r.messages.length === 1 && !r.messages[0].ruleId && /ignore pattern/.test(r.messages[0].message);
121
- const results = (await eslint.lintFiles(targets)).filter((r) => !isIgnoredNotice(r));
122
+ const results = dropForeignRuleNotices((await eslint.lintFiles(targets)).filter((r) => !isIgnoredNotice(r)));
122
123
  const formatter = await eslint.loadFormatter('stylish');
123
124
  return {
124
125
  output: await formatter.format(results),
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * qc-ui-lint 只加载 qc-ui 的规则。项目源码里原有的 `eslint-disable … react-hooks/exhaustive-deps`
5
+ * 这类注释指向未加载的规则,ESLint 会为每一处报「Definition for rule '…' was not found」。
6
+ * 这些提示与设计规范无关,从结果里剔除,并按剩余消息重算计数。
7
+ */
8
+ const isForeignRuleNotice = (m) =>
9
+ typeof m.ruleId === 'string' && !m.ruleId.startsWith('qc-ui/') && /^Definition for rule /.test(m.message);
10
+
11
+ function dropForeignRuleNotices(results) {
12
+ return results.map((r) => {
13
+ const messages = r.messages.filter((m) => !isForeignRuleNotice(m));
14
+ if (messages.length === r.messages.length) return r;
15
+ const count = (pred) => messages.filter(pred).length;
16
+ return {
17
+ ...r,
18
+ messages,
19
+ errorCount: count((m) => m.severity === 2),
20
+ warningCount: count((m) => m.severity === 1),
21
+ fatalErrorCount: count((m) => m.fatal),
22
+ fixableErrorCount: count((m) => m.severity === 2 && m.fix),
23
+ fixableWarningCount: count((m) => m.severity === 1 && m.fix),
24
+ };
25
+ });
26
+ }
27
+
28
+ module.exports = { dropForeignRuleNotices };
@@ -2,7 +2,12 @@
2
2
  const { elementName, propKey, cite } = require('../utils.cjs');
3
3
 
4
4
  const HEIGHT_PROPS = new Set(['rowHeight', 'headerHeight', 'groupHeaderHeight', 'floatingFiltersHeight', 'getRowHeight']);
5
- const TABLE_LIKE = /Table|Grid/;
5
+ /**
6
+ * 只认表格组件:`*Table`(Table / ProTable / ArrayTable / EditableProTable)与名称含 AgGrid 的
7
+ * (AgGridReact / AgGridPlus / StandardAgGridPlus / BaseAgGridPlus)。
8
+ * react-grid-layout 的 GridLayout / ResponsiveGridLayout 也有 rowHeight,那是看板格高,不是表格行高。
9
+ */
10
+ const TABLE_LIKE = /Table$|AgGrid/;
6
11
 
7
12
  module.exports = {
8
13
  meta: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nokecy/qc-ui",
3
- "version": "2.0.0-beta.17",
3
+ "version": "2.0.0-beta.18",
4
4
  "description": "Backward-compatible QC_UI public API",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -2292,9 +2292,9 @@
2292
2292
  "typecheck": "tsc --noEmit -p tsconfig.json"
2293
2293
  },
2294
2294
  "dependencies": {
2295
- "@nokecy/qc-ui-business": "2.0.0-beta.17",
2296
- "@nokecy/qc-ui-components": "2.0.0-beta.17",
2297
- "@nokecy/qc-ui-form-designer": "2.0.0-beta.17"
2295
+ "@nokecy/qc-ui-business": "2.0.0-beta.18",
2296
+ "@nokecy/qc-ui-components": "2.0.0-beta.18",
2297
+ "@nokecy/qc-ui-form-designer": "2.0.0-beta.18"
2298
2298
  },
2299
2299
  "peerDependencies": {
2300
2300
  "react": ">=19.0.0 <20",