@abap2ui5/linter

中文文档
0.9.0发布于 2026/10/14MITTypeScriptES Module零依赖构建来源已验证近 30 天下载 4653

Validate abap2UI5 app classes without an SAP system: the ABAP and the view it builds, checked together.

原始使用文档
文档目录7 节
  1. Documentation
  2. Portable apps (opt-in)
  3. Legacy-free code on an old target
  4. Where it runs
  5. Used by
  6. Working on this repository
  7. Credits

abap2UI5 linter

Validate abap2UI5 app classes without an SAP system — a CLI, library and GitHub Action extracted from the CI gates of samples-controls, where they guard its generated ports of the official UI5 demo kit samples (how many is in that repository's STATUS.md — it grows weekly, and a number written down here is a number that goes stale).

It checks a whole app class, not just the XML it emits: the ABAP source and the view it builds are validated together. The defects that matter most are the ones living between the two — a bound attribute whose ABAP field does not exist, an event argument the control never delivers — and no UI5 tooling can see them, because the view only exists at runtime.

npx @abap2ui5/linter src

That is the whole of it: no install, no SAP system, no configuration. ~600 kB and no dependencies, so the line above is a fast one.

src/zcl_my_app.clas.abap
  36:14  error  sap.m.Page has no aggregation contentt - typo?                       unknown-aggregation
  40:22  error  sap.m.Button type="Emphasised" is not a valid value (allowed: ...)   invalid-property-value

Then, when you want it to stay green:

npm install -D @abap2ui5/linter                     # pin it for CI and for your machine
npx --no-install abap2ui5lint --init                # write a commented abap2ui5lint.jsonc
npx --no-install abap2ui5lint src --all-classes     # every class: the ones that build no view get the source-side rules
npx --no-install abap2ui5lint src --watch           # run, then re-run on every save - the loop for Eclipse ADT + abapGit
npx --no-install abap2ui5lint --explain unknown-control   # what a reported id means, with the before/after pair - in the terminal

--no-install is deliberate: abap2ui5lint is the command the package installs, not a package name, and a bare npx abap2ui5lint run where the package is NOT installed would download whatever is published under that name on npm. Without an install, use the scoped npx @abap2ui5/linter ….

Documentation

→ The linter, in full — the two gates and what each one catches, --screenshot, --fix, waivers, the baseline for adopting it on a codebase that already exists, the config file, the GitHub Action, the badges and the library API.

→ Rule reference — every rule id with the paragraph explaining what it means and why it exists. The id printed at the end of a finding is the anchor.

Two more entry points, for the two other ways in:

Adding the render gatenpm i -D @abap2ui5/linter-render + npx playwright install chromium — the headless XMLView.create that catches a view which fails to load
Starting a projectapp-template ships the CLI, the config and the workflow already wired up

Portable apps (opt-in)

An abap2UI5 app runs on the UI5 frontend whatever it writes. To keep it renderable by non-UI5 frontends as well — the UI5 Web Components frontend (frontend-webcomponent), an Adaptive Cards renderer, an agent — ask for the portable-app rule:

// abap2ui5lint.jsonc
{
  "rules": { "portable-app": "error" }   // or "warning" / "hint"; off by default
}

It reports everything outside the abap2UI5 protocol's portable profile v1: controls and members it does not list, z2ui5.cc custom controls, named models and other binding forms, expression constructs outside its grammar (RegExp, odata.*, …), event arguments such as $event, frontend actions such as CONTROL_BY_ID, and the nested view slots (nest_view_display( )). Each finding names the reason; the rule card lists them all. The profile is a verbatim copy of the protocol's profiles/portable-v1.json in data/ (its source commit beside it), refreshed with npm run sync-portable-profile. One class opts out with " abap2ui5lint-disable portable-app at its top, a path with the rule's exclude list.

Legacy-free code on an old target

ui5 is the release your system runs, and a deprecation is reported once it is in effect there — right for "will this break", silent about "is this legacy". An app held to 1.71 so that it runs on old systems can still be measured against SAP's legacy-free baseline with a second bound:

// abap2ui5lint.jsonc
{
  "ui5": "1.71",
  "deprecatedAt": "1.136"   // or --deprecated-at 1.136
}

Everything deprecated after the target and up to the horizon — controls, their properties and events, and native XHTML/SVG markup — is then a deprecated-after-target hint that names the replacement and says whether your target already has it (sap.m.MessagePage → IllustratedMessage, which needs 1.98: keep it until the target moves). Every other rule still judges against ui5.

Where it runs

The CLI, a GitHub Action (abap2UI5/linter@v0), and a library — plus two consumers of that library: mcp-server exposes these gates as MCP tools for AI coding agents, and the VS Code extension surfaces the findings as editor diagnostics while you type. All of them read the same abap2ui5lint.jsonc, so the editor, the agent and CI agree.

Used by

11 public repositories declare @abap2ui5/linter in a manifest — GitHub's own list, refreshed here monthly:

Only a manifest entry is counted here — that is what GitHub's dependency graph can see. A repository that runs the linter through npx --yes or the Action is a user, but never appears in this list.

Working on this repository

npm ci
npx playwright install chromium   # the render runtime is an npm workspace here
node cli.mjs test/fixtures --no-render   # the CLI, from the checkout, over its own fixtures
node cli.mjs ../your-app/src             # or over a sibling app (this checkout has no src/)
npm test

AGENTS.md carries the conventions and what every gate checks; CONTRIBUTING.md and RELEASING.md the rest of the workflow.

Four artefacts are generated and gated by npm test, so a stale one fails the build:

npm run generate-metadata    # data/properties.json, from the @openui5 sources
npm run generate-schema      # data/abap2ui5lint.schema.json — editor completion
npm run generate-rules-page  # site/index.html — the published rule reference
npm run generate-compat      # data/compat.json — which abap2UI5 releases this linter line understands (the ./compat export)

Two further generators need network, so the suite cannot regenerate them and the committed file is the contract instead; a scheduled workflow refreshes each one and opens a PR with the diff:

npm run generate-icons       # data/icons.json — the SAP icon-font snapshot
npm run generate-dependents  # the "Used by" list above, from GitHub's dependents page

One file is vendored from another repository rather than generated, and is refreshed by hand when the protocol moves (npm test pins its hash, the weekly upstream-sync workflow reports drift):

npm run sync-portable-profile   # data/portable-v1.json — abap2UI5/protocol's portable profile (-- --local <checkout> to read a clone)

site/ holds that generated rule reference (published to https://abap2ui5.github.io/linter/), not documentation about this repository.

experimental/github-app/ is a spike — a working prototype of the linter as a hosted GitHub App, kept as documentation that happens to execute. It is not deployed, not registered, not shipped on npm and not supported. The delivered channels are the CLI, the library and the Action.

Credits

The reconstruction, mock-model derivation, render harness and property gate were built and battle-tested in samples-controls against the official UI5 demo kit corpus — where scripts/view-gates.mjs now consumes this package as the extraction of those original gates. This package is the corpus-independent extraction.

版本与发布记录

@abap2ui5/linter 共发布 20 个版本,首次发布于 2026/08/15;过去 12 个月发布了 20 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.9.0latest2026/10/1424 天前
0.8.52026/10/011 个月前
0.8.42026/09/301 个月前
0.8.32026/09/281 个月前
0.8.22026/09/281 个月前
0.8.12026/09/271 个月前

关于 @abap2ui5/linter 的常见问题

@abap2ui5/linter 是什么?

Validate abap2UI5 app classes without an SAP system: the ABAP and the view it builds, checked together.

如何安装 @abap2ui5/linter?

在项目目录运行 npm install @abap2ui5/linter,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 abap2ui5lint、abap2ui5-lint,可以用 npx abap2ui5lint 直接运行。

@abap2ui5/linter 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@abap2ui5/linter 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@abap2ui5/linter 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@abap2ui5/linter 可以商用吗?

@abap2ui5/linter 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@abap2ui5/linter 的下载量有多少?

根据 npm 官方下载统计,@abap2ui5/linter 在 2026/10/05 – 2026/11/03 这 30 天内被下载 4,653 次,日均约 155 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@abap2ui5/linter 还在维护吗?

最新版本 0.9.0 发布于 2026/10/14(24 天前);至今共发布 20 个版本,其中过去 12 个月发布了 20 个;首次发布于 2026/08/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。