eslint-plugin-functype 1.4.0 → 2.0.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.
Files changed (46) hide show
  1. package/dist/chunk-BlXvk904.js +1 -0
  2. package/dist/cli/list-rules.d.ts +1 -1
  3. package/dist/cli/list-rules.js +15 -239
  4. package/dist/cli/list-rules.js.map +1 -1
  5. package/dist/index.d.ts +19 -17
  6. package/dist/index.js +1 -1364
  7. package/dist/index.js.map +1 -1
  8. package/dist/rules/index.d.ts +24 -32
  9. package/dist/rules/index.js +1 -1357
  10. package/dist/rules/index.js.map +1 -1
  11. package/dist/rules/no-get-unsafe.d.ts +7 -0
  12. package/dist/rules/no-get-unsafe.js +2 -0
  13. package/dist/rules/no-get-unsafe.js.map +1 -0
  14. package/dist/rules/no-imperative-loops.d.ts +7 -0
  15. package/dist/rules/no-imperative-loops.js +2 -0
  16. package/dist/rules/no-imperative-loops.js.map +1 -0
  17. package/dist/rules/prefer-do-notation.d.ts +7 -0
  18. package/dist/rules/prefer-do-notation.js +5 -0
  19. package/dist/rules/prefer-do-notation.js.map +1 -0
  20. package/dist/rules/prefer-either.d.ts +7 -0
  21. package/dist/rules/prefer-either.js +2 -0
  22. package/dist/rules/prefer-either.js.map +1 -0
  23. package/dist/rules/prefer-flatmap.d.ts +7 -0
  24. package/dist/rules/prefer-flatmap.js +2 -0
  25. package/dist/rules/prefer-flatmap.js.map +1 -0
  26. package/dist/rules/prefer-fold.d.ts +7 -0
  27. package/dist/rules/prefer-fold.js +2 -0
  28. package/dist/rules/prefer-fold.js.map +1 -0
  29. package/dist/rules/prefer-list.d.ts +7 -0
  30. package/dist/rules/prefer-list.js +2 -0
  31. package/dist/rules/prefer-list.js.map +1 -0
  32. package/dist/rules/prefer-map.d.ts +7 -0
  33. package/dist/rules/prefer-map.js +2 -0
  34. package/dist/rules/prefer-map.js.map +1 -0
  35. package/dist/rules/prefer-option.d.ts +7 -0
  36. package/dist/rules/prefer-option.js +2 -0
  37. package/dist/rules/prefer-option.js.map +1 -0
  38. package/dist/types/ast.d.ts +12 -0
  39. package/dist/types/ast.js +1 -0
  40. package/dist/utils/dependency-validator.d.ts +13 -11
  41. package/dist/utils/dependency-validator.js +3 -108
  42. package/dist/utils/dependency-validator.js.map +1 -1
  43. package/dist/utils/functype-detection.d.ts +69 -0
  44. package/dist/utils/functype-detection.js +2 -0
  45. package/dist/utils/functype-detection.js.map +1 -0
  46. package/package.json +34 -41
