@sixbell-telco/eslint-plugin-sdk 0.0.0 → 0.1.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # eslint-plugin-sdk Changelog
2
+
3
+ All notable changes to `@sixbell-telco/eslint-plugin-sdk` are documented in this file. Changes to the SDK itself are in the [SDK changelog](https://github.com/EnghouseGlobal/nw-sx-web-libs-ui-kit/blob/develop/projects/sdk/CHANGELOG.md).
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] - 2026-11-13
11
+
12
+ First release. Needs Node 22.12+ or 24, ESLint 9, angular-eslint 19 and `@sixbell-telco/sdk` 4.6.0 or later; the rules read the installed SDK's `manifest.json`.
13
+
14
+ ### Added
15
+
16
+ - **Rules**: `unknown-element`, `unknown-input`, `invalid-input-value` and `deprecated-input` check `st-*` elements, their inputs and outputs and static input values in templates against the SDK manifest
17
+ - **Rules**: `deprecated-token` (fixable) reports utilities of deprecated theme tokens and rewrites them to the role token in `.html` files
18
+ - **Rules**: `entry-point-import` reports barrel imports from `@sixbell-telco/sdk` and entry points that do not exist
19
+ - **Rules**: `no-daisyui-component` reports DaisyUI component classes where a kit component exists
20
+ - **Rules**: `banned-utility` (fixable) reports `transition-all` and `outline-none` (rewritten to `outline-hidden` in `.html` files)
21
+ - **Rules**: app conventions ported from the MFE validators, each finding keeping its original id (`BUTTON_VARIANT_001`, `UI_BUTTON_BASE_001`, `UI_DIALOG_*`, `SDK_UI_*`, `MFE_ROUTE_*`, `MFE_NAV_*`, `MFE_PAGE_HEADER_*`, `MFE_PREF_*`, `MFE_STATUS_*`, `MFE_KIT_UTIL_001`, `MFE_TEST_SDK_MOCK_001`), enabled in `recommended`
22
+ - **Rules**: design-system class rules from the MFE design-system contract, with its ids: `radius-raw` (`DS_RADIUS_RAW`), `radius-role`, `text-raw`, `text-tone`, `surface-tint`, `shadow-raw`, `font-family`, `border-width` and `kit-override`, in `recommended` as warnings until the fleet is clean
23
+ - **Rules**: messages use the terms of the SDK `GLOSSARY.md` (i18n key, layout selector; removed inputs such as `appearance` in backticks); no rule id changed
package/README.md CHANGED
@@ -1,3 +1,250 @@
1
- # @sixbell-telco/eslint-plugin-sdk placeholder
1
+ # @sixbell-telco/eslint-plugin-sdk
2
2
 
