@djangocfg/eslint-config 2.1.431 → 2.1.433
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/base.js +32 -0
- package/package.json +1 -1
package/base.js
CHANGED
|
@@ -21,6 +21,38 @@ export const config = [
|
|
|
21
21
|
"turbo/no-undeclared-env-vars": "warn",
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
|
+
{
|
|
25
|
+
// Design-system token hygiene: forbid raw Tailwind color-scale classes
|
|
26
|
+
// (bg-amber-500, text-emerald-600, border-red-500/40, …) in className /
|
|
27
|
+
// class strings. The styles guide mandates SEMANTIC tokens — success /
|
|
28
|
+
// warning / destructive / info, muted / foreground / border / primary,
|
|
29
|
+
// and the chart palette (chart-1..5) for categorical data — so colors
|
|
30
|
+
// adapt across themes + presets. Raw scales break that silently.
|
|
31
|
+
//
|
|
32
|
+
// Enforced via no-restricted-syntax on string + template literals. The
|
|
33
|
+
// regex deliberately EXCLUDES the semantic families and the chart
|
|
34
|
+
// palette; if you hit a genuine exception (a brand hex in an SVG logo,
|
|
35
|
+
// a decorative non-status color with no token), disable on that line
|
|
36
|
+
// with a reason.
|
|
37
|
+
files: ["**/*.{ts,tsx,js,jsx}"],
|
|
38
|
+
rules: {
|
|
39
|
+
"no-restricted-syntax": [
|
|
40
|
+
"warn",
|
|
41
|
+
{
|
|
42
|
+
selector:
|
|
43
|
+
"Literal[value=/(bg|text|border|ring|fill|stroke|from|to|via|divide|outline|decoration|accent|caret|shadow)-(red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose|slate|gray|zinc|neutral|stone)-[0-9]/]",
|
|
44
|
+
message:
|
|
45
|
+
"Raw Tailwind color scale — use a semantic token (success/warning/destructive/info, muted/foreground/border/primary, chart-1..5). See ui-core styles README. Disable on this line with a reason only for a genuine exception (brand hex / decorative no-token color).",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
selector:
|
|
49
|
+
"TemplateElement[value.raw=/(bg|text|border|ring|fill|stroke|from|to|via|divide|outline|decoration|accent|caret|shadow)-(red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose|slate|gray|zinc|neutral|stone)-[0-9]/]",
|
|
50
|
+
message:
|
|
51
|
+
"Raw Tailwind color scale — use a semantic token (success/warning/destructive/info, muted/foreground/border/primary, chart-1..5). See ui-core styles README.",
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
24
56
|
{
|
|
25
57
|
plugins: {
|
|
26
58
|
onlyWarn,
|
package/package.json
CHANGED