Skip to content

fix(eslint-plugin): 发布白名单后续 — 测试/pack:verify/DRY 收敛 - #60

Merged
Tanya7z merged 4 commits into
mainfrom
cursor/bc-3f73f247-b5ee-4b1b-aff6-a904b25c9f26-0a33
Jul 24, 2026
Merged

fix(eslint-plugin): 发布白名单后续 — 测试/pack:verify/DRY 收敛#60
Tanya7z merged 4 commits into
mainfrom
cursor/bc-3f73f247-b5ee-4b1b-aff6-a904b25c9f26-0a33

Conversation

@cursor

@cursor cursor Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

背景

main@a6ae7d1@sfmc-bds/eslint-plugin 登记进 NPM_PUBLISH_PACKAGES,并在 tsconfig 排除 *.test.ts(避免测试进发布产物)。ootb / npm-publish @sfmc-bds/eslint-plugin@v0.1.0 均已绿。

本 PR 修复该推送暴露的可验证 DRY/DIP 问题。

审查(DRY / OCP / DIP / LSP / Demeter)

级别 原则 问题
MAJOR DRY / OCP exclude *.test.tsnpm test 仍期望 dist/**/*.test.js,测试永不 emit
MAJOR LSP RuleTesterdescribe/it 都绑到顶层 test,嵌套用例被 parent 取消(74→0)
MAJOR DRY pack:verify 手抄 npm pack -w 列表,漏掉刚登记的 eslint-plugin
MAJOR DRY 6 条规则重复 Import/Export source 访问器样板
MAJOR DIP / DRY SDK_PUBLIC_EXPORTS 与 SDK package.json#exports 双份维护
MINOR DRY plugin.meta.version 硬编码,与 package.json 漂移
MINOR DRY 发布文档包表未列 eslint-plugin

改动

  1. tsconfig.test.json + build:test:发布 build 继续排除测试/rule-tester;测试走独立编译
  2. RuleTester:改用 node:testdescribe / it / after
  3. tools/pack-verify.mjs:从 NPM_PUBLISH_PACKAGES 派生 pack 列表;根脚本改为调用它
  4. visitModuleSourceLiterals:收敛 import/export 字面量访问
  5. loadSdkPublicExports():优先读 sibling/已安装 SDK 的 exports;否则回落静态表
  6. plugin.meta:name/version 读本包 package.json

验证

  • npm run build -w @sfmc-bds/eslint-plugin(dist 无 *.test.js / rule-tester
  • npm test -w @sfmc-bds/eslint-plugin74 pass
  • npm pack -w @sfmc-bds/eslint-plugin(tarball 无测试产物)
  • assertPublishPackageInWorkspaces 覆盖全部清单包

未改

Open in Web View Automation 

cursoragent and others added 3 commits July 23, 2026 18:12
exclude *.test.ts 后 npm test 不再 emit dist/**/*.test.js;
新增 tsconfig.test.json,并从发布 build 排除仅测试用的 rule-tester。
RuleTester 改用 node:test 的 describe/it/after,避免嵌套用例被取消。

Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
注册 eslint-plugin 后根脚本仍手抄 npm pack 列表会漏包;
改为 tools/pack-verify.mjs 遍历权威清单,并补齐发布文档表格。

Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
抽取 visitModuleSourceLiterals;SDK 公开子路径优先读 package.json#exports;
plugin.meta.version 从本包 package.json 读取,避免双份版本。

Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
@Tanya7z
Tanya7z marked this pull request as ready for review July 24, 2026 11:11
@cursor

cursor Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@Tanya7z
Tanya7z merged commit 424b9f4 into main Jul 24, 2026
1 check passed
@Tanya7z
Tanya7z deleted the cursor/bc-3f73f247-b5ee-4b1b-aff6-a904b25c9f26-0a33 branch July 25, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants