Skip to content

feat(lint-md-core): upgrade @lint-md/cli to @lint-md/core v2#23

Merged
luojiyin1987 merged 9 commits into
mainfrom
feat/upgrade-lint-md-core
Jul 3, 2026
Merged

feat(lint-md-core): upgrade @lint-md/cli to @lint-md/core v2#23
luojiyin1987 merged 9 commits into
mainfrom
feat/upgrade-lint-md-core

Conversation

@luojiyin1987

@luojiyin1987 luojiyin1987 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

变更内容

  • 替换依赖:@lint-md/cli ^0.1.8 → @lint-md/core ^2.1.2 + glob ^13.0.6
  • 重写 lint-md-action.ts 使用 lintMarkdown API
  • 实现文件加载(目录递归、glob、excludeFiles)
  • 更新规则名:space-round-alphabet → space-around-alphabet
  • 移除过时的 src/@lint-md/cli.d.ts
  • 更新测试以适配新 API + 补充 loader 测试(目录递归、glob pattern、excludeFiles)
  • 更新 README.md,版本号 → 0.2.0
  • 从 Yarn 迁移到 npm(删除 PnP 文件,CI 改用 npm ci)
  • 重建 dist/index.js

验证

  • TypeScript 编译:✅ 无错误
  • Build (dist/index.js):✅ 重建成功
  • npm test:✅ 11/11 通过

Closes #22

- Replace @lint-md/cli ^0.1.8 with @lint-md/core ^2.1.2 + glob ^13.0.6
- Rewrite lint-md-action.ts to use lintMarkdown API from @lint-md/core
- Implement file loading with glob (directory recursion, excludeFiles)
- Update rule names: space-round-alphabet -> space-around-alphabet
- Remove obsolete src/@lint-md/cli.d.ts (core includes types)
- Update tests to match new API (ReportOption format)
- Update README.md with new version and rule names
- Rebuild dist/index.js
@luojiyin1987 luojiyin1987 added the enhancement New feature or request label Jul 3, 2026
- Replace LintResultWithPath (extends ReportOption) with proper LintResultItem
  interface that includes severity field from lintMarkdown return type
- Add FileLintResult interface with { path, errors[] } structure
- Update getErrors() to return FileLintResult[] (grouped by file)
- Update isPass() to flatten fileResults before filtering
- Rebuild dist/index.js
glob v13 returns only the directory path itself (not its contents) when
given a bare directory. The extension filter then removes it since it
doesn't end with .md. Detect directories via fs.statSync and append
/**/* so glob recurses into them.
The new API stores the full file path (e.g., .../bad.md) instead of
just the directory. Update 3 test assertions to match.
space-round-alphabet → space-around-alphabet (v2 rule rename)
Missing config file is normal (most users use default rules), not
a warning condition. Use core.info instead of core.warning.
- package.json version 0.1.2 → 0.2.0 (align with README)
- lint(): reset fileResults on each call to prevent accumulation
- Add test: directory recursion (files as directory path)
- Add test: glob pattern matching (files as specific .md path)
- Add test: excludeFiles exclusion via .lintmdrc config
- Add examples/.lintmdrc for excludeFiles test fixture
…s test

'./*' after path.resolve becomes '/.../examples/./*' which glob
can't parse with absolute: true. Use './' (directory) so the
loadMdFiles directory-expansion logic kicks in.
- Remove Yarn-specific files (.pnp.cjs, .pnp.loader.mjs, .yarn/, yarn.lock)
- Update .gitignore: remove yarn.lock and .yarnrc.yml, un-ignore package-lock.json
- Generate fresh package-lock.json with npm install
- Update CI build.yml: yarn install → npm ci, yarn test → npm test
@luojiyin1987 luojiyin1987 merged commit 9b62805 into main Jul 3, 2026
3 checks passed
@luojiyin1987 luojiyin1987 deleted the feat/upgrade-lint-md-core branch July 3, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: upgrade @lint-md/cli to @lint-md/core v2

1 participant