eslint-plugin-functype 1.2.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 (47) hide show
  1. package/README.md +86 -44
  2. package/dist/chunk-BlXvk904.js +1 -0
  3. package/dist/cli/list-rules.d.ts +1 -1
  4. package/dist/cli/list-rules.js +15 -239
  5. package/dist/cli/list-rules.js.map +1 -1
  6. package/dist/index.d.ts +19 -16
  7. package/dist/index.js +1 -1075
  8. package/dist/index.js.map +1 -1
  9. package/dist/rules/index.d.ts +24 -29
  10. package/dist/rules/index.js +1 -1071
  11. package/dist/rules/index.js.map +1 -1
  12. package/dist/rules/no-get-unsafe.d.ts +7 -0
  13. package/dist/rules/no-get-unsafe.js +2 -0
  14. package/dist/rules/no-get-unsafe.js.map +1 -0
  15. package/dist/rules/no-imperative-loops.d.ts +7 -0
  16. package/dist/rules/no-imperative-loops.js +2 -0
  17. package/dist/rules/no-imperative-loops.js.map +1 -0
  18. package/dist/rules/prefer-do-notation.d.ts +7 -0
  19. package/dist/rules/prefer-do-notation.js +5 -0
  20. package/dist/rules/prefer-do-notation.js.map +1 -0
  21. package/dist/rules/prefer-either.d.ts +7 -0
  22. package/dist/rules/prefer-either.js +2 -0
  23. package/dist/rules/prefer-either.js.map +1 -0
  24. package/dist/rules/prefer-flatmap.d.ts +7 -0
  25. package/dist/rules/prefer-flatmap.js +2 -0
  26. package/dist/rules/prefer-flatmap.js.map +1 -0
  27. package/dist/rules/prefer-fold.d.ts +7 -0
  28. package/dist/rules/prefer-fold.js +2 -0
  29. package/dist/rules/prefer-fold.js.map +1 -0
  30. package/dist/rules/prefer-list.d.ts +7 -0
  31. package/dist/rules/prefer-list.js +2 -0
  32. package/dist/rules/prefer-list.js.map +1 -0
  33. package/dist/rules/prefer-map.d.ts +7 -0
  34. package/dist/rules/prefer-map.js +2 -0
  35. package/dist/rules/prefer-map.js.map +1 -0
  36. package/dist/rules/prefer-option.d.ts +7 -0
  37. package/dist/rules/prefer-option.js +2 -0
  38. package/dist/rules/prefer-option.js.map +1 -0
  39. package/dist/types/ast.d.ts +12 -0
  40. package/dist/types/ast.js +1 -0
  41. package/dist/utils/dependency-validator.d.ts +13 -11
  42. package/dist/utils/dependency-validator.js +3 -108
  43. package/dist/utils/dependency-validator.js.map +1 -1
  44. package/dist/utils/functype-detection.d.ts +69 -0
  45. package/dist/utils/functype-detection.js +2 -0
  46. package/dist/utils/functype-detection.js.map +1 -0
  47. package/package.json +37 -34
@@ -1,18 +1,20 @@
1
+ //#region src/utils/dependency-validator.d.ts
1
2
  interface PeerDependency {
2
- name: string;
3
- packageName: string;
4
- description: string;
5
- required: boolean;
3
+ name: string;
4
+ packageName: string;
5
+ description: string;
6
+ required: boolean;
6
7
  }
7
8
  interface ValidationResult {
8
- isValid: boolean;
9
- missing: PeerDependency[];
10
- available: PeerDependency[];
11
- installCommand: string;
12
- warnings: string[];
9
+ isValid: boolean;
10
+ missing: PeerDependency[];
11
+ available: PeerDependency[];
12
+ installCommand: string;
13
+ warnings: string[];
13
14
  }
14
15
  declare function validatePeerDependencies(): ValidationResult;
15
16
  declare function createValidationError(result: ValidationResult): Error;
16
17
  declare function shouldValidateDependencies(): boolean;
