@nvidia-elements/lint
Advanced tools
| import type { Rule } from 'eslint'; | ||
| declare const rule: { | ||
| readonly meta: { | ||
| readonly type: 'problem'; | ||
| readonly docs: { | ||
| readonly description: 'Limit primary actions to two per page.'; | ||
| readonly category: 'Best Practice'; | ||
| readonly recommended: true; | ||
| readonly url: `${string}/docs/lint/`; | ||
| }; | ||
| readonly schema: readonly []; | ||
| readonly messages: { | ||
| readonly "excessive-primary-action": 'Limit primary actions to {{max}} per page. Reserve interaction="emphasis" for primary calls to action.'; | ||
| }; | ||
| }; | ||
| readonly create: (context: Rule.RuleContext) => any; | ||
| }; | ||
| export default rule; |
| import { createVisitors as e } from "@html-eslint/eslint-plugin/lib/rules/utils/visitors.js"; | ||
| import { findAttr as t } from "@html-eslint/eslint-plugin/lib/rules/utils/node.js"; | ||
| //#region src/eslint/rules/no-excessive-primary-actions.ts | ||
| var n = 2, r = { | ||
| meta: { | ||
| type: "problem", | ||
| docs: { | ||
| description: "Limit primary actions to two per page.", | ||
| category: "Best Practice", | ||
| recommended: !0, | ||
| url: "https://nvidia.github.io/elements/docs/lint/" | ||
| }, | ||
| schema: [], | ||
| messages: { "excessive-primary-action": "Limit primary actions to {{max}} per page. Reserve interaction=\"emphasis\" for primary calls to action." } | ||
| }, | ||
| create(r) { | ||
| let i = 0; | ||
| return e(r, { | ||
| Document() { | ||
| i = 0; | ||
| }, | ||
| Tag(e) { | ||
| if (e.name.toLowerCase() !== "nve-button") return; | ||
| let a = t(e, "interaction"); | ||
| a?.value?.value === "emphasis" && (i += 1, !(i <= n) && r.report({ | ||
| node: a, | ||
| messageId: "excessive-primary-action", | ||
| data: { max: String(n) } | ||
| })); | ||
| } | ||
| }); | ||
| } | ||
| }; | ||
| //#endregion | ||
| export { r as default }; |
+15
-0
@@ -0,1 +1,16 @@ | ||
| ## 2.2.0 (2026-07-27) | ||
| * feat(core): add media i18n values ([371692a](https://github.com/NVIDIA/elements/commit/371692a)) | ||
| * feat(lint): add rule to limit excessive primary actions ([e67fa69](https://github.com/NVIDIA/elements/commit/e67fa69)) | ||
| * chore(ci): enforce html custom data package contracts ([39ba85c](https://github.com/NVIDIA/elements/commit/39ba85c)) | ||
| * chore(ci): update lighthouse ([73584d2](https://github.com/NVIDIA/elements/commit/73584d2)) | ||
| * chore(docs): feed title ([e7f3717](https://github.com/NVIDIA/elements/commit/e7f3717)) | ||
| * chore(docs): whats new page and skill ([9c6f1b2](https://github.com/NVIDIA/elements/commit/9c6f1b2)) | ||
| * chore(release): @nvidia-elements/core-v2.2.0 [skip ci] ([6cf3292](https://github.com/NVIDIA/elements/commit/6cf3292)) | ||
| * chore(release): @nvidia-elements/forms-v2.0.5 [skip ci] ([c0e8291](https://github.com/NVIDIA/elements/commit/c0e8291)) | ||
| * chore(release): @nvidia-elements/markdown-v2.0.3 [skip ci] ([287e6c3](https://github.com/NVIDIA/elements/commit/287e6c3)) | ||
| * fix(forms): remove stale html custom data contribution ([c64f40d](https://github.com/NVIDIA/elements/commit/c64f40d)) | ||
| * fix(markdown): export html custom data ([090c9c3](https://github.com/NVIDIA/elements/commit/090c9c3)) | ||
| * fix(media): remove stale html custom data contribution ([baedd39](https://github.com/NVIDIA/elements/commit/baedd39)) | ||
| ## <small>2.1.3 (2026-07-22)</small> | ||
@@ -2,0 +17,0 @@ |
@@ -5,3 +5,3 @@ import { elementsHtmlConfig as e } from "../lint/src/eslint/configs/html.js"; | ||
| //#region src/eslint/index.ts | ||
| var r = "2.1.3", i = [ | ||
| var r = "2.2.0", i = [ | ||
| e, | ||
@@ -8,0 +8,0 @@ t, |
+1
-1
| //#region src/index.ts | ||
| var e = "2.1.3"; | ||
| var e = "2.2.0"; | ||
| //#endregion | ||
| export { e as VERSION }; |
@@ -14,23 +14,24 @@ import e from "../rules/no-complex-popovers.js"; | ||
| import f from "../rules/no-deprecated-slots.js"; | ||
| import p from "../rules/no-missing-slotted-elements.js"; | ||
| import m from "../rules/no-missing-control-label.js"; | ||
| import h from "../rules/no-missing-icon-name.js"; | ||
| import g from "../rules/no-missing-popover-trigger.js"; | ||
| import _ from "../rules/no-misprefixed-tags.js"; | ||
| import v from "../rules/no-unexpected-slot-value.js"; | ||
| import y from "../rules/no-unknown-tags.js"; | ||
| import b from "../rules/no-unexpected-attribute-value.js"; | ||
| import x from "../rules/no-unexpected-input-type.js"; | ||
| import S from "../rules/no-invalid-event-listeners.js"; | ||
| import C from "../rules/no-invalid-invoker-triggers.js"; | ||
| import w from "../rules/no-missing-gap-space.js"; | ||
| import T from "../rules/no-unknown-css-variable.js"; | ||
| import E from "../rules/no-restricted-page-sizing.js"; | ||
| import D from "../rules/no-nested-container-types.js"; | ||
| import O from "../rules/no-unstyled-typography.js"; | ||
| import k from "../rules/no-tailwind-classes.js"; | ||
| import A from "../rules/prefer-aria-label-in-compact-containers.js"; | ||
| import j from "@html-eslint/parser"; | ||
| import p from "../rules/no-excessive-primary-actions.js"; | ||
| import m from "../rules/no-missing-slotted-elements.js"; | ||
| import h from "../rules/no-missing-control-label.js"; | ||
| import g from "../rules/no-missing-icon-name.js"; | ||
| import _ from "../rules/no-missing-popover-trigger.js"; | ||
| import v from "../rules/no-misprefixed-tags.js"; | ||
| import y from "../rules/no-unexpected-slot-value.js"; | ||
| import b from "../rules/no-unknown-tags.js"; | ||
| import x from "../rules/no-unexpected-attribute-value.js"; | ||
| import S from "../rules/no-unexpected-input-type.js"; | ||
| import C from "../rules/no-invalid-event-listeners.js"; | ||
| import w from "../rules/no-invalid-invoker-triggers.js"; | ||
| import T from "../rules/no-missing-gap-space.js"; | ||
| import E from "../rules/no-unknown-css-variable.js"; | ||
| import D from "../rules/no-restricted-page-sizing.js"; | ||
| import O from "../rules/no-nested-container-types.js"; | ||
| import k from "../rules/no-unstyled-typography.js"; | ||
| import A from "../rules/no-tailwind-classes.js"; | ||
| import j from "../rules/prefer-aria-label-in-compact-containers.js"; | ||
| import M from "@html-eslint/parser"; | ||
| //#region src/eslint/configs/html.ts | ||
| var M = [ | ||
| var N = [ | ||
| "src/**/*.html", | ||
@@ -40,3 +41,3 @@ "src/**/*.js", | ||
| "src/**/*.tsx" | ||
| ], N = [ | ||
| ], P = [ | ||
| "node_modules/", | ||
@@ -52,7 +53,7 @@ "coverage/", | ||
| "src/**/*.snippets.html" | ||
| ], P = { | ||
| files: [...M], | ||
| ignores: N, | ||
| ], F = { | ||
| files: [...N], | ||
| ignores: P, | ||
| languageOptions: { | ||
| parser: j, | ||
| parser: M, | ||
| parserOptions: { frontmatter: !0 } | ||
@@ -70,24 +71,25 @@ }, | ||
| "no-deprecated-slots": f, | ||
| "no-missing-slotted-elements": p, | ||
| "no-missing-control-label": m, | ||
| "no-missing-icon-name": h, | ||
| "no-missing-popover-trigger": g, | ||
| "no-misprefixed-tags": _, | ||
| "no-excessive-primary-actions": p, | ||
| "no-missing-slotted-elements": m, | ||
| "no-missing-control-label": h, | ||
| "no-missing-icon-name": g, | ||
| "no-missing-popover-trigger": _, | ||
| "no-misprefixed-tags": v, | ||
| "no-restricted-attributes": u, | ||
| "no-restricted-page-sizing": E, | ||
| "no-restricted-page-sizing": D, | ||
| "no-slotted-popovers": d, | ||
| "no-unexpected-global-attribute-value": a, | ||
| "no-unexpected-style-customization": o, | ||
| "no-unexpected-slot-value": v, | ||
| "no-unknown-tags": y, | ||
| "no-unexpected-attribute-value": b, | ||
| "no-unexpected-input-type": x, | ||
| "no-invalid-event-listeners": S, | ||
| "no-invalid-invoker-triggers": C, | ||
| "no-missing-gap-space": w, | ||
| "no-unknown-css-variable": T, | ||
| "no-nested-container-types": D, | ||
| "no-unstyled-typography": O, | ||
| "no-tailwind-classes": k, | ||
| "prefer-aria-label-in-compact-containers": A | ||
| "no-unexpected-slot-value": y, | ||
| "no-unknown-tags": b, | ||
| "no-unexpected-attribute-value": x, | ||
| "no-unexpected-input-type": S, | ||
| "no-invalid-event-listeners": C, | ||
| "no-invalid-invoker-triggers": w, | ||
| "no-missing-gap-space": T, | ||
| "no-unknown-css-variable": E, | ||
| "no-nested-container-types": O, | ||
| "no-unstyled-typography": k, | ||
| "no-tailwind-classes": A, | ||
| "prefer-aria-label-in-compact-containers": j | ||
| } } }, | ||
@@ -104,2 +106,3 @@ rules: { | ||
| "@nvidia-elements/lint/no-deprecated-slots": ["error"], | ||
| "@nvidia-elements/lint/no-excessive-primary-actions": ["error"], | ||
| "@nvidia-elements/lint/no-missing-slotted-elements": ["error"], | ||
@@ -130,2 +133,2 @@ "@nvidia-elements/lint/no-missing-control-label": ["error"], | ||
| //#endregion | ||
| export { P as elementsHtmlConfig }; | ||
| export { F as elementsHtmlConfig }; |
+3
-3
| { | ||
| "name": "@nvidia-elements/lint", | ||
| "version": "2.1.3", | ||
| "version": "2.2.0", | ||
| "release": { | ||
@@ -77,5 +77,5 @@ "extends": "../../release.config.js" | ||
| "vitest": "4.1.10", | ||
| "@internals/metadata": "0.0.0", | ||
| "@internals/eslint": "0.0.0", | ||
| "@internals/vite": "0.0.0" | ||
| "@internals/vite": "0.0.0", | ||
| "@internals/metadata": "0.0.0" | ||
| }, | ||
@@ -82,0 +82,0 @@ "wireit": { |
+1
-0
@@ -78,2 +78,3 @@ # @nvidia-elements/lint | ||
| | `@nvidia-elements/lint/no-deprecated-tags` | Disallow use of deprecated elements in HTML. | HTML | `error` | | ||
| | `@nvidia-elements/lint/no-excessive-primary-actions` | Limit primary actions to two per page. | HTML | `error` | | ||
| | `@nvidia-elements/lint/no-invalid-event-listeners` | Disallow inline event handler attributes in HTML. | HTML | `error` | | ||
@@ -80,0 +81,0 @@ | `@nvidia-elements/lint/no-invalid-invoker-triggers` | Disallow use of invoker trigger attributes on non-button nve-* elements. | HTML | `error` | |
Sorry, the diff of this file is too big to display
2161432
0.16%112
1.82%11438
0.49%111
0.91%