@@ -0,0 +1 @@
1
+ import{createRequire as e}from"node:module";var t=e(import.meta.url);export{t};
@@ -1 +1 @@
1
- #!/usr/bin/env node
1
+ export { };
@@ -1,241 +1,17 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';
3
-
4
- var fs = require('fs');
5
- var path = require('path');
6
-
7
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
-
9
- var fs__default = /*#__PURE__*/_interopDefault(fs);
10
- var path__default = /*#__PURE__*/_interopDefault(path);
11
-
12
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
13
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
14
- }) : x)(function(x) {
15
- if (typeof require !== "undefined") return require.apply(this, arguments);
16
- throw Error('Dynamic require of "' + x + '" is not supported');
17
- });
18
-
19
- // src/utils/dependency-validator.ts
20
- var PEER_DEPENDENCIES = [
21
- {
22
- name: "@typescript-eslint/eslint-plugin",
23
- packageName: "@typescript-eslint/eslint-plugin",
24
- description: "TypeScript-aware ESLint rules",
25
- required: true
26
- },
27
- {
28
- name: "@typescript-eslint/parser",
29
- packageName: "@typescript-eslint/parser",
30
- description: "TypeScript parser for ESLint",
31
- required: true
32
- },
33
- {
34
- name: "eslint-plugin-functional",
35
- packageName: "eslint-plugin-functional",
36
- description: "Functional programming ESLint rules",
37
- required: true
38
- },
39
- {
40
- name: "eslint-plugin-prettier",
41
- packageName: "eslint-plugin-prettier",
42
- description: "Code formatting rules",
43
- required: false
44
- },
45
- {
46
- name: "eslint-plugin-simple-import-sort",
47
- packageName: "eslint-plugin-simple-import-sort",
48
- description: "Import sorting rules",
49
- required: false
50
- },
51
- {
52
- name: "prettier",
53
- packageName: "prettier",
54
- description: "Code formatter",
55
- required: false
56
- }
57
- ];
58
- function tryRequire(packageName) {
59
- try {
60
- __require.resolve(packageName);
61
- return true;
62
- } catch {
63
- return false;
64
- }
65
- }
66
- function validatePeerDependencies() {
67
- const missing = [];
68
- const available = [];
69
- const warnings = [];
70
- for (const dep of PEER_DEPENDENCIES) {
71
- if (tryRequire(dep.packageName)) {
72
- available.push(dep);
73
- } else {
74
- missing.push(dep);
75
- if (dep.required) ; else {
76
- warnings.push(`Optional plugin '${dep.name}' not found. Some rules will be skipped.`);
77
- }
78
- }
79
- }
80
- const requiredMissing = missing.filter((dep) => dep.required);
81
- const isValid = requiredMissing.length === 0;
82
- const missingPackageNames = missing.map((dep) => dep.packageName);
83
- const installCommand = missingPackageNames.length > 0 ? `pnpm add -D ${missingPackageNames.join(" ")}` : "";
84
- return {
85
- isValid,
86
- missing,
87
- available,
88
- installCommand,
89
- warnings
90
- };
91
- }
92
-
93
- // src/cli/list-rules.ts
94
- var colors = {
95
- reset: "\x1B[0m",
96
- bright: "\x1B[1m",
97
- red: "\x1B[31m",
98
- green: "\x1B[32m",
99
- yellow: "\x1B[33m",
100
- blue: "\x1B[34m",
101
- magenta: "\x1B[35m",
102
- cyan: "\x1B[36m"
103
- };
104
- function colorize(text, color) {
105
- return colors[color] + text + colors.reset;
106
- }
107
- function printDependencyStatus(result) {
108
- console.log(colorize("\n\u{1F50D} Dependency Status Check:", "bright"));
109
- console.log(colorize("=".repeat(40), "blue"));
110
- if (result.available.length > 0) {
111
- console.log(colorize("\n\u2705 Available:", "green"));
112
- result.available.forEach((dep) => {
113
- const icon = dep.required ? "\u{1F527}" : "\u{1F50C}";
114
- console.log(` ${icon} ${colorize(dep.name, "green")} - ${dep.description}`);
115
- });
116
- }
117
- if (result.missing.length > 0) {
118
- console.log(colorize("\n\u274C Missing:", "red"));
119
- result.missing.forEach((dep) => {
120
- const icon = dep.required ? "\u26A0\uFE0F " : "\u{1F4A1}";
121
- const color = dep.required ? "red" : "yellow";
122
- console.log(` ${icon} ${colorize(dep.name, color)} - ${dep.description}`);
123
- });
124
- if (result.installCommand) {
125
- console.log(colorize("\n\u{1F4E6} Install missing dependencies:", "bright"));
126
- console.log(` ${colorize(result.installCommand, "cyan")}`);
127
- }
128
- }
129
- if (result.warnings.length > 0) {
130
- console.log(colorize("\n\u26A0\uFE0F Warnings:", "yellow"));
131
- result.warnings.forEach((warning) => console.log(` ${warning}`));
132
- }
133
- const status = result.isValid ? "\u2705 Ready to use" : "\u274C Configuration will fail";
134
- const statusColor = result.isValid ? "green" : "red";
135
- console.log(colorize(`
136
- ${status}`, statusColor));
137
- }
138
- async function main() {
139
- const args = process.argv.slice(2);
140
- const showHelp = args.includes("--help") || args.includes("-h");
141
- const showUsage = args.includes("--usage") || args.includes("-u");
142
- const checkDeps = args.includes("--check-deps") || args.includes("--check");
143
- if (showHelp) {
144
- console.log(colorize("\u{1F4CB} ESLint Plugin Functype - Custom Rules", "bright"));
145
- console.log("\nUsage: pnpm run list-rules [options]");
146
- console.log("\nOptions:");
147
- console.log(" --verbose, -v Show rule descriptions and schemas");
148
- console.log(" --usage, -u Show usage examples");
149
- console.log(" --check-deps Check peer dependency status");
150
- console.log(" --help, -h Show this help message");
151
- console.log("\nThis command lists all custom rules provided by the functype plugin.");
152
- return;
153
- }
154
- if (checkDeps) {
155
- console.log(colorize("\u{1F527} ESLint Plugin Functype - Dependency Check", "bright"));
156
- const result = validatePeerDependencies();
157
- printDependencyStatus(result);
158
- if (!result.isValid) {
159
- process.exit(1);
160
- }
161
- return;
162
- }
163
- console.log(colorize("\u{1F527} ESLint Plugin Functype - Custom Rules", "bright"));
164
- const distPath = path__default.default.join(__dirname, "..", "..", "dist");
165
- if (!fs__default.default.existsSync(distPath)) {
166
- console.error(colorize("\u274C Build directory not found. Run `pnpm run build` first.", "red"));
167
- process.exit(1);
168
- }
169
- try {
170
- const pluginPath = path__default.default.join(distPath, "index.js");
171
- const plugin = __require(pluginPath);
172
- if (!plugin.rules) {
173
- console.error(colorize("\u274C No rules found in plugin.", "red"));
174
- process.exit(1);
175
- }
176
- console.log(colorize("\n\u{1F4E6} Available Custom Rules:", "bright"));
177
- console.log(colorize("=".repeat(40), "blue"));
178
- const rules = Object.keys(plugin.rules);
179
- rules.forEach((ruleName) => {
180
- const rule = plugin.rules[ruleName];
181
- const fullName = `functype/${ruleName}`;
182
- console.log(`
183
- ${colorize("\u25CF", "green")} ${colorize(fullName, "bright")}`);
184
- if (rule.meta?.docs?.description) {
185
- console.log(` ${colorize("Description:", "cyan")} ${rule.meta.docs.description}`);
186
- }
187
- if (rule.meta?.type) {
188
- const typeColor = rule.meta.type === "problem" ? "red" : rule.meta.type === "suggestion" ? "yellow" : "blue";
189
- console.log(` ${colorize("Type:", "cyan")} ${colorize(rule.meta.type, typeColor)}`);
190
- }
191
- if (rule.meta?.fixable) {
192
- console.log(` ${colorize("Fixable:", "cyan")} ${colorize("Yes", "green")}`);
193
- }
194
- if (showUsage) {
195
- console.log(` ${colorize("Usage:", "cyan")} "${fullName}": "error"`);
196
- }
197
- });
198
- console.log(colorize(`
199
- \u{1F4CA} Summary: ${rules.length} custom rules available`, "bright"));
200
- if (showUsage) {
201
- printCustomUsageInfo();
202
- }
203
- console.log(colorize("\n\u{1F4A1} Tips:", "bright"));
204
- console.log("\u2022 Use --verbose to see detailed rule information");
205
- console.log("\u2022 Use --usage to see configuration examples");
206
- console.log('\u2022 All rules are prefixed with "functype/"');
207
- console.log("\u2022 Consider using eslint-config-functype for pre-configured setup");
208
- console.log(colorize("\n\u{1F517} Links:", "bright"));
209
- console.log("\u2022 Documentation: https://github.com/jordanburke/eslint-plugin-functype");
210
- console.log("\u2022 Configuration Bundle: https://github.com/jordanburke/eslint-config-functype");
211
- console.log("\u2022 Functype Library: https://github.com/jordanburke/functype");
212
- } catch (error) {
213
- console.error(colorize("\u274C Error loading plugin:", "red"), error.message);
214
- process.exit(1);
215
- }
216
- }
217
- function printCustomUsageInfo() {
218
- console.log(colorize("\n\u{1F4A1} Usage Examples:", "bright"));
219
- console.log(colorize("=".repeat(30), "blue"));
220
- console.log("\n" + colorize("ESLint 9+ (flat config):", "green"));
221
- console.log(' import functypePlugin from "eslint-plugin-functype"');
222
- console.log(" export default [");
223
- console.log(" {");
224
- console.log(" plugins: { functype: functypePlugin },");
225
- console.log(" rules: {");
226
- console.log(' "functype/prefer-option": "error",');
227
- console.log(' "functype/prefer-either": "error",');
228
- console.log(' "functype/no-get-unsafe": "error",');
229
- console.log(" }");
230
- console.log(" }");
231
- console.log(" ]");
232
- console.log("\n" + colorize("With eslint-config-functype (recommended):", "green"));
233
- console.log(' import functypeConfig from "eslint-config-functype"');
234
- console.log(" export default [functypeConfig.recommended]");
235
- }
236
- main().catch((error) => {
237
- console.error(colorize("\u274C Unexpected error:", "red"), error);
238
- process.exit(1);
239
- });
240
- //# sourceMappingURL=list-rules.js.map
2
+ import e from"../index.js";import{validatePeerDependencies as t}from"../utils/dependency-validator.js";const n={reset:`\x1B[0m`,bright:`\x1B[1m`,red:`\x1B[31m`,green:`\x1B[32m`,yellow:`\x1B[33m`,blue:`\x1B[34m`,magenta:`\x1B[35m`,cyan:`\x1B[36m`};function r(e,t){return n[t]+e+n.reset}function i(e){console.log(r(`
3
+ šŸ” Dependency Status Check:`,`bright`)),console.log(r(`=`.repeat(40),`blue`)),e.available.length>0&&(console.log(r(`
4
+ āœ… Available:`,`green`)),e.available.forEach(e=>{let t=e.required?`šŸ”§`:`šŸ”Œ`;console.log(` ${t} ${r(e.name,`green`)} - ${e.description}`)})),e.missing.length>0&&(console.log(r(`
5
+ āŒ Missing:`,`red`)),e.missing.forEach(e=>{let t=e.required?`āš ļø `:`šŸ’”`,n=e.required?`red`:`yellow`;console.log(` ${t} ${r(e.name,n)} - ${e.description}`)}),e.installCommand&&(console.log(r(`
6
+ šŸ“¦ Install missing dependencies:`,`bright`)),console.log(` ${r(e.installCommand,`cyan`)}`))),e.warnings.length>0&&(console.log(r(`
7
+ āš ļø Warnings:`,`yellow`)),e.warnings.forEach(e=>console.log(` ${e}`)));let t=e.isValid?`āœ… Ready to use`:`āŒ Configuration will fail`,n=e.isValid?`green`:`red`;console.log(r(`\n${t}`,n))}async function a(){let n=process.argv.slice(2),a=n.includes(`--help`)||n.includes(`-h`),s=n.includes(`--usage`)||n.includes(`-u`),c=n.includes(`--check-deps`)||n.includes(`--check`);if(a){console.log(r(`šŸ“‹ ESLint Plugin Functype - Custom Rules`,`bright`)),console.log(`
8
+ Usage: pnpm run list-rules [options]`),console.log(`
9
+ Options:`),console.log(` --verbose, -v Show rule descriptions and schemas`),console.log(` --usage, -u Show usage examples`),console.log(` --check-deps Check peer dependency status`),console.log(` --help, -h Show this help message`),console.log(`
10
+ This command lists all custom rules provided by the functype plugin.`);return}if(c){console.log(r(`šŸ”§ ESLint Plugin Functype - Dependency Check`,`bright`));let e=t();i(e),e.isValid||process.exit(1);return}console.log(r(`šŸ”§ ESLint Plugin Functype - Custom Rules`,`bright`)),e.rules||(console.error(r(`āŒ No rules found in plugin.`,`red`)),process.exit(1)),console.log(r(`
11
+ šŸ“¦ Available Custom Rules:`,`bright`)),console.log(r(`=`.repeat(40),`blue`));let l=Object.keys(e.rules);l.forEach(t=>{let n=e.rules[t],i=`functype/${t}`;if(console.log(`\n${r(`ā—`,`green`)} ${r(i,`bright`)}`),n.meta?.docs?.description&&console.log(` ${r(`Description:`,`cyan`)} ${n.meta.docs.description}`),n.meta?.type){let e=n.meta.type===`problem`?`red`:n.meta.type===`suggestion`?`yellow`:`blue`;console.log(` ${r(`Type:`,`cyan`)} ${r(n.meta.type,e)}`)}n.meta?.fixable&&console.log(` ${r(`Fixable:`,`cyan`)} ${r(`Yes`,`green`)}`),s&&console.log(` ${r(`Usage:`,`cyan`)} "${i}": "error"`)}),console.log(r(`\nšŸ“Š Summary: ${l.length} custom rules available`,`bright`)),s&&o(),console.log(r(`
12
+ šŸ’” Tips:`,`bright`)),console.log(`• Use --verbose to see detailed rule information`),console.log(`• Use --usage to see configuration examples`),console.log(`• All rules are prefixed with "functype/"`),console.log(`• Consider using eslint-config-functype for pre-configured setup`),console.log(r(`
13
+ šŸ”— Links:`,`bright`)),console.log(`• Documentation: https://github.com/jordanburke/eslint-plugin-functype`),console.log(`• Configuration Bundle: https://github.com/jordanburke/eslint-config-functype`),console.log(`• Functype Library: https://github.com/jordanburke/functype`)}function o(){console.log(r(`
14
+ šŸ’” Usage Examples:`,`bright`)),console.log(r(`=`.repeat(30),`blue`)),console.log(`
15
+ `+r(`ESLint 9+ (flat config):`,`green`)),console.log(` import functypePlugin from "eslint-plugin-functype"`),console.log(` export default [`),console.log(` {`),console.log(` plugins: { functype: functypePlugin },`),console.log(` rules: {`),console.log(` "functype/prefer-option": "error",`),console.log(` "functype/prefer-either": "error",`),console.log(` "functype/no-get-unsafe": "error",`),console.log(` }`),console.log(` }`),console.log(` ]`),console.log(`
16
+ `+r(`With eslint-config-functype (recommended):`,`green`)),console.log(` import functypeConfig from "eslint-config-functype"`),console.log(` export default [functypeConfig.recommended]`)}a().catch(e=>{console.error(r(`āŒ Unexpected error:`,`red`),e),process.exit(1)});export{};
241
17
  //# sourceMappingURL=list-rules.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/dependency-validator.ts","../../src/cli/list-rules.ts"],"names":["path","fs"],"mappings":";;;;;;;;;;;;;;;;;;;AASA,IAAM,iBAAA,GAAsC;AAAA,EAC1C;AAAA,IACE,IAAA,EAAM,kCAAA;AAAA,IACN,WAAA,EAAa,kCAAA;AAAA,IACb,WAAA,EAAa,+BAAA;AAAA,IACb,QAAA,EAAU;AAAA,GACZ;AAAA,EACA;AAAA,IACE,IAAA,EAAM,2BAAA;AAAA,IACN,WAAA,EAAa,2BAAA;AAAA,IACb,WAAA,EAAa,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AC,CAAA","file":"list-rules.js","sourcesContent":["// Utility to validate peer dependencies and provide helpful error messages\n\ninterface PeerDependency {\n name: string\n packageName: string\n description: string\n required: boolean\n}\n\nconst PEER_DEPENDENCIES: PeerDependency[] = [\n {\n name: \"@typescript-eslint/eslint-plugin\",\n packageName: \"@typescript-eslint/eslint-plugin\",\n description: \"TypeScript-aware ESLint rules\",\n required: true,\n },\n {\n name: \"@typescript-eslint/parser\",\n packageName: \"@typescript-eslint/parser\",\n description: \"TypeScript parser for ESLint\",\n required: true,\n },\n {\n name: \"eslint-plugin-functional\",\n packageName: \"eslint-plugin-functional\",\n description: \"Functional programming ESLint rules\",\n required: true,\n },\n {\n name: \"eslint-plugin-prettier\",\n packageName: \"eslint-plugin-prettier\",\n description: \"Code formatting rules\",\n required: false,\n },\n {\n name: \"eslint-plugin-simple-import-sort\",\n packageName: \"eslint-plugin-simple-import-sort\",\n description: \"Import sorting rules\",\n required: false,\n },\n {\n name: \"prettier\",\n packageName: \"prettier\",\n description: \"Code formatter\",\n required: false,\n },\n]\n\nexport interface ValidationResult {\n isValid: boolean\n missing: PeerDependency[]\n available: PeerDependency[]\n installCommand: string\n warnings: string[]\n}\n\nfunction tryRequire(packageName: string): boolean {\n try {\n require.resolve(packageName)\n return true\n } catch {\n return false\n }\n}\n\nexport function validatePeerDependencies(): ValidationResult {\n const missing: PeerDependency[] = []\n const available: PeerDependency[] = []\n const warnings: string[] = []\n\n for (const dep of PEER_DEPENDENCIES) {\n if (tryRequire(dep.packageName)) {\n available.push(dep)\n } else {\n missing.push(dep)\n if (dep.required) {\n // Required dependency is missing - this will cause errors\n } else {\n // Optional dependency is missing - add warning\n warnings.push(`Optional plugin '${dep.name}' not found. Some rules will be skipped.`)\n }\n }\n }\n\n const requiredMissing = missing.filter((dep) => dep.required)\n const isValid = requiredMissing.length === 0\n\n // Generate install command for missing dependencies\n const missingPackageNames = missing.map((dep) => dep.packageName)\n const installCommand = missingPackageNames.length > 0 ? `pnpm add -D ${missingPackageNames.join(\" \")}` : \"\"\n\n return {\n isValid,\n missing,\n available,\n installCommand,\n warnings,\n }\n}\n\nexport function createValidationError(result: ValidationResult): Error {\n const requiredMissing = result.missing.filter((dep) => dep.required)\n\n if (requiredMissing.length === 0) {\n return new Error(\"No validation errors\")\n }\n\n const missingList = requiredMissing.map((dep) => ` • ${dep.name} - ${dep.description}`).join(\"\\n\")\n\n const message = [\n \"āŒ Missing required peer dependencies for eslint-plugin-functype:\",\n \"\",\n missingList,\n \"\",\n \"šŸ“¦ Install missing dependencies:\",\n ` ${result.installCommand}`,\n \"\",\n \"šŸ“– See installation guide: https://github.com/jordanburke/eslint-plugin-functype#installation\",\n ].join(\"\\n\")\n\n return new Error(message)\n}\n\nexport function shouldValidateDependencies(): boolean {\n // Skip validation in test environments or when explicitly disabled\n return process.env.NODE_ENV !== \"test\" && process.env.FUNCTYPE_SKIP_VALIDATION !== \"true\"\n}\n","#!/usr/bin/env node\n\nimport fs from \"fs\"\nimport path from \"path\"\nimport { validatePeerDependencies, type ValidationResult } from \"../utils/dependency-validator\"\n\n// Remove unused type\n// type RuleSeverity = 'off' | 'warn' | 'error' | 0 | 1 | 2\n\n// Colors for console output\nconst colors = {\n reset: \"\\x1b[0m\",\n bright: \"\\x1b[1m\",\n red: \"\\x1b[31m\",\n green: \"\\x1b[32m\",\n yellow: \"\\x1b[33m\",\n blue: \"\\x1b[34m\",\n magenta: \"\\x1b[35m\",\n cyan: \"\\x1b[36m\",\n} as const\n\nfunction colorize(text: string, color: keyof typeof colors): string {\n return colors[color] + text + colors.reset\n}\n\n// Removed unused utility functions - they were for the old config-based approach\n\nfunction printDependencyStatus(result: ValidationResult): void {\n console.log(colorize(\"\\nšŸ” Dependency Status Check:\", \"bright\"))\n console.log(colorize(\"=\".repeat(40), \"blue\"))\n\n // Show available dependencies\n if (result.available.length > 0) {\n console.log(colorize(\"\\nāœ… Available:\", \"green\"))\n result.available.forEach((dep) => {\n const icon = dep.required ? \"šŸ”§\" : \"šŸ”Œ\"\n console.log(` ${icon} ${colorize(dep.name, \"green\")} - ${dep.description}`)\n })\n }\n\n // Show missing dependencies\n if (result.missing.length > 0) {\n console.log(colorize(\"\\nāŒ Missing:\", \"red\"))\n result.missing.forEach((dep) => {\n const icon = dep.required ? \"āš ļø \" : \"šŸ’”\"\n const color = dep.required ? \"red\" : \"yellow\"\n console.log(` ${icon} ${colorize(dep.name, color)} - ${dep.description}`)\n })\n\n if (result.installCommand) {\n console.log(colorize(\"\\nšŸ“¦ Install missing dependencies:\", \"bright\"))\n console.log(` ${colorize(result.installCommand, \"cyan\")}`)\n }\n }\n\n // Show warnings\n if (result.warnings.length > 0) {\n console.log(colorize(\"\\nāš ļø Warnings:\", \"yellow\"))\n result.warnings.forEach((warning) => console.log(` ${warning}`))\n }\n\n // Overall status\n const status = result.isValid ? \"āœ… Ready to use\" : \"āŒ Configuration will fail\"\n const statusColor = result.isValid ? \"green\" : \"red\"\n console.log(colorize(`\\n${status}`, statusColor))\n}\n\nasync function main(): Promise<void> {\n const args = process.argv.slice(2)\n const showHelp = args.includes(\"--help\") || args.includes(\"-h\")\n const showUsage = args.includes(\"--usage\") || args.includes(\"-u\")\n const checkDeps = args.includes(\"--check-deps\") || args.includes(\"--check\")\n\n if (showHelp) {\n console.log(colorize(\"šŸ“‹ ESLint Plugin Functype - Custom Rules\", \"bright\"))\n console.log(\"\\nUsage: pnpm run list-rules [options]\")\n console.log(\"\\nOptions:\")\n console.log(\" --verbose, -v Show rule descriptions and schemas\")\n console.log(\" --usage, -u Show usage examples\")\n console.log(\" --check-deps Check peer dependency status\")\n console.log(\" --help, -h Show this help message\")\n console.log(\"\\nThis command lists all custom rules provided by the functype plugin.\")\n return\n }\n\n // Handle dependency check\n if (checkDeps) {\n console.log(colorize(\"šŸ”§ ESLint Plugin Functype - Dependency Check\", \"bright\"))\n const result = validatePeerDependencies()\n printDependencyStatus(result)\n\n if (!result.isValid) {\n process.exit(1)\n }\n return\n }\n\n console.log(colorize(\"šŸ”§ ESLint Plugin Functype - Custom Rules\", \"bright\"))\n\n const distPath = path.join(__dirname, \"..\", \"..\", \"dist\")\n\n if (!fs.existsSync(distPath)) {\n console.error(colorize(\"āŒ Build directory not found. Run `pnpm run build` first.\", \"red\"))\n process.exit(1)\n }\n\n // Load the plugin to get available rules\n try {\n const pluginPath = path.join(distPath, \"index.js\")\n const plugin = require(pluginPath)\n\n if (!plugin.rules) {\n console.error(colorize(\"āŒ No rules found in plugin.\", \"red\"))\n process.exit(1)\n }\n\n console.log(colorize(\"\\nšŸ“¦ Available Custom Rules:\", \"bright\"))\n console.log(colorize(\"=\".repeat(40), \"blue\"))\n\n const rules = Object.keys(plugin.rules)\n\n rules.forEach((ruleName) => {\n const rule = plugin.rules[ruleName]\n const fullName = `functype/${ruleName}`\n\n console.log(`\\n${colorize(\"ā—\", \"green\")} ${colorize(fullName, \"bright\")}`)\n\n if (rule.meta?.docs?.description) {\n console.log(` ${colorize(\"Description:\", \"cyan\")} ${rule.meta.docs.description}`)\n }\n\n if (rule.meta?.type) {\n const typeColor = rule.meta.type === \"problem\" ? \"red\" : rule.meta.type === \"suggestion\" ? \"yellow\" : \"blue\"\n console.log(` ${colorize(\"Type:\", \"cyan\")} ${colorize(rule.meta.type, typeColor)}`)\n }\n\n if (rule.meta?.fixable) {\n console.log(` ${colorize(\"Fixable:\", \"cyan\")} ${colorize(\"Yes\", \"green\")}`)\n }\n\n if (showUsage) {\n console.log(` ${colorize(\"Usage:\", \"cyan\")} \"${fullName}\": \"error\"`)\n }\n })\n\n console.log(colorize(`\\nšŸ“Š Summary: ${rules.length} custom rules available`, \"bright\"))\n\n if (showUsage) {\n printCustomUsageInfo()\n }\n\n console.log(colorize(\"\\nšŸ’” Tips:\", \"bright\"))\n console.log(\"• Use --verbose to see detailed rule information\")\n console.log(\"• Use --usage to see configuration examples\")\n console.log('• All rules are prefixed with \"functype/\"')\n console.log(\"• Consider using eslint-config-functype for pre-configured setup\")\n\n console.log(colorize(\"\\nšŸ”— Links:\", \"bright\"))\n console.log(\"• Documentation: https://github.com/jordanburke/eslint-plugin-functype\")\n console.log(\"• Configuration Bundle: https://github.com/jordanburke/eslint-config-functype\")\n console.log(\"• Functype Library: https://github.com/jordanburke/functype\")\n } catch (error) {\n console.error(colorize(\"āŒ Error loading plugin:\", \"red\"), (error as Error).message)\n process.exit(1)\n }\n}\n\nfunction printCustomUsageInfo(): void {\n console.log(colorize(\"\\nšŸ’” Usage Examples:\", \"bright\"))\n console.log(colorize(\"=\".repeat(30), \"blue\"))\n console.log(\"\\n\" + colorize(\"ESLint 9+ (flat config):\", \"green\"))\n console.log(' import functypePlugin from \"eslint-plugin-functype\"')\n console.log(\" export default [\")\n console.log(\" {\")\n console.log(\" plugins: { functype: functypePlugin },\")\n console.log(\" rules: {\")\n console.log(' \"functype/prefer-option\": \"error\",')\n console.log(' \"functype/prefer-either\": \"error\",')\n console.log(' \"functype/no-get-unsafe\": \"error\",')\n console.log(\" }\")\n console.log(\" }\")\n console.log(\" ]\")\n console.log(\"\\n\" + colorize(\"With eslint-config-functype (recommended):\", \"green\"))\n console.log(' import functypeConfig from \"eslint-config-functype\"')\n console.log(\" export default [functypeConfig.recommended]\")\n}\n\n// Run the CLI\nmain().catch((error) => {\n console.error(colorize(\"āŒ Unexpected error:\", \"red\"), error)\n process.exit(1)\n})\n"]}