17
-
18
- export { type ValidationResult, createValidationError, shouldValidateDependencies, validatePeerDependencies };
18
+ //#endregion
19
+ export { ValidationResult, createValidationError, shouldValidateDependencies, validatePeerDependencies };
20
+ //# sourceMappingURL=dependency-validator.d.ts.map
@@ -1,109 +1,4 @@
1
- 'use strict';
2
-
3
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
- }) : x)(function(x) {
6
- if (typeof require !== "undefined") return require.apply(this, arguments);
7
- throw Error('Dynamic require of "' + x + '" is not supported');
8
- });
9
-
10
- // src/utils/dependency-validator.ts
11
- var PEER_DEPENDENCIES = [
12
- {
13
- name: "@typescript-eslint/eslint-plugin",
14
- packageName: "@typescript-eslint/eslint-plugin",
15
- description: "TypeScript-aware ESLint rules",
16
- required: true
17
- },
18
- {
19
- name: "@typescript-eslint/parser",
20
- packageName: "@typescript-eslint/parser",
21
- description: "TypeScript parser for ESLint",
22
- required: true
23
- },
24
- {
25
- name: "eslint-plugin-functional",
26
- packageName: "eslint-plugin-functional",
27
- description: "Functional programming ESLint rules",
28
- required: true
29
- },
30
- {
31
- name: "eslint-plugin-prettier",
32
- packageName: "eslint-plugin-prettier",
33
- description: "Code formatting rules",
34
- required: false
35
- },
36
- {
37
- name: "eslint-plugin-simple-import-sort",
38
- packageName: "eslint-plugin-simple-import-sort",
39
- description: "Import sorting rules",
40
- required: false
41
- },
42
- {
43
- name: "prettier",
44
- packageName: "prettier",
45
- description: "Code formatter",
46
- required: false
47
- }
48
- ];
49
- function tryRequire(packageName) {
50
- try {
51
- __require.resolve(packageName);
52
- return true;
53
- } catch {
54
- return false;
55
- }
56
- }
57
- function validatePeerDependencies() {
58
- const missing = [];
59
- const available = [];
60
- const warnings = [];
61
- for (const dep of PEER_DEPENDENCIES) {
62
- if (tryRequire(dep.packageName)) {
63
- available.push(dep);
64
- } else {
65
- missing.push(dep);
66
- if (dep.required) ; else {
67
- warnings.push(`Optional plugin '${dep.name}' not found. Some rules will be skipped.`);
68
- }
69
- }
70
- }
71
- const requiredMissing = missing.filter((dep) => dep.required);
72
- const isValid = requiredMissing.length === 0;
73
- const missingPackageNames = missing.map((dep) => dep.packageName);
74
- const installCommand = missingPackageNames.length > 0 ? `pnpm add -D ${missingPackageNames.join(" ")}` : "";
75
- return {
76
- isValid,
77
- missing,
78
- available,
79
- installCommand,
80
- warnings
81
- };
82
- }
83
- function createValidationError(result) {
84
- const requiredMissing = result.missing.filter((dep) => dep.required);
85
- if (requiredMissing.length === 0) {
86
- return new Error("No validation errors");
87
- }
88
- const missingList = requiredMissing.map((dep) => ` \u2022 ${dep.name} - ${dep.description}`).join("\n");
89
- const message = [
90
- "\u274C Missing required peer dependencies for eslint-plugin-functype:",
91
- "",
92
- missingList,
93
- "",
94
- "\u{1F4E6} Install missing dependencies:",
95
- ` ${result.installCommand}`,
96
- "",
97
- "\u{1F4D6} See installation guide: https://github.com/jordanburke/eslint-plugin-functype#installation"
98
- ].join("\n");
99
- return new Error(message);
100
- }
101
- function shouldValidateDependencies() {
102
- return process.env.NODE_ENV !== "test" && process.env.FUNCTYPE_SKIP_VALIDATION !== "true";
103
- }
104
-
105
- exports.createValidationError = createValidationError;
106
- exports.shouldValidateDependencies = shouldValidateDependencies;
107
- exports.validatePeerDependencies = validatePeerDependencies;
108
- //# sourceMappingURL=dependency-validator.js.map
1
+ import{t as e}from"../chunk-BlXvk904.js";const t=[{name:`@typescript-eslint/eslint-plugin`,packageName:`@typescript-eslint/eslint-plugin`,description:`TypeScript-aware ESLint rules`,required:!0},{name:`@typescript-eslint/parser`,packageName:`@typescript-eslint/parser`,description:`TypeScript parser for ESLint`,required:!0},{name:`eslint-plugin-functional`,packageName:`eslint-plugin-functional`,description:`Functional programming ESLint rules`,required:!0},{name:`eslint-plugin-prettier`,packageName:`eslint-plugin-prettier`,description:`Code formatting rules`,required:!1},{name:`eslint-plugin-simple-import-sort`,packageName:`eslint-plugin-simple-import-sort`,description:`Import sorting rules`,required:!1},{name:`prettier`,packageName:`prettier`,description:`Code formatter`,required:!1}];function n(t){try{return e.resolve(t),!0}catch{return!1}}function r(){let e=[],r=[],i=[];for(let a of t)n(a.packageName)?r.push(a):(e.push(a),a.required||i.push(`Optional plugin '${a.name}' not found. Some rules will be skipped.`));let a=e.filter(e=>e.required).length===0,o=e.map(e=>e.packageName);return{isValid:a,missing:e,available:r,installCommand:o.length>0?`pnpm add -D ${o.join(` `)}`:``,warnings:i}}function i(e){let t=e.missing.filter(e=>e.required);if(t.length===0)return Error(`No validation errors`);let n=[`❌ Missing required peer dependencies for eslint-plugin-functype:`,``,t.map(e=>` • ${e.name} - ${e.description}`).join(`
2
+ `),``,`📦 Install missing dependencies:`,` ${e.installCommand}`,``,`📖 See installation guide: https://github.com/jordanburke/eslint-plugin-functype#installation`].join(`
3
+ `);return Error(n)}function a(){return process.env.NODE_ENV!==`test`&&process.env.FUNCTYPE_SKIP_VALIDATION!==`true`}export{i as createValidationError,a as shouldValidateDependencies,r as validatePeerDependencies};
109
4
  //# sourceMappingURL=dependency-validator.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/dependency-validator.ts"],"names":[],"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,8BAAA;AAAA,IACb,QAAA,EAAU;AAAA,GACZ;AAAA,EACA;AAAA,IACE,IAAA,EAAM,0BAAA;AAAA,IACN,WAAA,EAAa,0BAAA;AAAA,IACb,WAAA,EAAa,qCAAA;AAAA,IACb,QAAA,EAAU;AAAA,GACZ;AAAA,EACA;AAAA,IACE,IAAA,EAAM,wBAAA;AAAA,IACN,WAAA,EAAa,wBAAA;AAAA,IACb,WAAA,EAAa,uBAAA;AAAA,IACb,QAAA,EAAU;AAAA,GACZ;AAAA,EACA;AAAA,IACE,IAAA,EAAM,kCAAA;AAAA,IACN,WAAA,EAAa,kCAAA;AAAA,IACb,WAAA,EAAa,sBAAA;AAAA,IACb,QAAA,EAAU;AAAA,GACZ;AAAA,EACA;AAAA,IACE,IAAA,EAAM,UAAA;AAAA,IACN,WAAA,EAAa,UAAA;AAAA,IACb,WAAA,EAAa,gBAAA;AAAA,IACb,QAAA,EAAU;AAAA;AAEd,CAAA;AAUA,SAAS,WAAW,WAAA,EAA8B;AAChD,EAAA,IAAI;AACF,IAAA,SAAA,CAAQ,QAAQ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AAO,IAAI,QAAQ,CAAA;AAEjE,EAAA,IAAI,eAAA,CAAgB,WAAW,CAAA,EAAG;AAChC,IAAA,OAAO,IAAI,MAAM,sBAAsB,CAAA;AAAA,EACzC;AAEA,EAAA,MAAM,WAAA,GAAc,eAAA,CACjB,GAAA,CAAI,CAAA,GAAA,KAAO,CAAA,SAAA,EAAO,GAAA,CAAI,IAAI,CAAA,GAAA,EAAM,GAAA,CAAI,WAAW,CAAA,CAAE,CAAA,CACjD,KAAK,IAAI,CAAA;AAEZ,EAAA,MAAM,OAAA,GAAU;AAAA,IACd,uEAAA;AAAA,IACA,EAAA;AAAA,IACA,WAAA;AAAA,IACA,EAAA;AAAA,IACA,yCAAA;AAAA,IACA,CAAA,GAAA,EAAM,OAAO,cAAc,CAAA,CAAA;AAAA,IAC3B,EAAA;AAAA,IACA;AAAA,GACF,CAAE,KAAK,IAAI,CAAA;AAEX,EAAA,OAAO,IAAI,MAAM,OAAO,CAAA;AAC1B;AAEO,SAAS,0BAAA,GAAsC;AAEpD,EAAA,OAAO,QAAQ,GAAA,CAAI,QAAA,KAAa,MAAA,IACzB,OAAA,CAAQ,IAAI,wBAAA,KAA6B,MAAA;AAClD","file":"dependency-validator.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 \n ? `pnpm add -D ${missingPackageNames.join(' ')}`\n : ''\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\n .map(dep => ` • ${dep.name} - ${dep.description}`)\n .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' && \n process.env.FUNCTYPE_SKIP_VALIDATION !== 'true'\n}"]}
1
+ {"version":3,"file":"dependency-validator.js","names":[],"sources":["../../src/utils/dependency-validator.ts"],"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"],"mappings":"yCASA,MAAM,EAAsC,CAC1C,CACE,KAAM,mCACN,YAAa,mCACb,YAAa,gCACb,SAAU,GACX,CACD,CACE,KAAM,4BACN,YAAa,4BACb,YAAa,+BACb,SAAU,GACX,CACD,CACE,KAAM,2BACN,YAAa,2BACb,YAAa,sCACb,SAAU,GACX,CACD,CACE,KAAM,yBACN,YAAa,yBACb,YAAa,wBACb,SAAU,GACX,CACD,CACE,KAAM,mCACN,YAAa,mCACb,YAAa,uBACb,SAAU,GACX,CACD,CACE,KAAM,WACN,YAAa,WACb,YAAa,iBACb,SAAU,GACX,CACF,CAUD,SAAS,EAAW,EAA8B,CAChD,GAAI,CAEF,OADA,EAAQ,QAAQ,EAAY,CACrB,QACD,CACN,MAAO,IAIX,SAAgB,GAA6C,CAC3D,IAAM,EAA4B,EAAE,CAC9B,EAA8B,EAAE,CAChC,EAAqB,EAAE,CAE7B,IAAK,IAAM,KAAO,EACZ,EAAW,EAAI,YAAY,CAC7B,EAAU,KAAK,EAAI,EAEnB,EAAQ,KAAK,EAAI,CACb,EAAI,UAIN,EAAS,KAAK,oBAAoB,EAAI,KAAK,0CAA0C,EAM3F,IAAM,EADkB,EAAQ,OAAQ,GAAQ,EAAI,SAAS,CAC7B,SAAW,EAGrC,EAAsB,EAAQ,IAAK,GAAQ,EAAI,YAAY,CAGjE,MAAO,CACL,UACA,UACA,YACA,eANqB,EAAoB,OAAS,EAAI,eAAe,EAAoB,KAAK,IAAI,GAAK,GAOvG,WACD,CAGH,SAAgB,EAAsB,EAAiC,CACrE,IAAM,EAAkB,EAAO,QAAQ,OAAQ,GAAQ,EAAI,SAAS,CAEpE,GAAI,EAAgB,SAAW,EAC7B,OAAW,MAAM,uBAAuB,CAK1C,IAAM,EAAU,CACd,mEACA,GAJkB,EAAgB,IAAK,GAAQ,OAAO,EAAI,KAAK,KAAK,EAAI,cAAc,CAAC,KAAK;EAAK,CAMjG,GACA,mCACA,MAAM,EAAO,iBACb,GACA,gGACD,CAAC,KAAK;EAAK,CAEZ,OAAW,MAAM,EAAQ,CAG3B,SAAgB,GAAsC,CAEpD,OAAO,QAAQ,IAAI,WAAa,QAAU,QAAQ,IAAI,2BAA6B"}
@@ -0,0 +1,69 @@
1
+ import { ASTNode } from "../types/ast.js";
2
+ import { Rule } from "eslint";
3
+
4
+ //#region src/utils/functype-detection.d.ts
5
+ /**
6
+ * Utility functions for detecting functype library usage in ESLint rules
7
+ */
8
+ /**
9
+ * Check if functype library is imported in the current file
10
+ */
11
+ declare function hasFunctypeImport(context: Rule.RuleContext): boolean;
12
+ /**
13
+ * Enhanced functype imports tracking
14
+ */
15
+ interface FunctypeImports {
16
+ types: Set<string>;
17
+ functions: Set<string>;
18
+ all: Set<string>;
19
+ }
20
+ /**
21
+ * Get imported functype symbols from the current file
22
+ */
23
+ declare function getFunctypeImports(context: Rule.RuleContext): FunctypeImports;
24
+ /**
25
+ * Legacy compatibility - returns the 'all' set
26
+ */
27
+ declare function getFunctypeImportsLegacy(context: Rule.RuleContext): Set<string>;
28
+ /**
29
+ * Check if a type reference is using functype types
30
+ */
31
+ declare function isFunctypeType(node: ASTNode, functypeImports: FunctypeImports | Set<string>): boolean;
32
+ /**
33
+ * Check if a call expression is using functype methods
34
+ */
35
+ declare function isFunctypeCall(node: ASTNode, functypeImports: Set<string>): boolean;
36
+ /**
37
+ * Check if current context is already using functype patterns appropriately
38
+ */
39
+ declare function isAlreadyUsingFunctype(node: ASTNode, functypeImports: Set<string>): boolean;
40
+ /**
41
+ * Check if a variable or parameter is typed with functype types
42
+ */
43
+ declare function hasFunctypeTypeAnnotation(node: ASTNode, functypeImports: FunctypeImports | Set<string>): boolean;
44
+ /**
45
+ * Check if a call expression is a Do notation call
46
+ */
47
+ declare function isDoNotationCall(node: ASTNode, functypeImports: FunctypeImports): boolean;
48
+ /**
49
+ * Check if a call expression uses the $ helper function
50
+ */
51
+ declare function isDollarHelper(node: ASTNode, functypeImports: FunctypeImports): boolean;
52
+ /**
53
+ * Check if current expression is inside a Do notation block
54
+ */
55
+ declare function isInsideDoNotation(node: ASTNode, functypeImports: FunctypeImports): boolean;
56
+ /**
57
+ * Check if a method call is a chained method call on functype types
58
+ */
59
+ declare function isChainedMethodCall(node: ASTNode, methodName: string): boolean;
60
+ /**
61
+ * Detect if code could benefit from Do notation
62
+ */
63
+ declare function shouldUseDoNotation(node: ASTNode, functypeImports: FunctypeImports): {
64
+ shouldUse: boolean;
65
+ reason: "nested-checks" | "chained-flatmaps" | "mixed-monads" | "async-chains" | null;
66
+ };
67
+ //#endregion
68
+ export { FunctypeImports, getFunctypeImports, getFunctypeImportsLegacy, hasFunctypeImport, hasFunctypeTypeAnnotation, isAlreadyUsingFunctype, isChainedMethodCall, isDoNotationCall, isDollarHelper, isFunctypeCall, isFunctypeType, isInsideDoNotation, shouldUseDoNotation };
69
+ //# sourceMappingURL=functype-detection.d.ts.map
@@ -0,0 +1,2 @@
1
+ function e(e){let t=e.sourceCode.ast;for(let e of t.body)if(e.type===`ImportDeclaration`&&e.source.type===`Literal`&&e.source.value===`functype`)return!0;return!1}function t(e){let t=new Set,n=new Set,r=new Set,i=e.sourceCode.ast;for(let e of i.body)if(e.type===`ImportDeclaration`&&e.source.type===`Literal`&&e.source.value===`functype`&&e.specifiers)for(let i of e.specifiers)if(i.type===`ImportSpecifier`&&i.imported.type===`Identifier`){let e=i.imported.name;r.add(e),[`Option`,`Either`,`List`,`LazyList`,`Task`,`Try`].includes(e)?t.add(e):([`Do`,`DoAsync`,`$`].includes(e),n.add(e))}else i.type===`ImportDefaultSpecifier`?(r.add(`default`),n.add(`default`)):i.type===`ImportNamespaceSpecifier`&&(r.add(`*`),t.add(`*`),n.add(`*`));return{types:t,functions:n,all:r}}function n(e){return t(e).all}function r(e,t){if(!e)return!1;let n=t instanceof Set?t:t.types||t.all;if(e.type===`TSTypeReference`&&e.typeName?.type===`Identifier`){let t=e.typeName.name;return n.has(t)||[`Option`,`Either`,`List`,`LazyList`,`Task`,`Try`].includes(t)}return!1}function i(e,t){if(!e||e.type!==`CallExpression`)return!1;let n=e.callee;if(n.type===`MemberExpression`&&n.object.type===`Identifier`){let e=n.object.name,r=n.property?.name;if(t.has(e)||e===`Option`&&[`some`,`none`,`of`].includes(r)||e===`Either`&&[`left`,`right`,`of`].includes(r)||e===`List`&&[`of`,`from`,`empty`].includes(r))return!0}if(n.type===`MemberExpression`){let e=n.property?.name;if([`map`,`flatMap`,`filter`,`fold`,`foldLeft`,`foldRight`,`getOrElse`,`orElse`,`isEmpty`,`nonEmpty`,`isDefined`,`isSome`,`isNone`,`isLeft`,`isRight`,`toArray`].includes(e))return!0}return!1}function a(e,t){let n=e.parent;for(;n;){if(i(n,t)||r(n,t))return!0;n=n.parent}return!1}function o(e,t){return e.typeAnnotation?.typeAnnotation?r(e.typeAnnotation.typeAnnotation,t):!1}function s(e,t){if(!e||e.type!==`CallExpression`)return!1;let n=e.callee;if(n.type===`Identifier`){let e=n.name;return t.functions.has(e)&&[`Do`,`DoAsync`].includes(e)}return!1}function c(e,t){if(!e||e.type!==`CallExpression`)return!1;let n=e.callee;return n.type===`Identifier`&&n.name===`$`?t.functions.has(`$`):!1}function l(e,t){let n=e.parent;for(;n;){if(n.type===`CallExpression`&&s(n,t))return!0;n=n.parent}return!1}function u(e,t){if(!e||e.type!==`CallExpression`)return!1;let n=e.callee;return n.type===`MemberExpression`&&n.property.type===`Identifier`&&n.property.name===t}function d(e,t){if(l(e,t))return{shouldUse:!1,reason:null};if(e.type===`LogicalExpression`&&e.operator===`&&`){let t=e.toString?e.toString():``;if(t.includes(`&&`)&&t.match(/\w+(\.\w+){2,}/))return{shouldUse:!0,reason:`nested-checks`}}if(u(e,`flatMap`)){let t=0,n=e;for(;n&&n.type===`CallExpression`&&u(n,`flatMap`)&&(t++,n.callee.type===`MemberExpression`);)n=n.callee.object;if(t>=3)return{shouldUse:!0,reason:`chained-flatmaps`}}return{shouldUse:!1,reason:null}}export{t as getFunctypeImports,n as getFunctypeImportsLegacy,e as hasFunctypeImport,o as hasFunctypeTypeAnnotation,a as isAlreadyUsingFunctype,u as isChainedMethodCall,s as isDoNotationCall,c as isDollarHelper,i as isFunctypeCall,r as isFunctypeType,l as isInsideDoNotation,d as shouldUseDoNotation};
2
+ //# sourceMappingURL=functype-detection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functype-detection.js","names":[],"sources":["../../src/utils/functype-detection.ts"],"sourcesContent":["import type { Rule } from \"eslint\"\n\nimport type { ASTNode } from \"../types/ast\"\n\n/**\n * Utility functions for detecting functype library usage in ESLint rules\n */\n\n/**\n * Check if functype library is imported in the current file\n */\nexport function hasFunctypeImport(context: Rule.RuleContext): boolean {\n const sourceCode = context.sourceCode\n const program = sourceCode.ast\n\n // Look for import statements that import from 'functype'\n for (const node of program.body) {\n if (node.type === \"ImportDeclaration\" && node.source.type === \"Literal\" && node.source.value === \"functype\") {\n return true\n }\n }\n\n return false\n}\n\n/**\n * Enhanced functype imports tracking\n */\nexport interface FunctypeImports {\n types: Set<string> // Option, Either, List, etc.\n functions: Set<string> // Do, DoAsync, $, etc.\n all: Set<string> // Combined for compatibility\n}\n\n/**\n * Get imported functype symbols from the current file\n */\nexport function getFunctypeImports(context: Rule.RuleContext): FunctypeImports {\n const types = new Set<string>()\n const functions = new Set<string>()\n const all = new Set<string>()\n\n const sourceCode = context.sourceCode\n const program = sourceCode.ast\n\n for (const node of program.body) {\n if (node.type === \"ImportDeclaration\" && node.source.type === \"Literal\" && node.source.value === \"functype\") {\n // Handle named imports: import { Option, Either, Do, $ } from 'functype'\n if (node.specifiers) {\n for (const spec of node.specifiers) {\n if (spec.type === \"ImportSpecifier\" && spec.imported.type === \"Identifier\") {\n const name = spec.imported.name\n all.add(name)\n\n // Categorize imports\n if ([\"Option\", \"Either\", \"List\", \"LazyList\", \"Task\", \"Try\"].includes(name)) {\n types.add(name)\n } else if ([\"Do\", \"DoAsync\", \"$\"].includes(name)) {\n functions.add(name)\n } else {\n // Other imports (constructors, utilities, etc.)\n functions.add(name)\n }\n } else if (spec.type === \"ImportDefaultSpecifier\") {\n all.add(\"default\")\n functions.add(\"default\")\n } else if (spec.type === \"ImportNamespaceSpecifier\") {\n all.add(\"*\")\n types.add(\"*\")\n functions.add(\"*\")\n }\n }\n }\n }\n }\n\n return { types, functions, all }\n}\n\n/**\n * Legacy compatibility - returns the 'all' set\n */\nexport function getFunctypeImportsLegacy(context: Rule.RuleContext): Set<string> {\n return getFunctypeImports(context).all\n}\n\n/**\n * Check if a type reference is using functype types\n */\nexport function isFunctypeType(node: ASTNode, functypeImports: FunctypeImports | Set<string>): boolean {\n if (!node) return false\n\n // Handle both new and legacy API\n const types = functypeImports instanceof Set ? functypeImports : functypeImports.types || functypeImports.all\n\n // Check direct type names\n if (node.type === \"TSTypeReference\" && node.typeName?.type === \"Identifier\") {\n const typeName = node.typeName.name\n return types.has(typeName) || [\"Option\", \"Either\", \"List\", \"LazyList\", \"Task\", \"Try\"].includes(typeName)\n }\n\n return false\n}\n\n/**\n * Check if a call expression is using functype methods\n */\nexport function isFunctypeCall(node: ASTNode, functypeImports: Set<string>): boolean {\n if (!node || node.type !== \"CallExpression\") return false\n\n const callee = node.callee\n\n // Check for static method calls like Option.some(), Either.left(), List.of()\n if (callee.type === \"MemberExpression\" && callee.object.type === \"Identifier\") {\n const objectName = callee.object.name\n const methodName = callee.property?.name\n\n // Check if calling methods on imported functype types\n if (functypeImports.has(objectName)) return true\n\n // Check for common functype patterns\n if (\n (objectName === \"Option\" && [\"some\", \"none\", \"of\"].includes(methodName)) ||\n (objectName === \"Either\" && [\"left\", \"right\", \"of\"].includes(methodName)) ||\n (objectName === \"List\" && [\"of\", \"from\", \"empty\"].includes(methodName))\n ) {\n return true\n }\n }\n\n // Check for method calls on functype instances like someOption.map()\n if (callee.type === \"MemberExpression\") {\n const methodName = callee.property?.name\n\n // Common functype methods\n if (\n [\n \"map\",\n \"flatMap\",\n \"filter\",\n \"fold\",\n \"foldLeft\",\n \"foldRight\",\n \"getOrElse\",\n \"orElse\",\n \"isEmpty\",\n \"nonEmpty\",\n \"isDefined\",\n \"isSome\",\n \"isNone\",\n \"isLeft\",\n \"isRight\",\n \"toArray\",\n ].includes(methodName)\n ) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * Check if current context is already using functype patterns appropriately\n */\nexport function isAlreadyUsingFunctype(node: ASTNode, functypeImports: Set<string>): boolean {\n let parent = node.parent\n\n // Walk up the AST to find functype usage\n while (parent) {\n if (isFunctypeCall(parent as ASTNode, functypeImports) || isFunctypeType(parent as ASTNode, functypeImports)) {\n return true\n }\n parent = parent.parent\n }\n\n return false\n}\n\n/**\n * Check if a variable or parameter is typed with functype types\n */\nexport function hasFunctypeTypeAnnotation(node: ASTNode, functypeImports: FunctypeImports | Set<string>): boolean {\n // Check for type annotation\n if (node.typeAnnotation?.typeAnnotation) {\n return isFunctypeType(node.typeAnnotation.typeAnnotation, functypeImports)\n }\n\n return false\n}\n\n/**\n * Check if a call expression is a Do notation call\n */\nexport function isDoNotationCall(node: ASTNode, functypeImports: FunctypeImports): boolean {\n if (!node || node.type !== \"CallExpression\") return false\n\n const callee = node.callee\n\n // Check for Do() or DoAsync() calls\n if (callee.type === \"Identifier\") {\n const name = callee.name\n return functypeImports.functions.has(name) && [\"Do\", \"DoAsync\"].includes(name)\n }\n\n return false\n}\n\n/**\n * Check if a call expression uses the $ helper function\n */\nexport function isDollarHelper(node: ASTNode, functypeImports: FunctypeImports): boolean {\n if (!node || node.type !== \"CallExpression\") return false\n\n const callee = node.callee\n\n // Check for $() calls\n if (callee.type === \"Identifier\" && callee.name === \"$\") {\n return functypeImports.functions.has(\"$\")\n }\n\n return false\n}\n\n/**\n * Check if current expression is inside a Do notation block\n */\nexport function isInsideDoNotation(node: ASTNode, functypeImports: FunctypeImports): boolean {\n let current = node.parent\n\n while (current) {\n if (current.type === \"CallExpression\" && isDoNotationCall(current as ASTNode, functypeImports)) {\n return true\n }\n current = current.parent\n }\n\n return false\n}\n\n/**\n * Check if a method call is a chained method call on functype types\n */\nexport function isChainedMethodCall(node: ASTNode, methodName: string): boolean {\n if (!node || node.type !== \"CallExpression\") return false\n\n const callee = node.callee\n\n if (\n callee.type === \"MemberExpression\" &&\n callee.property.type === \"Identifier\" &&\n callee.property.name === methodName\n ) {\n return true\n }\n\n return false\n}\n\n/**\n * Detect if code could benefit from Do notation\n */\nexport function shouldUseDoNotation(\n node: ASTNode,\n functypeImports: FunctypeImports,\n): {\n shouldUse: boolean\n reason: \"nested-checks\" | \"chained-flatmaps\" | \"mixed-monads\" | \"async-chains\" | null\n} {\n // Already using Do notation\n if (isInsideDoNotation(node, functypeImports)) {\n return { shouldUse: false, reason: null }\n }\n\n // Check for nested null checks (a && a.b && a.b.c pattern)\n if (node.type === \"LogicalExpression\" && node.operator === \"&&\") {\n const text = node.toString ? node.toString() : \"\"\n if (text.includes(\"&&\") && text.match(/\\w+(\\.\\w+){2,}/)) {\n return { shouldUse: true, reason: \"nested-checks\" }\n }\n }\n\n // Check for chained flatMap calls\n if (isChainedMethodCall(node, \"flatMap\")) {\n // Count chain depth\n let depth = 0\n let current = node\n\n while (current && current.type === \"CallExpression\" && isChainedMethodCall(current, \"flatMap\")) {\n depth++\n if (current.callee.type === \"MemberExpression\") {\n current = current.callee.object as ASTNode\n } else {\n break\n }\n }\n\n if (depth >= 3) {\n return { shouldUse: true, reason: \"chained-flatmaps\" }\n }\n }\n\n return { shouldUse: false, reason: null }\n}\n"],"mappings":"AAWA,SAAgB,EAAkB,EAAoC,CAEpE,IAAM,EADa,EAAQ,WACA,IAG3B,IAAK,IAAM,KAAQ,EAAQ,KACzB,GAAI,EAAK,OAAS,qBAAuB,EAAK,OAAO,OAAS,WAAa,EAAK,OAAO,QAAU,WAC/F,MAAO,GAIX,MAAO,GAeT,SAAgB,EAAmB,EAA4C,CAC7E,IAAM,EAAQ,IAAI,IACZ,EAAY,IAAI,IAChB,EAAM,IAAI,IAGV,EADa,EAAQ,WACA,IAE3B,IAAK,IAAM,KAAQ,EAAQ,KACzB,GAAI,EAAK,OAAS,qBAAuB,EAAK,OAAO,OAAS,WAAa,EAAK,OAAO,QAAU,YAE3F,EAAK,eACF,IAAM,KAAQ,EAAK,WACtB,GAAI,EAAK,OAAS,mBAAqB,EAAK,SAAS,OAAS,aAAc,CAC1E,IAAM,EAAO,EAAK,SAAS,KAC3B,EAAI,IAAI,EAAK,CAGT,CAAC,SAAU,SAAU,OAAQ,WAAY,OAAQ,MAAM,CAAC,SAAS,EAAK,CACxE,EAAM,IAAI,EAAK,EACN,CAAC,KAAM,UAAW,IAAI,CAAC,SAAS,EAAK,CAC9C,EAAU,IAAI,EAAK,OAKZ,EAAK,OAAS,0BACvB,EAAI,IAAI,UAAU,CAClB,EAAU,IAAI,UAAU,EACf,EAAK,OAAS,6BACvB,EAAI,IAAI,IAAI,CACZ,EAAM,IAAI,IAAI,CACd,EAAU,IAAI,IAAI,EAO5B,MAAO,CAAE,QAAO,YAAW,MAAK,CAMlC,SAAgB,EAAyB,EAAwC,CAC/E,OAAO,EAAmB,EAAQ,CA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,EAAU,EAEd,KAAO,GAAW,EAAQ,OAAS,kBAAoB,EAAoB,EAAS,UAAU,GAC5F,IACI,EAAQ,OAAO,OAAS,qBAC1B,EAAU,EAAQ,OAAO,OAM7B,GAAI,GAAS,EACX,MAAO,CAAE,UAAW,GAAM,OAAQ,mBAAoB,CAI1D,MAAO,CAAE,UAAW,GAAO,OAAQ,KAAM"}
package/package.json CHANGED
@@ -1,11 +1,21 @@
1
1
  {
2
2
  "name": "eslint-plugin-functype",
3
- "version": "1.2.0",
4
- "description": "Custom ESLint rules for functional TypeScript programming with functype library patterns (ESLint 9.x+)",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
3
+ "version": "2.0.0",
4
+ "description": "Custom ESLint rules for functional TypeScript programming with functype library patterns including Do notation (ESLint 10+)",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
7
16
  "files": [
8
- "dist/",
17
+ "lib",
18
+ "dist",
9
19
  "README.md",
10
20
  "LICENSE"
11
21
  ],
@@ -24,29 +34,16 @@
24
34
  "either",
25
35
  "list"
26
36
  ],