3
- This 0.0.0 release is empty. It exists so npm trusted publishing could be set up before the first real release. Install 0.1.0 or later.
3
+ ESLint rules that check Angular templates and imports against the installed `@sixbell-telco/sdk`. The rules read the SDK's component manifest (`@sixbell-telco/sdk/manifest.json`, SDK 4.6.0 or later), so they always match the version you have installed. With no manifest, the rules report nothing.
4
+
5
+ `sdk-tools check` ([`@sixbell-telco/sdk-tools`](../sdk-tools/README.md)) runs these rules for you. Use the plugin directly to see the same findings in your editor and in `npm run lint`:
6
+
7
+ ```js
8
+ // eslint.config.js
9
+ import sdk from '@sixbell-telco/eslint-plugin-sdk';
10
+
11
+ export default [
12
+ // ...your config, with angular-eslint's inline template processor for components
13
+ ...sdk.configs.recommended,
14
+ ];
15
+ ```
16
+
17
+ `recommended` applies the template rules to `**/*.html` (with `@angular-eslint/template-parser`) and the TypeScript rules (`entry-point-import` and the [app conventions](#app-conventions) that read code) to `**/*.ts`. To lint inline templates, keep angular-eslint's `processInlineTemplates` processor on your `.ts` files. To use a manifest file other than the installed one, set `settings: { sixbellSdk: { manifest: 'path/to/manifest.json' } }`.
18
+
19
+ ## Rules
20
+
21
+ | Rule | Default | What it reports |
22
+ | ----------------------------------------------- | -------------- | --------------------------------------------------------------------------- |
23
+ | [`unknown-element`](#unknown-element) | error | An `st-*` element that the SDK does not declare |
24
+ | [`unknown-input`](#unknown-input) | error | An input or output a kit component does not have |
25
+ | [`invalid-input-value`](#invalid-input-value) | error | A value outside an input's allowed values |
26
+ | [`deprecated-input`](#deprecated-input) | warn | An input the SDK marks as deprecated |
27
+ | [`deprecated-token`](#deprecated-token) | warn, fixable | A utility of a deprecated theme token |
28
+ | [`entry-point-import`](#entry-point-import) | error | A barrel import, or an entry point that does not exist |
29
+ | [`no-daisyui-component`](#no-daisyui-component) | error | A DaisyUI component class (`badge`, `btn` ...) where a kit component exists |
30
+ | [`banned-utility`](#banned-utility) | error, fixable | `transition-all`, `outline-none` |
31
+
32
+ ### unknown-element
33
+
34
+ `<st-buton>` is not a component. The message suggests the closest one (`<st-button>`). Elements without the `st-` prefix (`app-*`, native elements) are not checked.
35
+
36
+ ### unknown-input
37
+
38
+ On an `st-*` element, the rule reports a camelCase static attribute that the component doesn't have (`optionLabel="name"` on `st-select`), and a camelCase output it doesn't have (`(onClick)`). The message lists the component's inputs or outputs and suggests the closest name. It does not report:
39
+
40
+ - **Plain HTML attributes and DOM events:** lowercase attributes (`id`, `aria-label`, `class`) and events (`(click)`).
41
+ - **Bound inputs** (`[fancy]`): the Angular type checker reports those (`sdk-tools check`), and it knows every directive the component imports.
42
+ - **Names other directives may own:**
43
+ - common Angular and CDK directive inputs (`formControlName`, `ngModel`, `routerLink` ...);
44
+ - conventional directive prefixes (`app`, `ngx`, `cdk`, `mat` ...);
45
+ - names listed in `settings.sixbellSdk.knownAttributes`. `sdk-tools check` fills this with the project's own directive selectors, inputs and outputs, and its components' `ng-content select` markers.
46
+ - **Other names on an element that carries another directive:** only a near-typo of a kit name (`iconPositon`) is reported there.
47
+
48
+ Inputs and outputs that a component exposes through `hostDirectives` count as its own.
49
+
50
+ ### invalid-input-value
51
+
52
+ `<st-button variant="danger">` or `[variant]="'danger'"` when `variant` only allows `base, primary, secondary, ...`. The rule checks static values and string literals; values from expressions are left to the type checker.
53
+
54
+ ### deprecated-input
55
+
56
+ An input whose JSDoc says `@deprecated`, with the reason.
57
+
58
+ ### deprecated-token
59
+
60
+ A class that uses a deprecated theme token's utility (`shadow-main`, `text-base-placeholder`, `font-nunito-sans` ...). `--fix` rewrites it to the role token (`shadow-overlay`, `text-base-content-muted`, `font-body`), keeping variants and modifiers (`hover:`, `/50`). The fix applies only in `.html` files. In an inline template it is reported without a fix, because escapes in the string would shift the offsets.
61
+
62
+ ### entry-point-import
63
+
64
+ `import { ... } from '@sixbell-telco/sdk'` (the barrel), or a path such as `@sixbell-telco/sdk/components/buton` that is not an entry point. The message suggests the closest entry point. The package's stylesheet, manifest and i18n files (`.css`, `.json`) are allowed.
65
+
66
+ ### no-daisyui-component
67
+
68
+ `<span class="badge">` or `<button class="btn btn-primary">` builds a DaisyUI component by hand where the kit has one. The message names the kit component and its entry point (`<st-badge>` from `@sixbell-telco/sdk/components/badge`).
69
+
70
+ - **What it reports:** the bare component class, once per element. A modifier such as `badge-success` does nothing without the base class, so it is not reported on its own.
71
+ - **Kit version:** a class is reported only when the installed SDK declares the replacement.
72
+ - **Not reported:** `table` and `collapse`, which are also plain Tailwind utilities, and classes on `st-*` hosts.
73
+
74
+ ### banned-utility
75
+
76
+ - **`transition-all`** animates every property; list the ones that change (`transition-colors`, `transition-[transform,opacity]`).
77
+ - **`outline-none`** removes the focus ring; use `outline-hidden` and keep a `focus-visible` style. `--fix` rewrites it in `.html` files.
78
+
79
+ ## App conventions
80
+
81
+ These rules port the checks of the MFE validators that belong in a linter: the UI composition standard ([DESIGN.md](../../DESIGN.md#ui-composition)), kit APIs that changed, and the Enghouse runtime conventions (routes, navigation, PAGE_HEADER topics, preference selectors, status pages). Each finding keeps the validator's rule id: the id is the finding's `messageId` and starts its message (`[UI_BUTTON_BASE_001] <st-button variant="base"> ...`). `sdk-tools check` runs them all through `recommended`.
82
+
83
+ Some rules read app files: `src/assets/translation/translation.json`, `src/assets/themes/themes.json`, `src/app/core/services/layout/layout.service.ts` and `federation.config.js` (a child declares `exposes`). They resolve them from ESLint's working directory; set `settings.sixbellSdk.appRoot` to read them elsewhere, and `settings.sixbellSdk.appKind` (`host` or `child`) to skip the detection.
84
+
85
+ The `DS_*` design-system rules ship as warnings: the fleet still has hundreds of these hits, so an app that adopts `check` does not turn red on day one. They become errors once the fleet counts, which the corpus ratchet tracks, reach zero.
86
+
87
+ | Id | Rule | Severity | Bad | Good |
88
+ | ----------------------------- | ----------------------------------------------------------- | -------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
89
+ | `BUTTON_VARIANT_001` | [`button-variant`](#button-variant) | warn | `<st-button>Guardar</st-button>` | `<st-button variant="primary">Guardar</st-button>` |
90
+ | `UI_BUTTON_BASE_001` | [`button-role`](#button-role) | warn | `<st-button variant="base">Guardar</st-button>` | `<st-button variant="base" ghost [icon]="back" ariaLabel="Volver" />` |
91
+ | `UI_DIALOG_CONFIRM_001` | [`dialog-actions`](#dialog-actions) | warn | `[Guardar] [Cancelar]` in `st-dialog-actions` | `[Cancelar] [Guardar]`: dismiss first, confirm last |
92
+ | `UI_DIALOG_DELETE_001` | [`dialog-actions`](#dialog-actions) | warn | `<st-button variant="primary" (clicked)="confirmDelete()">Eliminar` | `<st-button variant="error" (clicked)="confirmDelete()">Eliminar` |
93
+ | `SDK_UI_WARN_002` | [`no-nested-card`](#no-nested-card) | warn | `<st-card><st-card>...</st-card></st-card>` | one `st-card` per surface, sections inside it |
94
+ | `SDK_UI_005` | [`button-legacy-input`](#button-legacy-input) | error | `<st-button appearance="flat">` | `<st-button variant="primary" ghost>` |
95
+ | `SDK_UI_006` | [`button-legacy-input`](#button-legacy-input) | error | `<st-button color="accent">` | `<st-button variant="secondary">` |
96
+ | `SDK_UI_001` | [`no-ty-variant`](#no-ty-variant) | error | `<p typography tyVariant="body">` | `<st-text preset="body">` or `<p stText>` |
97
+ | `SDK_UI_002` | [`sonner-toast-api`](#sonner-toast-api) | error | `toast({ title: 'Guardado' })` | `toast.success('Guardado')` |
98
+ | `SDK_UI_007` | [`no-local-st-selector`](#no-local-st-selector) | error | `@Component({ selector: 'st-product-card' })` | `@Component({ selector: 'app-product-card' })` |
99
+ | `MFE_KIT_UTIL_001` | [`no-direct-dayjs`](#no-direct-dayjs) | error | `import dayjs from 'dayjs'` | `import { DateUtils } from '@sixbell-telco/sdk/utils/date'` |
100
+ | `MFE_ROUTE_001` | [`route-metadata`](#route-metadata) | error | `{ path: '', title: '' }` | `{ path: '', title: 'products.title' }` |
101
+ | `MFE_ROUTE_002` | [`route-metadata`](#route-metadata) | error | `data: { subtitle: '' }` | `data: { subtitle: 'products.subtitle' }` |
102
+ | `MFE_ROUTE_003` | [`route-metadata`](#route-metadata) | error | `{ component: GeneralBannerComponent, children: [{ component: List }] }` | children with `data.subtitle`, or `loadChildren` (its routes file sets it) |
103
+ | `MFE_ROUTE_006` | [`route-permissions`](#route-permissions) | warn | `{ canActivate: [PermissionsGuard] }` | `{ canActivate: [PermissionsGuard], data: { permissionsRequired: ['P'] } }` |
104
+ | `MFE_NAV_001` | [`navigate-preserve-menu`](#navigate-preserve-menu) | warn | `router.navigate(['create'], { relativeTo })` | `router.navigate(['create'], { relativeTo, queryParamsHandling: 'preserve' })` |
105
+ | `MFE_NAV_002` | [`navigation-key-guard`](#navigation-key-guard) | error | `return this.translation.instant(key)` | `return key ? this.translation.instant(key) : ''` |
106
+ | `MFE_PAGE_HEADER_001` | [`page-header-topics`](#page-header-topics) | error | child without `PAGE_HEADER_SET` / `PAGE_HEADER_CLEAR` topics | topics in `mfe-page-header.events.ts` |
107
+ | `MFE_PAGE_HEADER_002` | [`page-header-topics`](#page-header-topics) | error | child `setPageHeader` that publishes unconditionally, or no such method | `if (this.isUnderHostMountPrefix()) PubSub.publish(EVENTS.PAGE_HEADER_SET)` |
108
+ | `MFE_PAGE_HEADER_003` | [`page-header-topics`](#page-header-topics) | error | host `init()` without a PAGE_HEADER subscription | `init()` subscribes to `PAGE_HEADER_SET` and `PAGE_HEADER_CLEAR` |
109
+ | `MFE_PREF_001` | [`preference-selectors`](#preference-selectors) | error | `[languages]="getAvailableLanguagesConfig()"` with one language | `@if (showLanguageSelector()) { ... }` |
110
+ | `MFE_PREF_002` | [`preference-selectors`](#preference-selectors) | error | `[themes]="getAvailableThemes()"` with one theme | `@if (showThemeSelector()) { ... }` |
111
+ | `MFE_PREF_003` | [`preference-selectors`](#preference-selectors) | error | `(click)="openLayoutSwitcher()"` with one layout | `@if (showLayoutSelector()) { ... }` |
112
+ | `MFE_CHILD_PREF_001` | [`child-preference-selectors`](#child-preference-selectors) | error | `showLanguageSelector = true` with one language | `showLanguageSelector = false` |
113
+ | `MFE_STATUS_001` | [`status-page-home`](#status-page-home) | error | `resolveFirstAccessibleRoute(menus, permissions)` | `resolveFirstAccessibleRoute(menus)` |
114
+ | `MFE_STATUS_ILLUSTRATION_001` | [`status-illustration`](#status-illustration) | error | the starter placeholder SVG in `offline-illustration.component.html` | the product illustration |
115
+ | `MFE_TEST_SDK_MOCK_001` | [`test-setup-sdk-mock`](#test-setup-sdk-mock) | warn | `jest.mock('@sixbell-telco/sdk/components/table')` in `setup-jest.ts` | mock per spec with ng-mocks, or render the real component |
116
+ | `DS_RADIUS_RAW` | [`radius-raw`](#radius-raw) | warn | `<div class="rounded-lg">` | `<div class="rounded-box">` |
117
+ | `DS_RADIUS_ROLE` | [`radius-role`](#radius-role) | warn | `<span class="rounded-box">Activo</span>` | `<span class="rounded-selector">Activo</span>` |
118
+ | `DS_TEXT_RAW` | [`text-raw`](#text-raw) | warn | `<p class="text-sm font-semibold">` | `<st-text preset="body" weight="semibold">` or `<p stText>` |
119
+ | `DS_TEXT_TONE` | [`text-tone`](#text-tone) | warn | `<p class="text-base-content/60">` | `<p class="text-base-content-muted">` |
120
+ | `DS_SURFACE_TINT` | [`surface-tint`](#surface-tint) | warn | `<div class="bg-primary/10">` | `<div class="bg-base-200">` or `<st-alert>` |
121
+ | `DS_SHADOW_RAW` | [`shadow-raw`](#shadow-raw) | warn | `<div class="shadow-md">` | `<div class="shadow-overlay">` |
122
+ | `DS_FONT_FAMILY` | [`font-family`](#font-family) | warn | `<div class="font-sans">` | inherit the theme font, or `font-heading` |
123
+ | `DS_BORDER_WIDTH` | [`border-width`](#border-width) | warn | `<div class="border-2">` | `<div class="border">`; `border-2 border-dashed` for a drop target |
124
+ | `DS_KIT_OVERRIDE` | [`kit-override`](#kit-override) | warn | `<st-button class="!p-0 [&_svg]:size-4">` | the component input (`size="sm"`), or a kit change |
125
+ | `SDK_UI_003` | [`unknown-element`](#unknown-element) | error | `<st-card-content>` | `<st-card-body>` |
126
+ | `SDK_UI_004` | [`unknown-input`](#unknown-input) | error | `headerTitle="..."` on a kit element | the component's own input |
127
+
128
+ `SDK_UI_003` and `SDK_UI_004` are aliases: the kit rules in the last two rows report them, with their own messages.
129
+
130
+ ### button-variant
131
+
132
+ Every `st-button` names its variant: SDK 3.1 and earlier defaulted to `primary`, so a bare button changed color on the upgrade. A bound `[variant]` counts.
133
+
134
+ ### button-role
135
+
136
+ `variant="base"` is only for ghost or link utilities (shell and icon controls). A solid or outline action takes its role variant.
137
+
138
+ ### dialog-actions
139
+
140
+ In `st-dialog-actions` the confirm (`primary` or `error`, not ghost or link) is the last button, checked per `@if`/`@switch` branch and reported once per dialog. A delete confirm (its label, handler or icon says delete, eliminar, borrar, remove or quitar) is `variant="error"`; dismiss buttons (Cancelar, Cerrar, Volver, a `close*()` handler) and `secondary`/`tertiary` buttons are never a confirm. A bound variant is not judged.
141
+
142
+ ### no-nested-card
143
+
144
+ An `st-card` inside another `st-card`, through control flow. Sibling cards are fine.
145
+
146
+ ### button-legacy-input
147
+
148
+ Static `appearance` and `color` attributes on `st-button` (removed APIs that are plain HTML attributes, so `unknown-input` does not see them). Bound ones are left to the type checker.
149
+
150
+ ### no-ty-variant
151
+
152
+ `tyVariant` on a non-kit element. On an `st-*` element `unknown-input` reports it.
153
+
154
+ ### sonner-toast-api
155
+
156
+ `toast({ ... })`; Sonner takes a message: `toast.success(message)`, `toast.info(message)`, `toast.error(message)`.
157
+
158
+ ### no-local-st-selector
159
+
160
+ A component or directive selector that declares an `st-*` element. A directive that decorates a kit element (`st-button[appSegment]`) is fine.
161
+
162
+ ### no-direct-dayjs
163
+
164
+ An import, dynamic import or `require` of `dayjs` or a `dayjs/...` subpath. Use `DateUtils` or the `st-date` pipe; a direct import also pulls dayjs into the app bundle and invites subpaths that federation externalizes.
165
+
166
+ ### route-metadata
167
+
168
+ In `*.routes.ts`: an empty `title` or `subtitle`, and a `GeneralBannerComponent` route whose children set no `data.subtitle` (a route with `loadChildren` is left to its own routes file).
169
+
170
+ ### route-permissions
171
+
172
+ In `*.routes.ts`: a route guarded by `PermissionsGuard` (`canActivate` or `canActivateChild`) with no `permissionsRequired` on it or its children.
173
+
174
+ ### navigate-preserve-menu
175
+
176
+ `.navigate(...)` without `queryParamsHandling`. Under a `menu-id` host (SBP) the sidebar highlight follows the `?menu` param. Auth and infrastructure targets (auth, logout, offline, server-error, change-password) and redirects inside an `AUTH_EVENTS` subscriber are exempt. Spec and story files are skipped.
177
+
178
+ ### navigation-key-guard
179
+
180
+ In `navigation/navigation.service.ts`: `instant()` with no empty-key guard (`if (key)`, `key ? ... : ''`, `??` or `||`).
181
+
182
+ ### page-header-topics
183
+
184
+ In `navigation/navigation.service.ts`. A child defines the `PAGE_HEADER_SET`/`PAGE_HEADER_CLEAR` topics (in the service or `mfe-page-header.events.ts` next to it) and publishes them from `setPageHeader`/`clearPageHeader` only when mounted under the host (any `if`, `&&` or `?` gate). A host subscribes to both topics in `init()` or in the `subscribeToPageHeaderEvents()` it calls.
185
+
186
+ ### preference-selectors
187
+
188
+ A template that renders a language, theme or layout selector (`getAvailableLanguagesConfig`, `getAvailableThemes()`, `openLayoutSwitcher`) without the `show*Selector` guard (in the template or its component) when the app configures one option.
189
+
190
+ ### child-preference-selectors
191
+
192
+ In `core/preferences/preferences.ts`: `showLanguageSelector` or `showThemeSelector` set to `true` when one language or theme is configured.
193
+
194
+ ### status-page-home
195
+
196
+ In the status page features (`no-access`, `not-found`, `offline`, `server-error`): Home is resolved from the menus only, never with permissions or `sessionService.permissions()`.
197
+
198
+ ### status-illustration
199
+
200
+ A `*-illustration.component` that still holds the starter's placeholder SVG.
201
+
202
+ ### test-setup-sdk-mock
203
+
204
+ In `setup-jest.ts` or `test-setup.ts`: `jest.mock('@sixbell-telco/sdk/...')`. A global mock freezes a copy of the kit's inputs that drifts with every release and hides NG0303 in every spec.
205
+
206
+ ## Design-system classes
207
+
208
+ These rules port the template part of the MFE design-system contract ([DESIGN.md](../../DESIGN.md#geometry-surfaces-and-effects): typography, radius, surfaces, borders, shadows). Each reads the static `class`, the string literals of `[class]` and `[ngClass]`, and `[class.x]` bindings, after variants and `!` are stripped (`md:!rounded-xl` is `rounded-xl`).
209
+
210
+ One owner per finding:
211
+
212
+ - On an `st-*` element, `shadcn/no-restyle` (run by `sdk-tools check`) owns every class that is not layout or spacing, so these rules skip `st-*` elements, except `kit-override`.
213
+ - Arbitrary values (`rounded-[3px]`, `text-[14px]`, `bg-primary/[0.1]`) belong to `shadcn/no-arbitrary-values` and `shadcn/no-raw-colors`.
214
+ - `box-shadow` and `font-family` declarations in stylesheets belong to `check`'s styles step (`DS_SHADOW_RAW`, `DS_FONT_FAMILY`).
215
+
216
+ ### radius-raw
217
+
218
+ A Tailwind radius step (`rounded`, `rounded-lg`, `rounded-t-md`, `rounded-(--my-radius)`). Radius is semantic: `rounded-box` for cards, panels and dialogs, `rounded-field` for controls, `rounded-selector` for badges and chips, `rounded-full` only for circles and pills. `rounded-none` and directional semantic tokens (`rounded-t-box`) are allowed for joined or clipped composition.
219
+
220
+ ### radius-role
221
+
222
+ `rounded-box` on a chip (a `span`, `code` or `kbd`, a `badge`, or a small padded or sized element), and `rounded-field`/`rounded-selector` on a floating surface (a shadow token or a `cdkDragPreview`).
223
+
224
+ ### text-raw
225
+
226
+ Size, weight, leading, tracking and case utilities outside `st-text` and `[stText]`. Alignment, wrapping, truncation and color classes are fine.
227
+
228
+ ### text-tone
229
+
230
+ `text-base-content/60`, `border-base-content/20`: opacity steps of base-content. Text uses `text-base-content-muted` or `text-base-content-secondary`; lines use `border-base-300` or a plain `border`.
231
+
232
+ ### surface-tint
233
+
234
+ An opacity background (`bg-primary/10`, `bg-base-300/50`). Use a surface step or the kit component that owns the tint. `selection:` backgrounds are not surfaces and are not reported.
235
+
236
+ ### shadow-raw
237
+
238
+ A Tailwind shadow step (`shadow`, `shadow-md`, `drop-shadow-lg`). Use `shadow-raised`, `shadow-overlay`, `shadow-floating` or `shadow-modal`.
239
+
240
+ ### font-family
241
+
242
+ `font-sans`, `font-serif` or `font-(--x)`. The theme font is Nunito Sans through `font-body` and `font-heading`; `font-mono` is for code.
243
+
244
+ ### border-width
245
+
246
+ `border-2` and wider. Boundaries use the theme `--border` (1px). Not reported: `border-s-2` (accent stripes) and any width next to `border-dashed` (drop targets).
247
+
248
+ ### kit-override
249
+
250
+ `!` or `[&...]` on an `st-*` element (`!p-0`, `[&_svg]:size-4`, `[&>div]:items-start`): a class that forces a style onto kit internals breaks with the next kit release. Use the component input, or ask for a kit change. Color, typography, shape and effect classes are left to `shadcn/no-restyle`.
package/package.json CHANGED
@@ -1,14 +1,31 @@
1
1
  {
2
2
  "name": "@sixbell-telco/eslint-plugin-sdk",
3
- "version": "0.0.0",
4
- "description": "Placeholder so npm trusted publishing can be configured. Use 0.1.0 or later.",
3
+ "version": "0.1.0",
4
+ "description": "ESLint rules that check Angular templates and imports against the @sixbell-telco/sdk component manifest",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": "./src/index.mjs"
8
+ },
9
+ "files": [
10
+ "src",
11
+ "README.md",
12
+ "CHANGELOG.md"
13
+ ],
5
14
  "license": "Apache-2.0",
15
+ "author": "Enghouse Networks",
6
16
  "repository": {
7
17
  "type": "git",
8
18
  "url": "git+https://github.com/EnghouseGlobal/nw-sx-web-libs-ui-kit.git",
9
19
  "directory": "projects/eslint-plugin-sdk"
10
20
  },
11
- "publishConfig": {
12
- "access": "public"
21
+ "engines": {
22
+ "node": "^22.12.0 || ^24.0.0"
23
+ },
24
+ "peerDependencies": {
25
+ "@angular-eslint/bundled-angular-compiler": "^19.0.0",
26
+ "@angular-eslint/template-parser": "^19.0.0",
27
+ "@angular-eslint/utils": "^19.0.0",
28
+ "@sixbell-telco/sdk": ">=4.6.0",
29
+ "eslint": "^9.0.0"
13
30
  }
14
31
  }
package/src/index.mjs ADDED
@@ -0,0 +1,149 @@
1
+ /**
2
+ * @sixbell-telco/eslint-plugin-sdk: checks Angular templates and imports against the installed
3
+ * @sixbell-telco/sdk manifest (`@sixbell-telco/sdk/manifest.json`), so an agent or a person
4
+ * gets the same answer the SDK's real API gives.
5
+ *
6
+ * Flat config: `import sdk from '@sixbell-telco/eslint-plugin-sdk'; export default [...sdk.configs.recommended];`
7
+ */
8
+ import templateParser from '@angular-eslint/template-parser';
9
+ import {
10
+ childPreferenceSelectors,
11
+ navigatePreserveMenu,
12
+ navigationKeyGuard,
13
+ noDirectDayjs,
14
+ noLocalStSelector,
15
+ pageHeaderTopics,
16
+ routeMetadata,
17
+ routePermissions,
18
+ sonnerToastApi,
19
+ statusPageHome,
20
+ testSetupSdkMock,
21
+ } from './rules/app-rules.mjs';
22
+ import {
23
+ buttonLegacyInput,
24
+ buttonRole,
25
+ buttonVariant,
26
+ dialogActions,
27
+ noNestedCard,
28
+ noTyVariant,
29
+ preferenceSelectorTemplate,
30
+ statusIllustration,
31
+ } from './rules/composition-rules.mjs';
32
+ import { entryPointImport } from './rules/import-rules.mjs';
33
+ import { borderWidth, fontFamily, kitOverride, radiusRaw, radiusRole, shadowRaw, surfaceTint, textRaw, textTone } from './rules/style-rules.mjs';
34
+ import {
35
+ bannedUtility,
36
+ deprecatedInput,
37
+ deprecatedToken,
38
+ invalidInputValue,
39
+ noDaisyuiComponent,
40
+ unknownElement,
41
+ unknownInput,
42
+ } from './rules/template-rules.mjs';
43
+
44
+ const rules = {
45
+ 'unknown-element': unknownElement,
46
+ 'unknown-input': unknownInput,
47
+ 'invalid-input-value': invalidInputValue,
48
+ 'deprecated-input': deprecatedInput,
49
+ 'deprecated-token': deprecatedToken,
50
+ 'entry-point-import': entryPointImport,
51
+ 'no-daisyui-component': noDaisyuiComponent,
52
+ 'banned-utility': bannedUtility,
53
+ // App conventions ported from the MFE validators; each finding keeps the validator's rule id.
54
+ 'button-variant': buttonVariant,
55
+ 'button-role': buttonRole,
56
+ 'dialog-actions': dialogActions,
57
+ 'no-nested-card': noNestedCard,
58
+ 'button-legacy-input': buttonLegacyInput,
59
+ 'no-ty-variant': noTyVariant,
60
+ 'preference-selectors': preferenceSelectorTemplate,
61
+ 'status-illustration': statusIllustration,
62
+ 'sonner-toast-api': sonnerToastApi,
63
+ 'no-local-st-selector': noLocalStSelector,
64
+ 'no-direct-dayjs': noDirectDayjs,
65
+ 'route-metadata': routeMetadata,
66
+ 'route-permissions': routePermissions,
67
+ 'navigate-preserve-menu': navigatePreserveMenu,
68
+ 'navigation-key-guard': navigationKeyGuard,
69
+ 'page-header-topics': pageHeaderTopics,
70
+ 'child-preference-selectors': childPreferenceSelectors,
71
+ 'status-page-home': statusPageHome,
72
+ 'test-setup-sdk-mock': testSetupSdkMock,
73
+ // Design-system class rules (DESIGN.md typography, geometry and surfaces), with the contract's ids.
74
+ 'radius-raw': radiusRaw,
75
+ 'radius-role': radiusRole,
76
+ 'text-raw': textRaw,
77
+ 'text-tone': textTone,
78
+ 'surface-tint': surfaceTint,
79
+ 'shadow-raw': shadowRaw,
80
+ 'font-family': fontFamily,
81
+ 'border-width': borderWidth,
82
+ 'kit-override': kitOverride,
83
+ };
84
+
85
+ /** @type {import('eslint').Linter.Config[]} */
86
+ const recommended = [];
87
+
88
+ /** The plugin: rules plus a `recommended` flat config. */
89
+ const plugin = {
90
+ meta: { name: '@sixbell-telco/eslint-plugin-sdk', version: '0.1.0' },
91
+ rules: /** @type {Record<string, import('eslint').Rule.RuleModule>} */ (/** @type {unknown} */ (rules)),
92
+ configs: { recommended },
93
+ };
94
+
95
+ recommended.push(
96
+ {
97
+ name: '@sixbell-telco/sdk/templates',
98
+ files: ['**/*.html'],
99
+ languageOptions: { parser: templateParser },
100
+ plugins: { '@sixbell-telco/sdk': plugin },
101
+ rules: {
102
+ '@sixbell-telco/sdk/unknown-element': 'error',
103
+ '@sixbell-telco/sdk/unknown-input': 'error',
104
+ '@sixbell-telco/sdk/invalid-input-value': 'error',
105
+ '@sixbell-telco/sdk/deprecated-input': 'warn',
106
+ '@sixbell-telco/sdk/deprecated-token': 'warn',
107
+ '@sixbell-telco/sdk/no-daisyui-component': 'error',
108
+ '@sixbell-telco/sdk/banned-utility': 'error',
109
+ '@sixbell-telco/sdk/button-variant': 'warn',
110
+ '@sixbell-telco/sdk/button-role': 'warn',
111
+ '@sixbell-telco/sdk/dialog-actions': 'warn',
112
+ '@sixbell-telco/sdk/no-nested-card': 'warn',
113
+ '@sixbell-telco/sdk/button-legacy-input': 'error',
114
+ '@sixbell-telco/sdk/no-ty-variant': 'error',
115
+ '@sixbell-telco/sdk/preference-selectors': 'error',
116
+ '@sixbell-telco/sdk/status-illustration': 'error',
117
+ '@sixbell-telco/sdk/radius-raw': 'warn',
118
+ '@sixbell-telco/sdk/radius-role': 'warn',
119
+ '@sixbell-telco/sdk/text-raw': 'warn',
120
+ '@sixbell-telco/sdk/text-tone': 'warn',
121
+ '@sixbell-telco/sdk/surface-tint': 'warn',
122
+ '@sixbell-telco/sdk/shadow-raw': 'warn',
123
+ '@sixbell-telco/sdk/font-family': 'warn',
124
+ '@sixbell-telco/sdk/border-width': 'warn',
125
+ '@sixbell-telco/sdk/kit-override': 'warn',
126
+ },
127
+ },
128
+ {
129
+ name: '@sixbell-telco/sdk/imports',
130
+ files: ['**/*.ts'],
131
+ plugins: { '@sixbell-telco/sdk': plugin },
132
+ rules: {
133
+ '@sixbell-telco/sdk/entry-point-import': 'error',
134
+ '@sixbell-telco/sdk/sonner-toast-api': 'error',
135
+ '@sixbell-telco/sdk/no-local-st-selector': 'error',
136
+ '@sixbell-telco/sdk/no-direct-dayjs': 'error',
137
+ '@sixbell-telco/sdk/route-metadata': 'error',
138
+ '@sixbell-telco/sdk/route-permissions': 'warn',
139
+ '@sixbell-telco/sdk/navigate-preserve-menu': 'warn',
140
+ '@sixbell-telco/sdk/navigation-key-guard': 'error',
141
+ '@sixbell-telco/sdk/page-header-topics': 'error',
142
+ '@sixbell-telco/sdk/child-preference-selectors': 'error',
143
+ '@sixbell-telco/sdk/status-page-home': 'error',
144
+ '@sixbell-telco/sdk/test-setup-sdk-mock': 'warn',
145
+ },
146
+ },
147
+ );
148
+
149
+ export default plugin;