1
+ {"version":3,"file":"list-rules.js","names":[],"sources":["../../src/cli/list-rules.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport plugin from \"../index.js\"\nimport { validatePeerDependencies, type ValidationResult } from \"../utils/dependency-validator.js\"\n\n// Colors for console output\nconst colors = {\n reset: \"\\x1b[0m\",\n bright: \"\\x1b[1m\",\n red: \"\\x1b[31m\",\n green: \"\\x1b[32m\",\n yellow: \"\\x1b[33m\",\n blue: \"\\x1b[34m\",\n magenta: \"\\x1b[35m\",\n cyan: \"\\x1b[36m\",\n} as const\n\nfunction colorize(text: string, color: keyof typeof colors): string {\n return colors[color] + text + colors.reset\n}\n\n// Removed unused utility functions - they were for the old config-based approach\n\nfunction printDependencyStatus(result: ValidationResult): void {\n console.log(colorize(\"\\nšŸ” Dependency Status Check:\", \"bright\"))\n console.log(colorize(\"=\".repeat(40), \"blue\"))\n\n // Show available dependencies\n if (result.available.length > 0) {\n console.log(colorize(\"\\nāœ… Available:\", \"green\"))\n result.available.forEach((dep) => {\n const icon = dep.required ? \"šŸ”§\" : \"šŸ”Œ\"\n console.log(` ${icon} ${colorize(dep.name, \"green\")} - ${dep.description}`)\n })\n }\n\n // Show missing dependencies\n if (result.missing.length > 0) {\n console.log(colorize(\"\\nāŒ Missing:\", \"red\"))\n result.missing.forEach((dep) => {\n const icon = dep.required ? \"āš ļø \" : \"šŸ’”\"\n const color = dep.required ? \"red\" : \"yellow\"\n console.log(` ${icon} ${colorize(dep.name, color)} - ${dep.description}`)\n })\n\n if (result.installCommand) {\n console.log(colorize(\"\\nšŸ“¦ Install missing dependencies:\", \"bright\"))\n console.log(` ${colorize(result.installCommand, \"cyan\")}`)\n }\n }\n\n // Show warnings\n if (result.warnings.length > 0) {\n console.log(colorize(\"\\nāš ļø Warnings:\", \"yellow\"))\n result.warnings.forEach((warning) => console.log(` ${warning}`))\n }\n\n // Overall status\n const status = result.isValid ? \"āœ… Ready to use\" : \"āŒ Configuration will fail\"\n const statusColor = result.isValid ? \"green\" : \"red\"\n console.log(colorize(`\\n${status}`, statusColor))\n}\n\nasync function main(): Promise<void> {\n const args = process.argv.slice(2)\n const showHelp = args.includes(\"--help\") || args.includes(\"-h\")\n const showUsage = args.includes(\"--usage\") || args.includes(\"-u\")\n const checkDeps = args.includes(\"--check-deps\") || args.includes(\"--check\")\n\n if (showHelp) {\n console.log(colorize(\"šŸ“‹ ESLint Plugin Functype - Custom Rules\", \"bright\"))\n console.log(\"\\nUsage: pnpm run list-rules [options]\")\n console.log(\"\\nOptions:\")\n console.log(\" --verbose, -v Show rule descriptions and schemas\")\n console.log(\" --usage, -u Show usage examples\")\n console.log(\" --check-deps Check peer dependency status\")\n console.log(\" --help, -h Show this help message\")\n console.log(\"\\nThis command lists all custom rules provided by the functype plugin.\")\n return\n }\n\n // Handle dependency check\n if (checkDeps) {\n console.log(colorize(\"šŸ”§ ESLint Plugin Functype - Dependency Check\", \"bright\"))\n const result = validatePeerDependencies()\n printDependencyStatus(result)\n\n if (!result.isValid) {\n process.exit(1)\n }\n return\n }\n\n console.log(colorize(\"šŸ”§ ESLint Plugin Functype - Custom Rules\", \"bright\"))\n\n if (!plugin.rules) {\n console.error(colorize(\"āŒ No rules found in plugin.\", \"red\"))\n process.exit(1)\n }\n\n console.log(colorize(\"\\nšŸ“¦ Available Custom Rules:\", \"bright\"))\n console.log(colorize(\"=\".repeat(40), \"blue\"))\n\n const rules = Object.keys(plugin.rules)\n\n rules.forEach((ruleName) => {\n const rule = plugin.rules[ruleName]\n const fullName = `functype/${ruleName}`\n\n console.log(`\\n${colorize(\"ā—\", \"green\")} ${colorize(fullName, \"bright\")}`)\n\n if (rule.meta?.docs?.description) {\n console.log(` ${colorize(\"Description:\", \"cyan\")} ${rule.meta.docs.description}`)\n }\n\n if (rule.meta?.type) {\n const typeColor = rule.meta.type === \"problem\" ? \"red\" : rule.meta.type === \"suggestion\" ? \"yellow\" : \"blue\"\n console.log(` ${colorize(\"Type:\", \"cyan\")} ${colorize(rule.meta.type, typeColor)}`)\n }\n\n if (rule.meta?.fixable) {\n console.log(` ${colorize(\"Fixable:\", \"cyan\")} ${colorize(\"Yes\", \"green\")}`)\n }\n\n if (showUsage) {\n console.log(` ${colorize(\"Usage:\", \"cyan\")} \"${fullName}\": \"error\"`)\n }\n })\n\n console.log(colorize(`\\nšŸ“Š Summary: ${rules.length} custom rules available`, \"bright\"))\n\n if (showUsage) {\n printCustomUsageInfo()\n }\n\n console.log(colorize(\"\\nšŸ’” Tips:\", \"bright\"))\n console.log(\"• Use --verbose to see detailed rule information\")\n console.log(\"• Use --usage to see configuration examples\")\n console.log('• All rules are prefixed with \"functype/\"')\n console.log(\"• Consider using eslint-config-functype for pre-configured setup\")\n\n console.log(colorize(\"\\nšŸ”— Links:\", \"bright\"))\n console.log(\"• Documentation: https://github.com/jordanburke/eslint-plugin-functype\")\n console.log(\"• Configuration Bundle: https://github.com/jordanburke/eslint-config-functype\")\n console.log(\"• Functype Library: https://github.com/jordanburke/functype\")\n}\n\nfunction printCustomUsageInfo(): void {\n console.log(colorize(\"\\nšŸ’” Usage Examples:\", \"bright\"))\n console.log(colorize(\"=\".repeat(30), \"blue\"))\n console.log(\"\\n\" + colorize(\"ESLint 9+ (flat config):\", \"green\"))\n console.log(' import functypePlugin from \"eslint-plugin-functype\"')\n console.log(\" export default [\")\n console.log(\" {\")\n console.log(\" plugins: { functype: functypePlugin },\")\n console.log(\" rules: {\")\n console.log(' \"functype/prefer-option\": \"error\",')\n console.log(' \"functype/prefer-either\": \"error\",')\n console.log(' \"functype/no-get-unsafe\": \"error\",')\n console.log(\" }\")\n console.log(\" }\")\n console.log(\" ]\")\n console.log(\"\\n\" + colorize(\"With eslint-config-functype (recommended):\", \"green\"))\n console.log(' import functypeConfig from \"eslint-config-functype\"')\n console.log(\" export default [functypeConfig.recommended]\")\n}\n\n// Run the CLI\nmain().catch((error) => {\n console.error(colorize(\"āŒ Unexpected error:\", \"red\"), error)\n process.exit(1)\n})\n"],"mappings":";uGAMA,MAAM,EAAS,CACb,MAAO,UACP,OAAQ,UACR,IAAK,WACL,MAAO,WACP,OAAQ,WACR,KAAM,WACN,QAAS,WACT,KAAM,WACP,CAED,SAAS,EAAS,EAAc,EAAoC,CAClE,OAAO,EAAO,GAAS,EAAO,EAAO,MAKvC,SAAS,EAAsB,EAAgC,CAC7D,QAAQ,IAAI,EAAS;6BAAiC,SAAS,CAAC,CAChE,QAAQ,IAAI,EAAS,IAAI,OAAO,GAAG,CAAE,OAAO,CAAC,CAGzC,EAAO,UAAU,OAAS,IAC5B,QAAQ,IAAI,EAAS;cAAkB,QAAQ,CAAC,CAChD,EAAO,UAAU,QAAS,GAAQ,CAChC,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,CAC7C,QAAQ,IAAI,mDAAmD,CAC/D,QAAQ,IAAI,8CAA8C,CAC1D,QAAQ,IAAI,4CAA4C,CACxD,QAAQ,IAAI,mEAAmE,CAE/E,QAAQ,IAAI,EAAS;WAAe,SAAS,CAAC,CAC9C,QAAQ,IAAI,yEAAyE,CACrF,QAAQ,IAAI,gFAAgF,CAC5F,QAAQ,IAAI,8DAA8D,CAG5E,SAAS,GAA6B,CACpC,QAAQ,IAAI,EAAS;oBAAwB,SAAS,CAAC,CACvD,QAAQ,IAAI,EAAS,IAAI,OAAO,GAAG,CAAE,OAAO,CAAC,CAC7C,QAAQ,IAAI;EAAO,EAAS,2BAA4B,QAAQ,CAAC,CACjE,QAAQ,IAAI,wDAAwD,CACpE,QAAQ,IAAI,qBAAqB,CACjC,QAAQ,IAAI,QAAQ,CACpB,QAAQ,IAAI,+CAA+C,CAC3D,QAAQ,IAAI,iBAAiB,CAC7B,QAAQ,IAAI,6CAA6C,CACzD,QAAQ,IAAI,6CAA6C,CACzD,QAAQ,IAAI,6CAA6C,CACzD,QAAQ,IAAI,UAAU,CACtB,QAAQ,IAAI,QAAQ,CACpB,QAAQ,IAAI,MAAM,CAClB,QAAQ,IAAI;EAAO,EAAS,6CAA8C,QAAQ,CAAC,CACnF,QAAQ,IAAI,wDAAwD,CACpE,QAAQ,IAAI,gDAAgD,CAI9D,GAAM,CAAC,MAAO,GAAU,CACtB,QAAQ,MAAM,EAAS,sBAAuB,MAAM,CAAE,EAAM,CAC5D,QAAQ,KAAK,EAAE,EACf"}
package/dist/index.d.ts CHANGED
@@ -1,21 +1,23 @@
1
- import * as eslint from 'eslint';
1
+ import * as eslint from "eslint";
2
2
 
