@nxds/eslint-plugin 0.4.0 → 0.5.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/README.md +6 -6
- package/package.json +9 -9
- package/src/config.js +4 -4
- package/src/rules/nx-class-conventions.js +1 -1
- package/src/tailwind.js +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @nxds/eslint-plugin
|
|
2
2
|
|
|
3
|
-
Custom ESLint rules for the
|
|
3
|
+
Custom ESLint rules for the nxds design system. They split into two groups: **token-layer** rules that backfill what the deleted `--nx-size-*` primitive layer used to enforce, and **component-authoring** rules that machine-enforce conventions documented in `.claude/rules/` (so they fail `pnpm lint` and the pre-commit hook for every contributor, not just code review).
|
|
4
4
|
|
|
5
5
|
## Rules
|
|
6
6
|
|
|
@@ -30,7 +30,7 @@ Enforces `.claude/rules/extract-inline-handlers.md`: inline JSX handler props (`
|
|
|
30
30
|
|
|
31
31
|
### `@nxds/no-jsdoc-data-tags`
|
|
32
32
|
|
|
33
|
-
Enforces `.claude/rules/code-comments.md`: JSDoc blocks must not carry `@default` or `@example` tags. The docs read prop defaults from code and usage from `docs` stories, so a tag is a second copy that can drift. Line comments and plain block comments are not checked. Wired in the root `eslint.config.js` for `packages/react/src`.
|
|
33
|
+
Enforces `.claude/rules/code-comments.md`: JSDoc blocks must not carry `@default` or `@example` tags. The docs read prop defaults from code and usage from `docs` stories, so a tag is a second copy that can drift. Line comments and plain block comments are not checked. Wired in the root `eslint.config.js` for `packages/react/src` and `packages/vue/src`.
|
|
34
34
|
|
|
35
35
|
## Source of truth
|
|
36
36
|
|
|
@@ -39,13 +39,13 @@ The token-layer rules are self-contained: the canonical step set is `src/canonic
|
|
|
39
39
|
## Shareable config
|
|
40
40
|
|
|
41
41
|
`@nxds/eslint-plugin/config` exports small flat-config helpers for consumers
|
|
42
|
-
that want the
|
|
42
|
+
that want the nxds rules without copying this monorepo's full lint setup:
|
|
43
43
|
|
|
44
|
-
- `
|
|
45
|
-
- `
|
|
44
|
+
- `nxdsComponentConfig({ files })` wires the component-authoring rules.
|
|
45
|
+
- `nxdsSpacingTokenConfig({ files, parser })` wires the spacing-token rule; pass
|
|
46
46
|
`jsonc-eslint-parser` when linting JSON token files.
|
|
47
47
|
|
|
48
|
-
`@nxds/eslint-plugin/tailwind` exports `
|
|
48
|
+
`@nxds/eslint-plugin/tailwind` exports `nxdsTailwindClassesConfig({ files,
|
|
49
49
|
entryPoint })`, which wires `eslint-plugin-better-tailwindcss`'s
|
|
50
50
|
`no-unknown-classes` against the stylesheet that builds `files`. Under
|
|
51
51
|
`prefix(nx)` it reports a bare utility, a typo, and any class the theme no
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxds/eslint-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "ESLint rules that enforce
|
|
5
|
+
"description": "ESLint rules that enforce nxds conventions in copied components.",
|
|
6
6
|
"keywords": [
|
|
7
|
-
"
|
|
7
|
+
"nxds",
|
|
8
8
|
"design-system",
|
|
9
9
|
"eslint",
|
|
10
10
|
"eslintplugin",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
23
|
"url": "git+https://github.com/nexuslabs-ai/nxds.git",
|
|
24
|
-
"directory": "packages/eslint-plugin
|
|
24
|
+
"directory": "packages/eslint-plugin"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
@@ -35,9 +35,6 @@
|
|
|
35
35
|
"files": [
|
|
36
36
|
"src"
|
|
37
37
|
],
|
|
38
|
-
"scripts": {
|
|
39
|
-
"refresh:canonical-set": "node scripts/refresh-canonical-set.js"
|
|
40
|
-
},
|
|
41
38
|
"dependencies": {
|
|
42
39
|
"jsonc-eslint-parser": "^3.1.0"
|
|
43
40
|
},
|
|
@@ -52,5 +49,8 @@
|
|
|
52
49
|
"optional": true
|
|
53
50
|
}
|
|
54
51
|
},
|
|
55
|
-
"license": "MIT"
|
|
56
|
-
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"scripts": {
|
|
54
|
+
"refresh:canonical-set": "node scripts/refresh-canonical-set.js"
|
|
55
|
+
}
|
|
56
|
+
}
|
package/src/config.js
CHANGED
|
@@ -10,7 +10,7 @@ export const spacingTokenRuleSet = {
|
|
|
10
10
|
'@nxds/canonical-spacing-steps': 'error',
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export function
|
|
13
|
+
export function nxdsComponentConfig(options = {}) {
|
|
14
14
|
const { files } = options;
|
|
15
15
|
|
|
16
16
|
return {
|
|
@@ -22,7 +22,7 @@ export function nexusComponentConfig(options = {}) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export function
|
|
25
|
+
export function nxdsSpacingTokenConfig(options = {}) {
|
|
26
26
|
const { files, parser } = options;
|
|
27
27
|
|
|
28
28
|
return {
|
|
@@ -45,6 +45,6 @@ export default {
|
|
|
45
45
|
plugin,
|
|
46
46
|
componentRuleSet,
|
|
47
47
|
spacingTokenRuleSet,
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
nxdsComponentConfig,
|
|
49
|
+
nxdsSpacingTokenConfig,
|
|
50
50
|
};
|
|
@@ -262,7 +262,7 @@ export default {
|
|
|
262
262
|
prefixOrder:
|
|
263
263
|
'Wrong nx: prefix order — `nx:` must come BEFORE all modifiers (e.g. `nx:hover:bg-*`, not `hover:nx:bg-*`).',
|
|
264
264
|
bannedAccent:
|
|
265
|
-
'Banned `accent` token —
|
|
265
|
+
'Banned `accent` token — nxds has no `accent`; use `background-hover` / `container-hover` / `popover-hover` (see shadcn-divergences.md).',
|
|
266
266
|
incompletePath:
|
|
267
267
|
'Incomplete semantic token path — add a `-background`, `-foreground`, or `-subtle` suffix (e.g. `nx:bg-primary-background`).',
|
|
268
268
|
rawPrimitive:
|
package/src/tailwind.js
CHANGED
|
@@ -27,11 +27,11 @@ const tailwindClassSelectors = [
|
|
|
27
27
|
},
|
|
28
28
|
];
|
|
29
29
|
|
|
30
|
-
export function
|
|
30
|
+
export function nxdsTailwindClassesConfig(options) {
|
|
31
31
|
const { files, entryPoint } = options;
|
|
32
32
|
if (typeof entryPoint !== 'string' || !path.isAbsolute(entryPoint)) {
|
|
33
33
|
throw new Error(
|
|
34
|
-
`
|
|
34
|
+
`nxdsTailwindClassesConfig: \`entryPoint\` must be an absolute path, got '${entryPoint}'.`
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -42,7 +42,7 @@ export function nexusTailwindClassesConfig(options) {
|
|
|
42
42
|
'better-tailwindcss': { entryPoint, selectors: tailwindClassSelectors },
|
|
43
43
|
},
|
|
44
44
|
rules: {
|
|
45
|
-
// `dark` is the hook for the `@custom-variant dark` in
|
|
45
|
+
// `dark` is the hook for the `@custom-variant dark` in nxds.css.
|
|
46
46
|
'better-tailwindcss/no-unknown-classes': [
|
|
47
47
|
'error',
|
|
48
48
|
{ ignore: ['^dark$'] },
|