37
+ "prettier": "ts-builds/prettier",
27
38
  "peerDependencies": {
28
- "eslint": "^9.32.0"
29
- },
30
- "dependencies": {
31
- "@eslint/eslintrc": "^3.3.1",
32
- "@eslint/js": "^9.32.0"
39
+ "eslint": "^10.0.1"
33
40
  },
34
41
  "devDependencies": {
35
- "@types/node": "^22.17.0",
36
- "@typescript-eslint/eslint-plugin": "^8.39.0",
37
- "@typescript-eslint/parser": "^8.39.0",
38
- "@typescript-eslint/rule-tester": "^8.39.0",
39
- "@vitest/coverage-v8": "^3.2.4",
40
- "@vitest/ui": "^3.2.4",
41
- "eslint": "^9.32.0",
42
- "eslint-plugin-functional": "^9.0.2",
43
- "eslint-plugin-prettier": "^5.5.4",
44
- "eslint-plugin-simple-import-sort": "^12.1.1",
45
- "functype": "^0.9.4",
46
- "prettier": "^3.6.2",
47
- "tsup": "^8.5.0",
48
- "typescript": "^5.9.2",
49
- "vitest": "^3.2.4"
42
+ "@typescript-eslint/rule-tester": "^8.56.1",
43
+ "eslint-config-prettier": "^10.1.5",
44
+ "functype": "^0.47.0",
45
+ "ts-builds": "^2.4.0",
46
+ "tsdown": "^0.20.0"
50
47
  },
