@empline/preflight 1.1.28 → 1.1.29

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.
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env tsx
2
+ /**
3
+ * Select Option Styling Preflight
4
+ *
5
+ * Detects native <option> elements inside Select components which break
6
+ * the shared component styling. MUI/custom Select components should use
7
+ * MenuItem instead of native option elements for consistent styling.
8
+ *
9
+ * @blocking false - Advisory check for UI consistency
10
+ */
11
+ export declare const id = "ui/select-option-styling";
12
+ export declare const name = "Select Option Styling";
13
+ export declare const category = "ui";
14
+ export declare const blocking = false;
15
+ export declare const description = "Detects native <option> elements inside Select components that should use MenuItem for proper styling";
16
+ export declare const tags: string[];
17
+ //# sourceMappingURL=select-option-styling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-option-styling.d.ts","sourceRoot":"","sources":["../../../src/checks/ui/select-option-styling.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AAQH,eAAO,MAAM,EAAE,6BAA6B,CAAC;AAC7C,eAAO,MAAM,IAAI,0BAA0B,CAAC;AAC5C,eAAO,MAAM,QAAQ,OAAO,CAAC;AAC7B,eAAO,MAAM,QAAQ,QAAQ,CAAC;AAC9B,eAAO,MAAM,WAAW,0GACiF,CAAC;AAC1G,eAAO,MAAM,IAAI,UAAsC,CAAC"}
@@ -0,0 +1,149 @@
1
+ #!/usr/bin/env tsx
2
+ "use strict";
3
+ /**
4
+ * Select Option Styling Preflight
5
+ *
6
+ * Detects native <option> elements inside Select components which break
7
+ * the shared component styling. MUI/custom Select components should use
8
+ * MenuItem instead of native option elements for consistent styling.
9
+ *
10
+ * @blocking false - Advisory check for UI consistency
11
+ */
12
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ var desc = Object.getOwnPropertyDescriptor(m, k);
15
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
16
+ desc = { enumerable: true, get: function() { return m[k]; } };
17
+ }
18
+ Object.defineProperty(o, k2, desc);
19
+ }) : (function(o, m, k, k2) {
20
+ if (k2 === undefined) k2 = k;
21
+ o[k2] = m[k];
22
+ }));
23
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
24
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
25
+ }) : function(o, v) {
26
+ o["default"] = v;
27
+ });
28
+ var __importStar = (this && this.__importStar) || (function () {
29
+ var ownKeys = function(o) {
30
+ ownKeys = Object.getOwnPropertyNames || function (o) {
31
+ var ar = [];
32
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
33
+ return ar;
34
+ };
35
+ return ownKeys(o);
36
+ };
37
+ return function (mod) {
38
+ if (mod && mod.__esModule) return mod;
39
+ var result = {};
40
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
41
+ __setModuleDefault(result, mod);
42
+ return result;
43
+ };
44
+ })();
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.tags = exports.description = exports.blocking = exports.category = exports.name = exports.id = void 0;
47
+ const fs = __importStar(require("fs"));
48
+ const glob_1 = require("glob");
49
+ const path = __importStar(require("path"));
50
+ const console_chars_1 = require("../../utils/console-chars");
51
+ // Check metadata
52
+ exports.id = "ui/select-option-styling";
53
+ exports.name = "Select Option Styling";
54
+ exports.category = "ui";
55
+ exports.blocking = false;
56
+ exports.description = "Detects native <option> elements inside Select components that should use MenuItem for proper styling";
57
+ exports.tags = ["ui", "consistency", "components"];
58
+ const ROOT_DIR = process.cwd();
59
+ function getFiles(patterns) {
60
+ const allFiles = [];
61
+ for (const pattern of patterns) {
62
+ const matches = glob_1.glob.sync(pattern, {
63
+ cwd: ROOT_DIR,
64
+ absolute: true,
65
+ ignore: ["**/node_modules/**", "**/.next/**", "**/dist/**"],
66
+ });
67
+ allFiles.push(...matches);
68
+ }
69
+ return [...new Set(allFiles)];
70
+ }
71
+ function readFile(filePath) {
72
+ try {
73
+ return fs.readFileSync(filePath, "utf-8");
74
+ }
75
+ catch {
76
+ return null;
77
+ }
78
+ }
79
+ async function main() {
80
+ console.log(`\n${console_chars_1.emoji.palette} Select Option Styling Check\n`);
81
+ const issues = [];
82
+ // Find all TSX files that might have Select components
83
+ const files = getFiles(["components/**/*.tsx", "app/**/*.tsx"]);
84
+ // Pattern to detect <option> within context of Select usage
85
+ // We look for files that:
86
+ // 1. Import Select from @/components/ui
87
+ // 2. Contain <option> elements
88
+ for (const filePath of files) {
89
+ const content = readFile(filePath);
90
+ if (!content)
91
+ continue;
92
+ const relativePath = path.relative(ROOT_DIR, filePath);
93
+ // Check if file imports Select from @/components/ui
94
+ const hasSelectImport = content.includes("Select") &&
95
+ (content.includes("@/components/ui") || content.includes("components/ui"));
96
+ if (!hasSelectImport)
97
+ continue;
98
+ // Check for native <option> elements
99
+ const lines = content.split("\n");
100
+ for (let i = 0; i < lines.length; i++) {
101
+ const line = lines[i];
102
+ if (line && /<option\s+value=/.test(line)) {
103
+ issues.push({
104
+ file: relativePath,
105
+ line: i + 1,
106
+ content: line.trim().substring(0, 80),
107
+ });
108
+ }
109
+ }
110
+ }
111
+ // Report findings
112
+ if (issues.length === 0) {
113
+ console.log(`${console_chars_1.emoji.success} No native <option> elements found in Select components!\n`);
114
+ console.log("All dropdowns are using MenuItem for consistent shared styling.\n");
115
+ process.exit(0);
116
+ }
117
+ console.log(`${console_chars_1.emoji.warning} Found ${issues.length} native <option> elements that should use MenuItem\n`);
118
+ console.log("Native <option> elements don't receive shared component styling.");
119
+ console.log("Replace with MenuItem from @/components/ui for consistent UI.\n");
120
+ console.log("─".repeat(70));
121
+ console.log("");
122
+ // Group by file
123
+ const byFile = issues.reduce((acc, issue) => {
124
+ acc[issue.file] ||= [];
125
+ acc[issue.file].push(issue);
126
+ return acc;
127
+ }, {});
128
+ for (const [file, fileIssues] of Object.entries(byFile)) {
129
+ console.log(`${console_chars_1.emoji.file} ${file}`);
130
+ for (const issue of fileIssues) {
131
+ console.log(` Line ${issue.line}: ${issue.content}`);
132
+ }
133
+ console.log("");
134
+ }
135
+ console.log("─".repeat(70));
136
+ console.log("");
137
+ console.log(`${console_chars_1.emoji.info} Fix: Replace <option value="...">...</option>`);
138
+ console.log(` With: <MenuItem value="...">...</MenuItem>`);
139
+ console.log("");
140
+ console.log(` Import: import { MenuItem } from "@/components/ui";`);
141
+ console.log("");
142
+ // Non-blocking, just advisory
143
+ process.exit(0);
144
+ }
145
+ main().catch((err) => {
146
+ console.error(`${console_chars_1.emoji.error} Select option styling check crashed:`, err);
147
+ process.exit(1);
148
+ });
149
+ //# sourceMappingURL=select-option-styling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select-option-styling.js","sourceRoot":"","sources":["../../../src/checks/ui/select-option-styling.ts"],"names":[],"mappings":";;AACA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,+BAA4B;AAC5B,2CAA6B;AAC7B,6DAAkD;AAElD,iBAAiB;AACJ,QAAA,EAAE,GAAG,0BAA0B,CAAC;AAChC,QAAA,IAAI,GAAG,uBAAuB,CAAC;AAC/B,QAAA,QAAQ,GAAG,IAAI,CAAC;AAChB,QAAA,QAAQ,GAAG,KAAK,CAAC;AACjB,QAAA,WAAW,GACtB,uGAAuG,CAAC;AAC7F,QAAA,IAAI,GAAG,CAAC,IAAI,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;AAQxD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAE/B,SAAS,QAAQ,CAAC,QAAkB;IAClC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,WAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjC,GAAG,EAA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,CAAC;AAClB,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empline/preflight",
3
- "version": "1.1.28",
3
+ "version": "1.1.29",
4
4
  "description": "Distributable preflight validation system with app-specific plugin support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",