3
+ //#region src/index.d.ts
3
4
  declare const plugin: {
4
- rules: {
5
- "prefer-option": eslint.Rule.RuleModule;
6
- "prefer-either": eslint.Rule.RuleModule;
7
- "prefer-list": eslint.Rule.RuleModule;
8
- "no-get-unsafe": eslint.Rule.RuleModule;
9
- "prefer-fold": eslint.Rule.RuleModule;
10
- "prefer-map": eslint.Rule.RuleModule;
11
- "prefer-flatmap": eslint.Rule.RuleModule;
12
- "no-imperative-loops": eslint.Rule.RuleModule;
13
- "prefer-do-notation": eslint.Rule.RuleModule;
14
- };
15
- meta: {
16
- name: string;
17
- version: string;
18
- };
5
+ rules: {
6
+ "prefer-option": eslint.Rule.RuleModule;
7
+ "prefer-either": eslint.Rule.RuleModule;
8
+ "prefer-list": eslint.Rule.RuleModule;
9
+ "no-get-unsafe": eslint.Rule.RuleModule;
10
+ "prefer-fold": eslint.Rule.RuleModule;
11
+ "prefer-map": eslint.Rule.RuleModule;
12
+ "prefer-flatmap": eslint.Rule.RuleModule;
13
+ "no-imperative-loops": eslint.Rule.RuleModule;
14
+ "prefer-do-notation": eslint.Rule.RuleModule;
15
+ };
16
+ meta: {
17
+ name: string;
18
+ version: string;
19
+ };
19
20
  };
20
-
21
+ //#endregion
21
22
  export { plugin as default };
23
+ //# sourceMappingURL=index.d.ts.map