51
48
  "author": {
52
49
  "name": "Jordan Burke",
@@ -61,16 +58,22 @@
61
58
  "url": "https://github.com/jordanburke/eslint-plugin-functype/issues"
62
59
  },
63
60
  "homepage": "https://github.com/jordanburke/eslint-plugin-functype#readme",
61
+ "engines": {
62
+ "node": ">=22.0.0"
63
+ },
64
64
  "scripts": {
65
- "build": "pnpm run typecheck && tsup",
66
- "build:watch": "tsup --watch",
67
- "lint": "eslint src --ext .ts",
68
- "typecheck": "tsc --noEmit",
69
- "test": "vitest run",
70
- "test:watch": "vitest --watch",
71
- "test:ui": "vitest --ui",
72
- "test:coverage": "vitest --coverage",
73
- "check": "pnpm run typecheck && pnpm run lint && pnpm run test --run",
65
+ "validate": "ts-builds validate",
66
+ "format": "ts-builds format",
67
+ "format:check": "ts-builds format:check",
68
+ "lint": "ts-builds lint",
69
+ "lint:check": "ts-builds lint:check",
70
+ "typecheck": "ts-builds typecheck",
71
+ "test": "ts-builds test",
72
+ "test:watch": "ts-builds test:watch",
73
+ "test:ui": "ts-builds test:ui",
74
+ "test:coverage": "ts-builds test:coverage",
75
+ "build": "ts-builds build",
76
+ "dev": "ts-builds dev",
74
77
  "list-rules": "node dist/cli/list-rules.js",
75
78
  "list-rules:verbose": "node dist/cli/list-rules.js --verbose",
76
79
  "list-rules:usage": "node dist/cli/list-rules.js --usage",