@nvidia-elements/lint
Advanced tools
| import type { Rule } from 'eslint'; | ||
| declare const rule: { | ||
| readonly meta: { | ||
| readonly type: 'problem'; | ||
| readonly hasSuggestions: true; | ||
| readonly docs: { | ||
| readonly description: 'Restrict container="full" to direct children of nve-page.'; | ||
| readonly category: 'Best Practice'; | ||
| readonly recommended: true; | ||
| readonly url: `${string}/docs/lint/`; | ||
| }; | ||
| readonly schema: readonly []; | ||
| readonly messages: { | ||
| readonly "no-restricted-container-full": 'container="full" on <{{tag}}> requires the element to be the template root or a direct child of <nve-page>.'; | ||
| readonly "grid-requires-container-flat": '<nve-grid> inside <{{parent}}> requires container="flat". Use container="full" only when the grid is the template root or a direct child of <nve-page>.'; | ||
| readonly "suggest-container-flat": 'Replace container="full" with container="flat"'; | ||
| }; | ||
| }; | ||
| 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-restricted-container-full.ts | ||
| var n = /* @__PURE__ */ new Set([ | ||
| "nve-alert-group", | ||
| "nve-card", | ||
| "nve-grid", | ||
| "nve-toolbar" | ||
| ]), r = /* @__PURE__ */ new Set(["nve-card", "nve-dialog"]); | ||
| function i(e, t) { | ||
| let n = e.parent; | ||
| for (; n;) { | ||
| if (t.has(n.name?.toLowerCase())) return n; | ||
| n = n.parent; | ||
| } | ||
| } | ||
| function a(e) { | ||
| return e.parent?.type === "Document" || e.parent?.name?.toLowerCase() === "nve-page"; | ||
| } | ||
| var o = { | ||
| meta: { | ||
| type: "problem", | ||
| hasSuggestions: !0, | ||
| docs: { | ||
| description: "Restrict container=\"full\" to direct children of nve-page.", | ||
| category: "Best Practice", | ||
| recommended: !0, | ||
| url: "https://nvidia.github.io/elements/docs/lint/" | ||
| }, | ||
| schema: [], | ||
| messages: { | ||
| "no-restricted-container-full": "container=\"full\" on <{{tag}}> requires the element to be the template root or a direct child of <nve-page>.", | ||
| "grid-requires-container-flat": "<nve-grid> inside <{{parent}}> requires container=\"flat\". Use container=\"full\" only when the grid is the template root or a direct child of <nve-page>.", | ||
| "suggest-container-flat": "Replace container=\"full\" with container=\"flat\"" | ||
| } | ||
| }, | ||
| create(o) { | ||
| return e(o, { Tag(e) { | ||
| let s = e.name.toLowerCase(); | ||
| if (!n.has(s)) return; | ||
| let c = t(e, "container"); | ||
| if (c?.value?.value !== "full" || a(e)) return; | ||
| let l = s === "nve-grid" ? i(e, r) : void 0; | ||
| if (l) { | ||
| o.report({ | ||
| node: c, | ||
| messageId: "grid-requires-container-flat", | ||
| data: { parent: l.name }, | ||
| suggest: [{ | ||
| messageId: "suggest-container-flat", | ||
| fix(e) { | ||
| return e.replaceText(c, `container=${c.startWrapper?.value ?? "\""}flat${c.endWrapper?.value ?? "\""}`); | ||
| } | ||
| }] | ||
| }); | ||
| return; | ||
| } | ||
| o.report({ | ||
| node: c, | ||
| messageId: "no-restricted-container-full", | ||
| data: { tag: s } | ||
| }); | ||
| } }); | ||
| } | ||
| }; | ||
| //#endregion | ||
| export { o as default }; |
+23
-0
@@ -0,1 +1,24 @@ | ||
| ## 2.3.0 (2026-07-30) | ||
| * chore(ci): enhance ci performance profiling and add new scripts ([ef0a912](https://github.com/NVIDIA/elements/commit/ef0a912)) | ||
| * chore(ci): update hugo starter to use mise defined binary ([29211a7](https://github.com/NVIDIA/elements/commit/29211a7)) | ||
| * chore(ci): update metadata and test coverage report ([216a7a9](https://github.com/NVIDIA/elements/commit/216a7a9)) | ||
| * chore(docs): add design md file ([5c63566](https://github.com/NVIDIA/elements/commit/5c63566)) | ||
| * chore(docs): fix sitemap ([7c9f059](https://github.com/NVIDIA/elements/commit/7c9f059)) | ||
| * chore(release): @nvidia-elements/cli-v2.1.7 [skip ci] ([3fcca0d](https://github.com/NVIDIA/elements/commit/3fcca0d)) | ||
| * chore(release): @nvidia-elements/cli-v2.1.8 [skip ci] ([1521595](https://github.com/NVIDIA/elements/commit/1521595)) | ||
| * chore(release): @nvidia-elements/core-v2.2.1 [skip ci] ([730a2ec](https://github.com/NVIDIA/elements/commit/730a2ec)) | ||
| * chore(release): @nvidia-elements/core-v2.2.2 [skip ci] ([f9f1e27](https://github.com/NVIDIA/elements/commit/f9f1e27)) | ||
| * chore(release): @nvidia-elements/styles-v2.1.1 [skip ci] ([d6ce1a6](https://github.com/NVIDIA/elements/commit/d6ce1a6)) | ||
| * chore(release): @nvidia-elements/styles-v2.1.2 [skip ci] ([71fab6c](https://github.com/NVIDIA/elements/commit/71fab6c)) | ||
| * fix(cli): update mcp deps ([a7d5f7c](https://github.com/NVIDIA/elements/commit/a7d5f7c)) | ||
| * fix(cli): update mcp sdk ([0640e11](https://github.com/NVIDIA/elements/commit/0640e11)) | ||
| * fix(cli): workspace dependency ([5ecbd96](https://github.com/NVIDIA/elements/commit/5ecbd96)) | ||
| * fix(core): drawer positioning ([f66cab0](https://github.com/NVIDIA/elements/commit/f66cab0)) | ||
| * fix(core): improve api custom elements schema ([6b299e3](https://github.com/NVIDIA/elements/commit/6b299e3)) | ||
| * fix(core): update select size handling and improve layout ([6af535d](https://github.com/NVIDIA/elements/commit/6af535d)) | ||
| * fix(styles): add width rule for row layout with space-between alignment ([61113ad](https://github.com/NVIDIA/elements/commit/61113ad)) | ||
| * fix(styles): default line heights ([d13ea94](https://github.com/NVIDIA/elements/commit/d13ea94)) | ||
| * feat(lint): add rule to restrict container="full" usage ([a634e39](https://github.com/NVIDIA/elements/commit/a634e39)) | ||
| ## 2.2.0 (2026-07-27) | ||
@@ -2,0 +25,0 @@ |
@@ -5,3 +5,3 @@ import { elementsHtmlConfig as e } from "../lint/src/eslint/configs/html.js"; | ||
| //#region src/eslint/index.ts | ||
| var r = "2.2.0", i = [ | ||
| var r = "2.3.0", i = [ | ||
| e, | ||
@@ -8,0 +8,0 @@ t, |
+1
-1
| //#region src/index.ts | ||
| var e = "2.2.0"; | ||
| var e = "2.3.0"; | ||
| //#endregion | ||
| export { e as VERSION }; |
@@ -28,10 +28,11 @@ import e from "../rules/no-complex-popovers.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"; | ||
| import D from "../rules/no-restricted-container-full.js"; | ||
| import O from "../rules/no-restricted-page-sizing.js"; | ||
| import k from "../rules/no-nested-container-types.js"; | ||
| import A from "../rules/no-unstyled-typography.js"; | ||
| import j from "../rules/no-tailwind-classes.js"; | ||
| import M from "../rules/prefer-aria-label-in-compact-containers.js"; | ||
| import N from "@html-eslint/parser"; | ||
| //#region src/eslint/configs/html.ts | ||
| var N = [ | ||
| var P = [ | ||
| "src/**/*.html", | ||
@@ -41,3 +42,3 @@ "src/**/*.js", | ||
| "src/**/*.tsx" | ||
| ], P = [ | ||
| ], F = [ | ||
| "node_modules/", | ||
@@ -53,7 +54,7 @@ "coverage/", | ||
| "src/**/*.snippets.html" | ||
| ], F = { | ||
| files: [...N], | ||
| ignores: P, | ||
| ], I = { | ||
| files: [...P], | ||
| ignores: F, | ||
| languageOptions: { | ||
| parser: M, | ||
| parser: N, | ||
| parserOptions: { frontmatter: !0 } | ||
@@ -78,3 +79,4 @@ }, | ||
| "no-restricted-attributes": u, | ||
| "no-restricted-page-sizing": D, | ||
| "no-restricted-container-full": D, | ||
| "no-restricted-page-sizing": O, | ||
| "no-slotted-popovers": d, | ||
@@ -91,6 +93,6 @@ "no-unexpected-global-attribute-value": a, | ||
| "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 | ||
| "no-nested-container-types": k, | ||
| "no-unstyled-typography": A, | ||
| "no-tailwind-classes": j, | ||
| "prefer-aria-label-in-compact-containers": M | ||
| } } }, | ||
@@ -114,2 +116,3 @@ rules: { | ||
| "@nvidia-elements/lint/no-restricted-attributes": ["error"], | ||
| "@nvidia-elements/lint/no-restricted-container-full": ["error"], | ||
| "@nvidia-elements/lint/no-restricted-page-sizing": ["error"], | ||
@@ -134,2 +137,2 @@ "@nvidia-elements/lint/no-slotted-popovers": ["error"], | ||
| //#endregion | ||
| export { F as elementsHtmlConfig }; | ||
| export { I as elementsHtmlConfig }; |
@@ -55,3 +55,3 @@ import { VALUE_BINDINGS as e } from "../internals/attributes.js"; | ||
| let c = n(t, "container"), l = c?.value?.value ?? ""; | ||
| l && e.some((e) => l.includes(e)) || l !== "flat" && r.report({ | ||
| l && e.some((e) => l.includes(e)) || l === "flat" || l === "full" || r.report({ | ||
| node: t, | ||
@@ -58,0 +58,0 @@ data: { |
+10
-7
| { | ||
| "name": "@nvidia-elements/lint", | ||
| "version": "2.2.0", | ||
| "version": "2.3.0", | ||
| "release": { | ||
| "extends": "../../release.config.js" | ||
| }, | ||
| "description": "Lint configurations and custom rules for Elements projects, providing Elements-specific HTML and CSS validations.", | ||
| "description": "Lint configurations and custom rules for NVIDIA Elements projects, providing Elements-specific HTML and CSS validations.", | ||
| "keywords": [ | ||
| "nvidia", | ||
| "web-components", | ||
| "eslint", | ||
| "stylelint", | ||
| "elements", | ||
| "web-components" | ||
| "eslint-plugin", | ||
| "html-linting", | ||
| "css-linting", | ||
| "custom-elements" | ||
| ], | ||
@@ -77,5 +80,5 @@ "homepage": "https://NVIDIA.github.io/elements/", | ||
| "vitest": "4.1.10", | ||
| "@internals/metadata": "0.0.0", | ||
| "@internals/eslint": "0.0.0", | ||
| "@internals/vite": "0.0.0", | ||
| "@internals/metadata": "0.0.0" | ||
| "@internals/vite": "0.0.0" | ||
| }, | ||
@@ -82,0 +85,0 @@ "wireit": { |
+1
-0
@@ -89,2 +89,3 @@ # @nvidia-elements/lint | ||
| | `@nvidia-elements/lint/no-restricted-attributes` | Disallow use of invalid API attributes or utility attributes on custom HTML element tags. | HTML | `error` | | ||
| | `@nvidia-elements/lint/no-restricted-container-full` | Restrict container="full" to direct children of nve-page. | HTML | `error` | | ||
| | `@nvidia-elements/lint/no-restricted-page-sizing` | Disallow custom height or width styles on nve-page. | HTML | `error` | | ||
@@ -91,0 +92,0 @@ | `@nvidia-elements/lint/no-slotted-popovers` | Disallow the slot attribute on popover elements. | HTML | `error` | |
Sorry, the diff of this file is too big to display
114
1.79%112
0.9%2068492
-4.3%11184
-2.22%