oxlint-plugin-react-doctor 0.2.0-beta.6 → 0.2.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/dist/index.d.ts +0 -34
- package/dist/index.js +0 -81
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -172,23 +172,6 @@ declare const REACT_DOCTOR_RULES: readonly [{
|
|
|
172
172
|
readonly recommendation?: string;
|
|
173
173
|
readonly create: (context: RuleContext) => RuleVisitors;
|
|
174
174
|
};
|
|
175
|
-
}, {
|
|
176
|
-
readonly key: "react-doctor/design-no-default-tailwind-palette";
|
|
177
|
-
readonly id: "design-no-default-tailwind-palette";
|
|
178
|
-
readonly source: "react-doctor";
|
|
179
|
-
readonly framework: "global";
|
|
180
|
-
readonly category: "Architecture";
|
|
181
|
-
readonly severity: "warn";
|
|
182
|
-
readonly rule: {
|
|
183
|
-
readonly framework: "global";
|
|
184
|
-
readonly category: "Architecture";
|
|
185
|
-
readonly id: string;
|
|
186
|
-
readonly severity: RuleSeverity;
|
|
187
|
-
readonly requires?: ReadonlyArray<string>;
|
|
188
|
-
readonly tags?: ReadonlyArray<string>;
|
|
189
|
-
readonly recommendation?: string;
|
|
190
|
-
readonly create: (context: RuleContext) => RuleVisitors;
|
|
191
|
-
};
|
|
192
175
|
}, {
|
|
193
176
|
readonly key: "react-doctor/design-no-em-dash-in-jsx-text";
|
|
194
177
|
readonly id: "design-no-em-dash-in-jsx-text";
|
|
@@ -3417,23 +3400,6 @@ declare const RULES: readonly [{
|
|
|
3417
3400
|
readonly recommendation?: string;
|
|
3418
3401
|
readonly create: (context: RuleContext) => RuleVisitors;
|
|
3419
3402
|
};
|
|
3420
|
-
}, {
|
|
3421
|
-
readonly key: "react-doctor/design-no-default-tailwind-palette";
|
|
3422
|
-
readonly id: "design-no-default-tailwind-palette";
|
|
3423
|
-
readonly source: "react-doctor";
|
|
3424
|
-
readonly framework: "global";
|
|
3425
|
-
readonly category: "Architecture";
|
|
3426
|
-
readonly severity: "warn";
|
|
3427
|
-
readonly rule: {
|
|
3428
|
-
readonly framework: "global";
|
|
3429
|
-
readonly category: "Architecture";
|
|
3430
|
-
readonly id: string;
|
|
3431
|
-
readonly severity: RuleSeverity;
|
|
3432
|
-
readonly requires?: ReadonlyArray<string>;
|
|
3433
|
-
readonly tags?: ReadonlyArray<string>;
|
|
3434
|
-
readonly recommendation?: string;
|
|
3435
|
-
readonly create: (context: RuleContext) => RuleVisitors;
|
|
3436
|
-
};
|
|
3437
3403
|
}, {
|
|
3438
3404
|
readonly key: "react-doctor/design-no-em-dash-in-jsx-text";
|
|
3439
3405
|
readonly id: "design-no-em-dash-in-jsx-text";
|
package/dist/index.js
CHANGED
|
@@ -1162,42 +1162,6 @@ const HEAVY_HEADING_TAILWIND_WEIGHTS = new Set([
|
|
|
1162
1162
|
"font-extrabold",
|
|
1163
1163
|
"font-black"
|
|
1164
1164
|
]);
|
|
1165
|
-
const TAILWIND_DEFAULT_PALETTE_NAMES = [
|
|
1166
|
-
"indigo",
|
|
1167
|
-
"gray",
|
|
1168
|
-
"slate"
|
|
1169
|
-
];
|
|
1170
|
-
const TAILWIND_DEFAULT_PALETTE_STOPS = [
|
|
1171
|
-
"50",
|
|
1172
|
-
"100",
|
|
1173
|
-
"200",
|
|
1174
|
-
"300",
|
|
1175
|
-
"400",
|
|
1176
|
-
"500",
|
|
1177
|
-
"600",
|
|
1178
|
-
"700",
|
|
1179
|
-
"800",
|
|
1180
|
-
"900",
|
|
1181
|
-
"950"
|
|
1182
|
-
];
|
|
1183
|
-
const TAILWIND_PALETTE_UTILITY_PREFIXES = [
|
|
1184
|
-
"text",
|
|
1185
|
-
"bg",
|
|
1186
|
-
"border",
|
|
1187
|
-
"ring",
|
|
1188
|
-
"fill",
|
|
1189
|
-
"stroke",
|
|
1190
|
-
"from",
|
|
1191
|
-
"to",
|
|
1192
|
-
"via",
|
|
1193
|
-
"decoration",
|
|
1194
|
-
"divide",
|
|
1195
|
-
"outline",
|
|
1196
|
-
"placeholder",
|
|
1197
|
-
"caret",
|
|
1198
|
-
"accent",
|
|
1199
|
-
"shadow"
|
|
1200
|
-
];
|
|
1201
1165
|
const VAGUE_BUTTON_LABELS = new Set([
|
|
1202
1166
|
"continue",
|
|
1203
1167
|
"submit",
|
|
@@ -1326,38 +1290,6 @@ const noBoldHeading = defineRule({
|
|
|
1326
1290
|
} })
|
|
1327
1291
|
});
|
|
1328
1292
|
//#endregion
|
|
1329
|
-
//#region src/plugin/rules/react-ui/no-default-tailwind-palette.ts
|
|
1330
|
-
const buildDefaultPaletteRegex = () => {
|
|
1331
|
-
const utilityPrefixGroup = TAILWIND_PALETTE_UTILITY_PREFIXES.join("|");
|
|
1332
|
-
const paletteNameGroup = TAILWIND_DEFAULT_PALETTE_NAMES.join("|");
|
|
1333
|
-
const paletteStopGroup = TAILWIND_DEFAULT_PALETTE_STOPS.join("|");
|
|
1334
|
-
return new RegExp(`(?:^|\\s|:)(${utilityPrefixGroup})-(${paletteNameGroup})-(${paletteStopGroup})(?=$|[\\s:/])`, "g");
|
|
1335
|
-
};
|
|
1336
|
-
const DEFAULT_PALETTE_REGEX = buildDefaultPaletteRegex();
|
|
1337
|
-
const noDefaultTailwindPalette = defineRule({
|
|
1338
|
-
id: "design-no-default-tailwind-palette",
|
|
1339
|
-
tags: ["design", "test-noise"],
|
|
1340
|
-
severity: "warn",
|
|
1341
|
-
category: "Architecture",
|
|
1342
|
-
recommendation: "Replace `indigo-*` / `gray-*` / `slate-*` with project tokens, your brand color, or a less-default neutral (`zinc`, `neutral`, `stone`)",
|
|
1343
|
-
create: (context) => ({ JSXAttribute(jsxAttribute) {
|
|
1344
|
-
if (!isNodeOfType(jsxAttribute.name, "JSXIdentifier") || jsxAttribute.name.name !== "className") return;
|
|
1345
|
-
const classNameLiteral = getClassNameLiteral(jsxAttribute);
|
|
1346
|
-
if (!classNameLiteral) return;
|
|
1347
|
-
const reportedTokens = /* @__PURE__ */ new Set();
|
|
1348
|
-
for (const paletteMatch of classNameLiteral.matchAll(DEFAULT_PALETTE_REGEX)) {
|
|
1349
|
-
const matchedToken = `${paletteMatch[1]}-${paletteMatch[2]}-${paletteMatch[3]}`;
|
|
1350
|
-
if (reportedTokens.has(matchedToken)) continue;
|
|
1351
|
-
reportedTokens.add(matchedToken);
|
|
1352
|
-
const replacementSuggestion = paletteMatch[2] === "indigo" ? "use your project's brand color or zinc/neutral/stone" : "use zinc (true neutral), neutral (warmer), or stone (warmest)";
|
|
1353
|
-
context.report({
|
|
1354
|
-
node: jsxAttribute,
|
|
1355
|
-
message: `${matchedToken} reads as the Tailwind template default — ${replacementSuggestion}`
|
|
1356
|
-
});
|
|
1357
|
-
}
|
|
1358
|
-
} })
|
|
1359
|
-
});
|
|
1360
|
-
//#endregion
|
|
1361
1293
|
//#region src/plugin/rules/react-ui/utils/is-inside-excluded-typography-ancestor.ts
|
|
1362
1294
|
const isInsideExcludedTypographyAncestor = (jsxTextNode) => {
|
|
1363
1295
|
let cursor = jsxTextNode.parent;
|
|
@@ -10712,19 +10644,6 @@ const reactDoctorRules = [
|
|
|
10712
10644
|
category: "Architecture"
|
|
10713
10645
|
}
|
|
10714
10646
|
},
|
|
10715
|
-
{
|
|
10716
|
-
key: "react-doctor/design-no-default-tailwind-palette",
|
|
10717
|
-
id: "design-no-default-tailwind-palette",
|
|
10718
|
-
source: "react-doctor",
|
|
10719
|
-
framework: "global",
|
|
10720
|
-
category: "Architecture",
|
|
10721
|
-
severity: "warn",
|
|
10722
|
-
rule: {
|
|
10723
|
-
...noDefaultTailwindPalette,
|
|
10724
|
-
framework: "global",
|
|
10725
|
-
category: "Architecture"
|
|
10726
|
-
}
|
|
10727
|
-
},
|
|
10728
10647
|
{
|
|
10729
10648
|
key: "react-doctor/design-no-em-dash-in-jsx-text",
|
|
10730
10649
|
id: "design-no-em-dash-in-jsx-text",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxlint-plugin-react-doctor",
|
|
3
|
-
"version": "0.2.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "oxlint plugin for React Doctor: diagnose React codebases for security, performance, correctness, accessibility, bundle-size, and architecture issues",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/node": "^25.6.0",
|
|
48
|
-
"@react-doctor/types": "0.2.0
|
|
48
|
+
"@react-doctor/types": "0.2.0"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=22"
|