eslint-rule-development
БесплатноБез исполняемых скриптовНе проверенDevelop a new ESLint rule for @sap-ux/eslint-plugin-fiori-tools. Always use this skill when adding any rule to the plugin, implementing…
от SAP★ 162 звезды на GitHubОб этом скилле
Fiori ESLint Rule Developer
Add a new ESLint rule to @sap-ux/eslint-plugin-fiori-tools following the established patterns in the monorepo.
⚡ Efficiency rules — read before doing anything
- Use the
Readtool directly — neverBash cator spawn Explore subagents for file reading - Read everything in one parallel batch — each fast path lists the exact files; read them all at once in a single turn
- Run only the new test file during development — not the full package suite:
NODE_OPTIONS="--experimental-vm-modules" npx jest --testPathPatterns="sap-[rule-name]" --no-coverage
Step 1 — Identify the rule type, then read the reference file
| Type | Use when | Reference file |
|---|---|---|
| Annotation rule | Validates UI.* OData annotations in .xml / .cds files. Also, covers rules where text, that is, a label, title, or description, can be an i18n binding |
references/annotation.md |
| Manifest JSON rule | Validates manifest.json properties |
references/manifest-json.md |
| Flex change file rule | Validates webapp/changes/*.change (Applicable only to OData V2 flex change properties) |
references/flex-change.md |
| JavaScript / TypeScript rule | Validates JS/TS application source code (UI5 patterns, global variables, deprecated APIs) | references/js-ts-rule.md |
Infer from the request:
- Rule name —
sap-[kebab-case-name]pattern - OData version — V2 only, V4 only, or both
- Page scope — which page types to check. Default: all page types (list report, object page, etc.) unless the spec explicitly restricts the scope. Do not limit to one page type based on the examples in the spec.
- Auto-fix — yes/no
- Severity —
errororwarn. Rules inrecommended-for-s4hanaMUST bewarn.
OData version determines the linker file — always follow the stated version:
| OData version | Linker file | Manifest root |
|---|---|---|
| V2 only | src/project-context/linker/fe-v2.ts |
sap.ui.generic.app.pages.* |
| V4 only | src/project-context/linker/fe-v4.ts |
sap.ui5.routing.targets.* |
| Both | both linker files | both roots |
Read the matching reference file immediately, then read all the files it lists in a single parallel batch. If the rule spans multiple types (e.g. annotations + manifest, or manifest + flex changes), read all matching reference files and combine their templates and access patterns.
Steps 2–10: Implementation Checklist
Step 2 — Add diagnostic constant (annotation, manifest JSON, and flex change rules only; skip for JS/TS rules)
In packages/eslint-plugin-fiori-tools/src/language/diagnostics.ts:
export const MY_RULE = 'sap-my-new-rule';
export interface MyRuleDiagnostic {
type: typeof MY_RULE;
// ... fields from the reference file's "Required diagnostic fields" table
}
// Add MyRuleDiagnostic to the Diagnostic union at the bottom
Step 3 — Implement the rule
Use the template from the reference file for your rule type.
Code quality requirements for every new or modified function:
- JSDoc — add a JSDoc block (
@param,@returns) to every new function. When modifying an existing function, update its JSDoc to reflect any signature or behaviour changes. - Cognitive complexity ≤ 15 — enforced by
sonarjs/cognitive-complexity. If a function exceeds 15, extract branches or loops into well-named helper functions until the complexity falls within the limit. Do not inline complex logic in a single function to avoid this. - Backtick code indicators in messages — in rule warning messages, wrap all code-like values in backticks: property names, annotation names, property values, entity names, and any other identifier that appears verbatim in source. Plain prose words stay unquoted.
// ✅ Correct — code values in backticks message: "The `UI.LineItem` annotation is missing the required `Criticality` property."
Step 4 — Register the rule
src/rules/index.ts — add import + entry (alphabetical order):
import sapMyNewRule from './sap-my-new-rule.js';
// ...
[MY_RULE]: sapMyNewRule,
src/index.ts — add to fioriLanguageConfig rules (Fiori language rules) or baseFioriToolsRules (JS/TS rules):
'@sap-ux/fiori-tools/sap-my-new-rule': 'warn',
If the rule should also apply to S/4HANA projects, add it to the recommended-for-s4hana config in src/index.ts as well. Rules in this config must use 'warn' severity:
// In the recommended-for-s4hana config rules object:
'@sap-ux/fiori-tools/sap-my-new-rule': 'warn',
Step 5 — Write tests
Use the test template from the reference file; run only the new test file (see efficiency rules at the top).
Always check message, never messageId, in errors arrays. When a rule message contains interpolated data (e.g. {{tableType}}), checking only messageId would accept any value fo
Установить eslint-rule-development в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл eslint-rule-development?
Develop a new ESLint rule for @sap-ux/eslint-plugin-fiori-tools. Always use this skill when adding any rule to the plugin, implementing manifest.json/XML/CDS/flex-change validation, writing rule tests with project context, or creating rule documentation — even if the request sounds simple or the user doesn't mention 'ESLint' explicitly. Guides through the complete workflow: diagnostics constant, rule implementation, unit tests, docs, and registration.
Как установить скилл eslint-rule-development?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл eslint-rule-development запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic