eslint-config-functype 2.202.2 → 2.203.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/README.md CHANGED
@@ -18,6 +18,15 @@ import testOverrides from "eslint-config-functype/test-overrides"
18
18
  export default [recommended, testOverrides]
19
19
  ```
20
20
 
21
+ That is the whole config. `recommended` lints `**/*.{ts,tsx,mts,cts}`, and registers everything its rules need:
22
+
23
+ - `@typescript-eslint/parser`, with `parserOptions: { projectService: true }`, so the type-aware rules such as `no-floating-promises` get type information from each file's nearest `tsconfig.json`;
24
+ - the `@typescript-eslint`, `prettier` and `simple-import-sort` plugins.
25
+
26
+ Install all five peers. A missing `@typescript-eslint` package stops the config from loading, with the command that installs it. A missing `prettier`, `eslint-plugin-prettier` or `eslint-plugin-simple-import-sort` prints a warning, and the preset's rules from that plugin then fail to load.
27
+
28
+ `projectService` lints a TypeScript file only if a `tsconfig.json` includes it. So `eslint .` stops at a root `vitest.config.ts` or `tsdown.config.ts` that no tsconfig includes: "was not found by the project service". Lint the source directories (`eslint src`), add those files to `ignores`, or list them in `parserOptions.projectService.allowDefaultProject`.
29
+
21
30
  ### Strict mode
22
31
 
23
32
  ```js
@@ -27,6 +36,25 @@ import testOverrides from "eslint-config-functype/test-overrides"
27
36
  export default [strict, testOverrides]
28
37
  ```
29
38
 
39
+ ### A config that already registers the plugins
40
+
41
+ If your config already registers these plugins, for example through `typescript-eslint`'s configs, or sets `parserOptions.project`, use the preset's rules in your own block, as `ts-builds` does:
42
+
43
+ ```js
44
+ import functypeConfig from "eslint-config-functype"
45
+
46
+ export default [
47
+ // ...your parser and plugin setup
48
+ { files: ["**/*.ts"], rules: functypeConfig.configs.recommended.rules },
49
+ functypeConfig.configs.testOverrides,
50
+ ]
51
+ ```
52
+
53
+ Two things fail when the whole preset sits beside such a config:
54
+
55
+ - **Two copies of a plugin.** ESLint accepts a plugin registered twice only when both are the same object. With one copy of each plugin installed, they are. When your direct `@typescript-eslint/eslint-plugin` is a different version from the one `typescript-eslint` depends on, npm installs two, and ESLint stops with `Cannot redefine plugin "@typescript-eslint"`. Align the versions, or use the rules as above.
56
+ - **`project` beside `projectService`.** typescript-eslint rejects a file whose `parserOptions` set both: `Enabling "project" does nothing when "projectService" is enabled`. Drop `project`, or use the rules as above.
57
+
30
58
  ## Configs
31
59
 
32
60
  ### `recommended`
@@ -0,0 +1,7 @@
1
+ import { ESLint } from "eslint";
2
+ /**
3
+ * ESLint's plugin type. An interface, not an alias: the presets' .d.ts can name an interface, while
4
+ * an alias is expanded to a type in @eslint/core, which a consumer may not be able to resolve.
5
+ */
6
+ interface Plugin extends ESLint.Plugin {}
7
+ export { Plugin as t };
@@ -50,7 +50,7 @@ function validatePeerDependencies() {
50
50
  for (const dep of PEER_DEPENDENCIES) if (tryResolve(dep.packageName)) available.push(dep);
51
51
  else {
52
52
  missing.push(dep);
53
- if (dep.required) {} else warnings.push(`Optional plugin '${dep.name}' not found. Some rules will be skipped.`);
53
+ if (dep.required) {} else warnings.push(`Optional peer '${dep.name}' not found. A config that uses the whole preset fails on its rules; install it, or use the preset's rules without them.`);
54
54
  }
55
55
  const isValid = missing.filter((dep) => dep.required).length === 0;
56
56
  const missingPackageNames = missing.map((dep) => dep.packageName);
@@ -1 +1 @@
1
- {"version":3,"file":"list-rules.js","names":[],"sources":["../../src/utils/dependency-validator.ts","../../src/cli/list-rules.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-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 tryResolve(packageName: string): boolean {\n try {\n import.meta.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 (tryResolve(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-config-functype:\",\n \"\",\n missingList,\n \"\",\n \"📦 Install missing dependencies:\",\n ` ${result.installCommand}`,\n \"\",\n \"📖 See installation guide: https://github.com/jordanburke/eslint-config-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","import fs from \"node:fs\"\nimport path from \"node:path\"\nimport { fileURLToPath, pathToFileURL } from \"node:url\"\n\nimport { validatePeerDependencies, type ValidationResult } from \"../utils/dependency-validator\"\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url))\n\n// Types for better type safety\ntype RuleSeverity = \"off\" | \"warn\" | \"error\" | 0 | 1 | 2\ntype RuleConfig = RuleSeverity | [RuleSeverity, ...unknown[]]\n\ninterface RuleData {\n severity: RuleSeverity\n options: unknown[]\n source: string\n}\n\ninterface Config {\n rules?: Record<string, RuleConfig>\n extends?: string[]\n plugins?: string[]\n}\n\ninterface LoadedConfig {\n name: string\n rules: Map<string, RuleData>\n}\n\ninterface RuleDiff {\n name: string\n status: \"added\" | \"removed\" | \"different\" | \"same\"\n localSeverity?: RuleSeverity\n functypeSeverity?: RuleSeverity\n localOptions?: unknown[]\n functypeOptions?: unknown[]\n}\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\nasync function loadConfig(configPath: string): Promise<Config | null> {\n try {\n const resolvedPath = path.resolve(configPath)\n const configModule = await import(pathToFileURL(resolvedPath).href)\n return configModule.default || configModule\n } catch (error) {\n console.error(colorize(`Error loading config from ${configPath}:`, \"red\"), (error as Error).message)\n return null\n }\n}\n\nfunction extractRules(config: Config): Map<string, RuleData> {\n const rules = new Map<string, RuleData>()\n\n if (config.rules) {\n Object.entries(config.rules).forEach(([ruleName, ruleConfig]) => {\n const severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig\n const options = Array.isArray(ruleConfig) ? ruleConfig.slice(1) : []\n\n rules.set(ruleName, {\n severity,\n options,\n source: getRuleSource(ruleName),\n })\n })\n }\n\n return rules\n}\n\nfunction getRuleSource(ruleName: string): string {\n if (ruleName.startsWith(\"@typescript-eslint/\")) return \"@typescript-eslint/eslint-plugin\"\n return \"eslint (core)\"\n}\n\nfunction getSeverityColor(severity: RuleSeverity): keyof typeof colors {\n switch (severity) {\n case \"error\":\n case 2:\n return \"red\"\n case \"warn\":\n case 1:\n return \"yellow\"\n case \"off\":\n case 0:\n return \"cyan\"\n default:\n return \"reset\"\n }\n}\n\nfunction formatSeverity(severity: RuleSeverity): string {\n const severityMap: Record<string, string> = {\n \"0\": \"off\",\n \"1\": \"warn\",\n \"2\": \"error\",\n off: \"off\",\n warn: \"warn\",\n error: \"error\",\n }\n return severityMap[String(severity)] || String(severity)\n}\n\nfunction printRules(configName: string, rules: Map<string, RuleData>): void {\n console.log(colorize(`\\n📋 ${configName} Configuration Rules:`, \"bright\"))\n console.log(colorize(\"=\".repeat(50), \"blue\"))\n\n // Group rules by source\n const rulesBySource = new Map<string, Map<string, RuleData>>()\n rules.forEach((ruleData, ruleName) => {\n const source = ruleData.source\n if (!rulesBySource.has(source)) {\n rulesBySource.set(source, new Map())\n }\n rulesBySource.get(source)!.set(ruleName, ruleData)\n })\n\n // Print rules grouped by source\n rulesBySource.forEach((sourceRules, source) => {\n console.log(colorize(`\\n📦 ${source}:`, \"magenta\"))\n\n sourceRules.forEach((ruleData, ruleName) => {\n const shortName = ruleName.replace(/^.*\\//, \"\")\n const severity = formatSeverity(ruleData.severity)\n const severityColored = colorize(`[${severity.toUpperCase()}]`, getSeverityColor(ruleData.severity))\n const hasOptions = ruleData.options && ruleData.options.length > 0\n const optionsText = hasOptions ? colorize(\" (with options)\", \"cyan\") : \"\"\n\n console.log(` ${severityColored} ${colorize(shortName, \"green\")}${optionsText}`)\n\n if (hasOptions && process.argv.includes(\"--verbose\")) {\n console.log(` ${colorize(\"Options:\", \"cyan\")} ${JSON.stringify(ruleData.options)}`)\n }\n })\n })\n}\n\nfunction printSummary(configs: LoadedConfig[]): void {\n console.log(colorize(\"\\n📊 Summary:\", \"bright\"))\n console.log(colorize(\"=\".repeat(30), \"blue\"))\n\n configs.forEach(({ name, rules }) => {\n const totalRules = rules.size\n const errorRules = Array.from(rules.values()).filter((r) => r.severity === \"error\" || r.severity === 2).length\n const warnRules = Array.from(rules.values()).filter((r) => r.severity === \"warn\" || r.severity === 1).length\n const offRules = Array.from(rules.values()).filter((r) => r.severity === \"off\" || r.severity === 0).length\n\n console.log(`\\n${colorize(name, \"bright\")}: ${totalRules} total rules`)\n console.log(` ${colorize(\"●\", \"red\")} ${errorRules} errors`)\n console.log(` ${colorize(\"●\", \"yellow\")} ${warnRules} warnings`)\n console.log(` ${colorize(\"●\", \"cyan\")} ${offRules} disabled`)\n })\n}\n\nfunction printUsageInfo(): void {\n console.log(colorize(\"\\n💡 Usage Information:\", \"bright\"))\n console.log(colorize(\"=\".repeat(30), \"blue\"))\n console.log(\"\\n📖 How to use these configurations:\")\n console.log(\"\\n\" + colorize(\"ESLint 8 (.eslintrc):\", \"green\"))\n console.log(' extends: [\"plugin:functype/recommended\"]')\n console.log(\"\\n\" + colorize(\"ESLint 9+ (flat config):\", \"green\"))\n console.log(\" Copy the rules from our documentation into your eslint.config.js\")\n console.log(\"\\n\" + colorize(\"Individual rules:\", \"green\"))\n console.log(\" You can enable any rule individually in your rules section\")\n}\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 loadLocalESLintConfig(configPath: string): Promise<Config | null> {\n try {\n // Try common ESLint config file names if no path provided\n const possibleConfigs = [\n \"eslint.config.js\",\n \"eslint.config.mjs\",\n \"eslint.config.ts\",\n \".eslintrc.js\",\n \".eslintrc.json\",\n ]\n\n let actualPath = configPath\n if (!configPath) {\n // Search for config file in current directory\n for (const filename of possibleConfigs) {\n if (fs.existsSync(filename)) {\n actualPath = filename\n break\n }\n }\n if (!actualPath) {\n console.log(colorize(\"❌ No ESLint config file found. Searched for:\", \"red\"))\n possibleConfigs.forEach((f) => console.log(` • ${f}`))\n return null\n }\n }\n\n console.log(colorize(`📖 Loading local config: ${actualPath}`, \"cyan\"))\n\n // Handle flat config (eslint.config.js)\n if (actualPath.includes(\"eslint.config\")) {\n const configModule = await import(path.resolve(actualPath))\n const config = configModule.default || configModule\n\n // Flat config is array of config objects, merge rules\n if (Array.isArray(config)) {\n const mergedRules: Record<string, RuleConfig> = {}\n config.forEach((cfg: unknown) => {\n if (cfg && typeof cfg === \"object\" && \"rules\" in cfg) {\n const configObj = cfg as Config\n if (configObj.rules) {\n Object.assign(mergedRules, configObj.rules)\n }\n }\n })\n return { rules: mergedRules }\n }\n return config\n }\n\n // Handle legacy config (.eslintrc.*)\n return await loadConfig(actualPath)\n } catch (error) {\n console.error(colorize(`Error loading local config:`, \"red\"), (error as Error).message)\n return null\n }\n}\n\nfunction compareRules(localRules: Map<string, RuleData>, functypeRules: Map<string, RuleData>): RuleDiff[] {\n const allRules = new Set([...localRules.keys(), ...functypeRules.keys()])\n const diffs: RuleDiff[] = []\n\n allRules.forEach((ruleName) => {\n const localRule = localRules.get(ruleName)\n const functypeRule = functypeRules.get(ruleName)\n\n if (!localRule && functypeRule) {\n // Rule added by functype\n diffs.push({\n name: ruleName,\n status: \"added\",\n functypeSeverity: functypeRule.severity,\n functypeOptions: functypeRule.options,\n })\n } else if (localRule && !functypeRule) {\n // Rule exists locally but not in functype\n diffs.push({\n name: ruleName,\n status: \"removed\",\n localSeverity: localRule.severity,\n localOptions: localRule.options,\n })\n } else if (localRule && functypeRule) {\n // Compare configurations\n const severityDifferent = localRule.severity !== functypeRule.severity\n const optionsDifferent = JSON.stringify(localRule.options) !== JSON.stringify(functypeRule.options)\n\n if (severityDifferent || optionsDifferent) {\n diffs.push({\n name: ruleName,\n status: \"different\",\n localSeverity: localRule.severity,\n functypeSeverity: functypeRule.severity,\n localOptions: localRule.options,\n functypeOptions: functypeRule.options,\n })\n } else {\n diffs.push({\n name: ruleName,\n status: \"same\",\n localSeverity: localRule.severity,\n functypeSeverity: functypeRule.severity,\n })\n }\n }\n })\n\n return diffs.sort((a, b) => a.name.localeCompare(b.name))\n}\n\nfunction printDiff(diffs: RuleDiff[], functypeConfigName: string): void {\n console.log(colorize(`\\n🔄 Config Comparison vs ${functypeConfigName}:`, \"bright\"))\n console.log(colorize(\"=\".repeat(60), \"blue\"))\n\n const categories = {\n removed: diffs.filter((d) => d.status === \"removed\"),\n added: diffs.filter((d) => d.status === \"added\"),\n different: diffs.filter((d) => d.status === \"different\"),\n same: diffs.filter((d) => d.status === \"same\"),\n }\n\n // Rules you can remove (covered by functype)\n if (categories.same.length > 0) {\n console.log(colorize(\"\\n✅ Rules you can remove (covered by functype):\", \"green\"))\n categories.same.forEach((diff) => {\n const severity = formatSeverity(diff.functypeSeverity!)\n console.log(` • ${diff.name} (${severity})`)\n })\n }\n\n // New rules functype adds\n if (categories.added.length > 0) {\n console.log(colorize(\"\\n➕ New rules functype adds:\", \"blue\"))\n categories.added.forEach((diff) => {\n const severity = formatSeverity(diff.functypeSeverity!)\n const severityColored = colorize(`[${severity.toUpperCase()}]`, getSeverityColor(diff.functypeSeverity!))\n console.log(` • ${diff.name} ${severityColored}`)\n })\n }\n\n // Rules with conflicts\n if (categories.different.length > 0) {\n console.log(colorize(\"\\n🔀 Conflicting rules (will override functype):\", \"yellow\"))\n categories.different.forEach((diff) => {\n const localSeverity = formatSeverity(diff.localSeverity!)\n const functypeSeverity = formatSeverity(diff.functypeSeverity!)\n console.log(` • ${diff.name}`)\n console.log(` Local: ${localSeverity}`)\n console.log(` functype: ${functypeSeverity}`)\n })\n }\n\n // Rules you have that functype doesn't\n if (categories.removed.length > 0) {\n console.log(colorize(\"\\n➖ Your additional rules (not in functype):\", \"magenta\"))\n categories.removed.forEach((diff) => {\n const severity = formatSeverity(diff.localSeverity!)\n console.log(` • ${diff.name} (${severity})`)\n })\n }\n\n // Summary stats\n console.log(colorize(\"\\n📊 Migration Summary:\", \"bright\"))\n console.log(` ${categories.same.length} rules can be removed`)\n console.log(` ${categories.added.length} new rules will be added`)\n console.log(` ${categories.different.length} rules have conflicts`)\n console.log(` ${categories.removed.length} additional rules you keep`)\n\n // Migration suggestions\n if (categories.same.length > 0 || categories.different.length > 0) {\n console.log(colorize(\"\\n💡 Suggested migration steps:\", \"bright\"))\n if (categories.same.length > 0) {\n console.log(\"1. Remove duplicate rules from your config (they match functype)\")\n }\n if (categories.different.length > 0) {\n console.log(\"2. Review conflicting rules - decide if you want local overrides\")\n }\n console.log('3. Add functype config: extends: [\"plugin:functype/recommended\"]')\n }\n}\n\nasync function runDiffMode(configPath: string): Promise<void> {\n console.log(colorize(\"🔄 ESLint Config Diff Mode\", \"bright\"))\n\n // Load local config\n const localConfig = await loadLocalESLintConfig(configPath)\n if (!localConfig) {\n console.error(colorize(\"❌ Could not load local ESLint config\", \"red\"))\n process.exit(1)\n }\n\n const localRules = extractRules(localConfig)\n console.log(colorize(`Found ${localRules.size} rules in local config`, \"cyan\"))\n\n // Load functype configs\n const distPath = path.join(__dirname, \"..\", \"..\", \"dist\")\n const configs = [\n { name: \"Recommended\", path: path.join(distPath, \"configs\", \"recommended.js\") },\n { name: \"Strict\", path: path.join(distPath, \"configs\", \"strict.js\") },\n ]\n\n for (const { name, path: configPath } of configs) {\n const functypeConfig = await loadConfig(configPath)\n if (functypeConfig) {\n const functypeRules = extractRules(functypeConfig)\n const diffs = compareRules(localRules, functypeRules)\n printDiff(diffs, name)\n }\n }\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 const diffMode = args.includes(\"--diff\")\n const diffConfigIndex = args.findIndex((arg) => arg === \"--diff\")\n const diffConfigPath = diffConfigIndex !== -1 && args[diffConfigIndex + 1] ? args[diffConfigIndex + 1] : \"\"\n\n if (showHelp) {\n console.log(colorize(\"📋 eslint-plugin-functype: Rule Lister\", \"bright\"))\n console.log(\"\\nUsage: pnpm run list-rules [options]\")\n console.log(\"\\nOptions:\")\n console.log(\" --verbose, -v Show rule options\")\n console.log(\" --usage, -u Show usage examples\")\n console.log(\" --check-deps Check peer dependency status\")\n console.log(\" --diff [config] Compare local ESLint config with functype\")\n console.log(\" --help, -h Show this help message\")\n console.log(\"\\nThis command lists all rules configured in the functype plugin configurations.\")\n console.log(\"\\nDiff mode:\")\n console.log(\" --diff Auto-detect local ESLint config file\")\n console.log(\" --diff <path> Compare specific config file with functype\")\n return\n }\n\n // Handle diff mode\n if (diffMode) {\n await runDiffMode(diffConfigPath)\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: Supported 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 const configs = [\n {\n name: \"Recommended\",\n path: path.join(distPath, \"configs\", \"recommended.js\"),\n },\n {\n name: \"Strict\",\n path: path.join(distPath, \"configs\", \"strict.js\"),\n },\n ]\n\n const loadedConfigs: LoadedConfig[] = []\n\n for (const { name, path: configPath } of configs) {\n const config = await loadConfig(configPath)\n if (config) {\n const rules = extractRules(config)\n loadedConfigs.push({ name, rules })\n printRules(name, rules)\n }\n }\n\n if (loadedConfigs.length > 0) {\n printSummary(loadedConfigs)\n\n if (showUsage) {\n printUsageInfo()\n }\n\n console.log(colorize(\"\\n💡 Tips:\", \"bright\"))\n console.log(\"• Use --verbose to see rule options\")\n console.log(\"• Use --usage to see configuration examples\")\n console.log(\"• Red rules will cause build failures\")\n console.log(\"• Yellow rules are warnings only\")\n console.log(\"• Blue rules are disabled by default\")\n\n console.log(colorize(\"\\n🔗 Links:\", \"bright\"))\n console.log(\"• Documentation: https://github.com/jordanburke/eslint-config-functype\")\n console.log(\"• @typescript-eslint: https://typescript-eslint.io/\")\n }\n}\n\n// Run the CLI\nmain().catch((error) => {\n console.error(colorize(\"❌ Unexpected error:\", \"red\"), error)\n process.exit(1)\n})\n"],"mappings":";;;;;AASA,MAAM,oBAAsC;CAC1C;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;CACA;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;CACA;EACE,MAAM;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5E,MAAM,WAAW,KAAK,KAAK,WAAW,MAAM,MAAM,MAAM;CAExD,IAAI,CAAC,GAAG,WAAW,QAAQ,GAAG;EAC5B,QAAQ,MAAM,SAAS,4DAA4D,KAAK,CAAC;EACzF,QAAQ,KAAK,CAAC;CAChB;CAEA,MAAM,UAAU,CACd;EACE,MAAM;EACN,MAAM,KAAK,KAAK,UAAU,WAAW,gBAAgB;CACvD,GACA;EACE,MAAM;EACN,MAAM,KAAK,KAAK,UAAU,WAAW,WAAW;CAClD,CACF;CAEA,MAAM,gBAAgC,CAAC;CAEvC,KAAK,MAAM,EAAE,MAAM,MAAM,gBAAgB,SAAS;EAChD,MAAM,SAAS,MAAM,WAAW,UAAU;EAC1C,IAAI,QAAQ;GACV,MAAM,QAAQ,aAAa,MAAM;GACjC,cAAc,KAAK;IAAE;IAAM;GAAM,CAAC;GAClC,WAAW,MAAM,KAAK;EACxB;CACF;CAEA,IAAI,cAAc,SAAS,GAAG;EAC5B,aAAa,aAAa;EAE1B,IAAI,WACF,eAAe;EAGjB,QAAQ,IAAI,SAAS,cAAc,QAAQ,CAAC;EAC5C,QAAQ,IAAI,qCAAqC;EACjD,QAAQ,IAAI,6CAA6C;EACzD,QAAQ,IAAI,uCAAuC;EACnD,QAAQ,IAAI,kCAAkC;EAC9C,QAAQ,IAAI,sCAAsC;EAElD,QAAQ,IAAI,SAAS,eAAe,QAAQ,CAAC;EAC7C,QAAQ,IAAI,wEAAwE;EACpF,QAAQ,IAAI,qDAAqD;CACnE;AACF;AAGA,KAAK,CAAC,CAAC,OAAO,UAAU;CACtB,QAAQ,MAAM,SAAS,uBAAuB,KAAK,GAAG,KAAK;CAC3D,QAAQ,KAAK,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"list-rules.js","names":[],"sources":["../../src/utils/dependency-validator.ts","../../src/cli/list-rules.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-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 tryResolve(packageName: string): boolean {\n try {\n import.meta.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 (tryResolve(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(\n `Optional peer '${dep.name}' not found. A config that uses the whole preset fails on its rules; install it, or use the preset's rules without them.`,\n )\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-config-functype:\",\n \"\",\n missingList,\n \"\",\n \"📦 Install missing dependencies:\",\n ` ${result.installCommand}`,\n \"\",\n \"📖 See installation guide: https://github.com/jordanburke/eslint-config-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","import fs from \"node:fs\"\nimport path from \"node:path\"\nimport { fileURLToPath, pathToFileURL } from \"node:url\"\n\nimport { validatePeerDependencies, type ValidationResult } from \"../utils/dependency-validator\"\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url))\n\n// Types for better type safety\ntype RuleSeverity = \"off\" | \"warn\" | \"error\" | 0 | 1 | 2\ntype RuleConfig = RuleSeverity | [RuleSeverity, ...unknown[]]\n\ninterface RuleData {\n severity: RuleSeverity\n options: unknown[]\n source: string\n}\n\ninterface Config {\n rules?: Record<string, RuleConfig>\n extends?: string[]\n plugins?: string[]\n}\n\ninterface LoadedConfig {\n name: string\n rules: Map<string, RuleData>\n}\n\ninterface RuleDiff {\n name: string\n status: \"added\" | \"removed\" | \"different\" | \"same\"\n localSeverity?: RuleSeverity\n functypeSeverity?: RuleSeverity\n localOptions?: unknown[]\n functypeOptions?: unknown[]\n}\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\nasync function loadConfig(configPath: string): Promise<Config | null> {\n try {\n const resolvedPath = path.resolve(configPath)\n const configModule = await import(pathToFileURL(resolvedPath).href)\n return configModule.default || configModule\n } catch (error) {\n console.error(colorize(`Error loading config from ${configPath}:`, \"red\"), (error as Error).message)\n return null\n }\n}\n\nfunction extractRules(config: Config): Map<string, RuleData> {\n const rules = new Map<string, RuleData>()\n\n if (config.rules) {\n Object.entries(config.rules).forEach(([ruleName, ruleConfig]) => {\n const severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig\n const options = Array.isArray(ruleConfig) ? ruleConfig.slice(1) : []\n\n rules.set(ruleName, {\n severity,\n options,\n source: getRuleSource(ruleName),\n })\n })\n }\n\n return rules\n}\n\nfunction getRuleSource(ruleName: string): string {\n if (ruleName.startsWith(\"@typescript-eslint/\")) return \"@typescript-eslint/eslint-plugin\"\n return \"eslint (core)\"\n}\n\nfunction getSeverityColor(severity: RuleSeverity): keyof typeof colors {\n switch (severity) {\n case \"error\":\n case 2:\n return \"red\"\n case \"warn\":\n case 1:\n return \"yellow\"\n case \"off\":\n case 0:\n return \"cyan\"\n default:\n return \"reset\"\n }\n}\n\nfunction formatSeverity(severity: RuleSeverity): string {\n const severityMap: Record<string, string> = {\n \"0\": \"off\",\n \"1\": \"warn\",\n \"2\": \"error\",\n off: \"off\",\n warn: \"warn\",\n error: \"error\",\n }\n return severityMap[String(severity)] || String(severity)\n}\n\nfunction printRules(configName: string, rules: Map<string, RuleData>): void {\n console.log(colorize(`\\n📋 ${configName} Configuration Rules:`, \"bright\"))\n console.log(colorize(\"=\".repeat(50), \"blue\"))\n\n // Group rules by source\n const rulesBySource = new Map<string, Map<string, RuleData>>()\n rules.forEach((ruleData, ruleName) => {\n const source = ruleData.source\n if (!rulesBySource.has(source)) {\n rulesBySource.set(source, new Map())\n }\n rulesBySource.get(source)!.set(ruleName, ruleData)\n })\n\n // Print rules grouped by source\n rulesBySource.forEach((sourceRules, source) => {\n console.log(colorize(`\\n📦 ${source}:`, \"magenta\"))\n\n sourceRules.forEach((ruleData, ruleName) => {\n const shortName = ruleName.replace(/^.*\\//, \"\")\n const severity = formatSeverity(ruleData.severity)\n const severityColored = colorize(`[${severity.toUpperCase()}]`, getSeverityColor(ruleData.severity))\n const hasOptions = ruleData.options && ruleData.options.length > 0\n const optionsText = hasOptions ? colorize(\" (with options)\", \"cyan\") : \"\"\n\n console.log(` ${severityColored} ${colorize(shortName, \"green\")}${optionsText}`)\n\n if (hasOptions && process.argv.includes(\"--verbose\")) {\n console.log(` ${colorize(\"Options:\", \"cyan\")} ${JSON.stringify(ruleData.options)}`)\n }\n })\n })\n}\n\nfunction printSummary(configs: LoadedConfig[]): void {\n console.log(colorize(\"\\n📊 Summary:\", \"bright\"))\n console.log(colorize(\"=\".repeat(30), \"blue\"))\n\n configs.forEach(({ name, rules }) => {\n const totalRules = rules.size\n const errorRules = Array.from(rules.values()).filter((r) => r.severity === \"error\" || r.severity === 2).length\n const warnRules = Array.from(rules.values()).filter((r) => r.severity === \"warn\" || r.severity === 1).length\n const offRules = Array.from(rules.values()).filter((r) => r.severity === \"off\" || r.severity === 0).length\n\n console.log(`\\n${colorize(name, \"bright\")}: ${totalRules} total rules`)\n console.log(` ${colorize(\"●\", \"red\")} ${errorRules} errors`)\n console.log(` ${colorize(\"●\", \"yellow\")} ${warnRules} warnings`)\n console.log(` ${colorize(\"●\", \"cyan\")} ${offRules} disabled`)\n })\n}\n\nfunction printUsageInfo(): void {\n console.log(colorize(\"\\n💡 Usage Information:\", \"bright\"))\n console.log(colorize(\"=\".repeat(30), \"blue\"))\n console.log(\"\\n📖 How to use these configurations:\")\n console.log(\"\\n\" + colorize(\"ESLint 8 (.eslintrc):\", \"green\"))\n console.log(' extends: [\"plugin:functype/recommended\"]')\n console.log(\"\\n\" + colorize(\"ESLint 9+ (flat config):\", \"green\"))\n console.log(\" Copy the rules from our documentation into your eslint.config.js\")\n console.log(\"\\n\" + colorize(\"Individual rules:\", \"green\"))\n console.log(\" You can enable any rule individually in your rules section\")\n}\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 loadLocalESLintConfig(configPath: string): Promise<Config | null> {\n try {\n // Try common ESLint config file names if no path provided\n const possibleConfigs = [\n \"eslint.config.js\",\n \"eslint.config.mjs\",\n \"eslint.config.ts\",\n \".eslintrc.js\",\n \".eslintrc.json\",\n ]\n\n let actualPath = configPath\n if (!configPath) {\n // Search for config file in current directory\n for (const filename of possibleConfigs) {\n if (fs.existsSync(filename)) {\n actualPath = filename\n break\n }\n }\n if (!actualPath) {\n console.log(colorize(\"❌ No ESLint config file found. Searched for:\", \"red\"))\n possibleConfigs.forEach((f) => console.log(` • ${f}`))\n return null\n }\n }\n\n console.log(colorize(`📖 Loading local config: ${actualPath}`, \"cyan\"))\n\n // Handle flat config (eslint.config.js)\n if (actualPath.includes(\"eslint.config\")) {\n const configModule = await import(path.resolve(actualPath))\n const config = configModule.default || configModule\n\n // Flat config is array of config objects, merge rules\n if (Array.isArray(config)) {\n const mergedRules: Record<string, RuleConfig> = {}\n config.forEach((cfg: unknown) => {\n if (cfg && typeof cfg === \"object\" && \"rules\" in cfg) {\n const configObj = cfg as Config\n if (configObj.rules) {\n Object.assign(mergedRules, configObj.rules)\n }\n }\n })\n return { rules: mergedRules }\n }\n return config\n }\n\n // Handle legacy config (.eslintrc.*)\n return await loadConfig(actualPath)\n } catch (error) {\n console.error(colorize(`Error loading local config:`, \"red\"), (error as Error).message)\n return null\n }\n}\n\nfunction compareRules(localRules: Map<string, RuleData>, functypeRules: Map<string, RuleData>): RuleDiff[] {\n const allRules = new Set([...localRules.keys(), ...functypeRules.keys()])\n const diffs: RuleDiff[] = []\n\n allRules.forEach((ruleName) => {\n const localRule = localRules.get(ruleName)\n const functypeRule = functypeRules.get(ruleName)\n\n if (!localRule && functypeRule) {\n // Rule added by functype\n diffs.push({\n name: ruleName,\n status: \"added\",\n functypeSeverity: functypeRule.severity,\n functypeOptions: functypeRule.options,\n })\n } else if (localRule && !functypeRule) {\n // Rule exists locally but not in functype\n diffs.push({\n name: ruleName,\n status: \"removed\",\n localSeverity: localRule.severity,\n localOptions: localRule.options,\n })\n } else if (localRule && functypeRule) {\n // Compare configurations\n const severityDifferent = localRule.severity !== functypeRule.severity\n const optionsDifferent = JSON.stringify(localRule.options) !== JSON.stringify(functypeRule.options)\n\n if (severityDifferent || optionsDifferent) {\n diffs.push({\n name: ruleName,\n status: \"different\",\n localSeverity: localRule.severity,\n functypeSeverity: functypeRule.severity,\n localOptions: localRule.options,\n functypeOptions: functypeRule.options,\n })\n } else {\n diffs.push({\n name: ruleName,\n status: \"same\",\n localSeverity: localRule.severity,\n functypeSeverity: functypeRule.severity,\n })\n }\n }\n })\n\n return diffs.sort((a, b) => a.name.localeCompare(b.name))\n}\n\nfunction printDiff(diffs: RuleDiff[], functypeConfigName: string): void {\n console.log(colorize(`\\n🔄 Config Comparison vs ${functypeConfigName}:`, \"bright\"))\n console.log(colorize(\"=\".repeat(60), \"blue\"))\n\n const categories = {\n removed: diffs.filter((d) => d.status === \"removed\"),\n added: diffs.filter((d) => d.status === \"added\"),\n different: diffs.filter((d) => d.status === \"different\"),\n same: diffs.filter((d) => d.status === \"same\"),\n }\n\n // Rules you can remove (covered by functype)\n if (categories.same.length > 0) {\n console.log(colorize(\"\\n✅ Rules you can remove (covered by functype):\", \"green\"))\n categories.same.forEach((diff) => {\n const severity = formatSeverity(diff.functypeSeverity!)\n console.log(` • ${diff.name} (${severity})`)\n })\n }\n\n // New rules functype adds\n if (categories.added.length > 0) {\n console.log(colorize(\"\\n➕ New rules functype adds:\", \"blue\"))\n categories.added.forEach((diff) => {\n const severity = formatSeverity(diff.functypeSeverity!)\n const severityColored = colorize(`[${severity.toUpperCase()}]`, getSeverityColor(diff.functypeSeverity!))\n console.log(` • ${diff.name} ${severityColored}`)\n })\n }\n\n // Rules with conflicts\n if (categories.different.length > 0) {\n console.log(colorize(\"\\n🔀 Conflicting rules (will override functype):\", \"yellow\"))\n categories.different.forEach((diff) => {\n const localSeverity = formatSeverity(diff.localSeverity!)\n const functypeSeverity = formatSeverity(diff.functypeSeverity!)\n console.log(` • ${diff.name}`)\n console.log(` Local: ${localSeverity}`)\n console.log(` functype: ${functypeSeverity}`)\n })\n }\n\n // Rules you have that functype doesn't\n if (categories.removed.length > 0) {\n console.log(colorize(\"\\n➖ Your additional rules (not in functype):\", \"magenta\"))\n categories.removed.forEach((diff) => {\n const severity = formatSeverity(diff.localSeverity!)\n console.log(` • ${diff.name} (${severity})`)\n })\n }\n\n // Summary stats\n console.log(colorize(\"\\n📊 Migration Summary:\", \"bright\"))\n console.log(` ${categories.same.length} rules can be removed`)\n console.log(` ${categories.added.length} new rules will be added`)\n console.log(` ${categories.different.length} rules have conflicts`)\n console.log(` ${categories.removed.length} additional rules you keep`)\n\n // Migration suggestions\n if (categories.same.length > 0 || categories.different.length > 0) {\n console.log(colorize(\"\\n💡 Suggested migration steps:\", \"bright\"))\n if (categories.same.length > 0) {\n console.log(\"1. Remove duplicate rules from your config (they match functype)\")\n }\n if (categories.different.length > 0) {\n console.log(\"2. Review conflicting rules - decide if you want local overrides\")\n }\n console.log('3. Add functype config: extends: [\"plugin:functype/recommended\"]')\n }\n}\n\nasync function runDiffMode(configPath: string): Promise<void> {\n console.log(colorize(\"🔄 ESLint Config Diff Mode\", \"bright\"))\n\n // Load local config\n const localConfig = await loadLocalESLintConfig(configPath)\n if (!localConfig) {\n console.error(colorize(\"❌ Could not load local ESLint config\", \"red\"))\n process.exit(1)\n }\n\n const localRules = extractRules(localConfig)\n console.log(colorize(`Found ${localRules.size} rules in local config`, \"cyan\"))\n\n // Load functype configs\n const distPath = path.join(__dirname, \"..\", \"..\", \"dist\")\n const configs = [\n { name: \"Recommended\", path: path.join(distPath, \"configs\", \"recommended.js\") },\n { name: \"Strict\", path: path.join(distPath, \"configs\", \"strict.js\") },\n ]\n\n for (const { name, path: configPath } of configs) {\n const functypeConfig = await loadConfig(configPath)\n if (functypeConfig) {\n const functypeRules = extractRules(functypeConfig)\n const diffs = compareRules(localRules, functypeRules)\n printDiff(diffs, name)\n }\n }\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 const diffMode = args.includes(\"--diff\")\n const diffConfigIndex = args.findIndex((arg) => arg === \"--diff\")\n const diffConfigPath = diffConfigIndex !== -1 && args[diffConfigIndex + 1] ? args[diffConfigIndex + 1] : \"\"\n\n if (showHelp) {\n console.log(colorize(\"📋 eslint-plugin-functype: Rule Lister\", \"bright\"))\n console.log(\"\\nUsage: pnpm run list-rules [options]\")\n console.log(\"\\nOptions:\")\n console.log(\" --verbose, -v Show rule options\")\n console.log(\" --usage, -u Show usage examples\")\n console.log(\" --check-deps Check peer dependency status\")\n console.log(\" --diff [config] Compare local ESLint config with functype\")\n console.log(\" --help, -h Show this help message\")\n console.log(\"\\nThis command lists all rules configured in the functype plugin configurations.\")\n console.log(\"\\nDiff mode:\")\n console.log(\" --diff Auto-detect local ESLint config file\")\n console.log(\" --diff <path> Compare specific config file with functype\")\n return\n }\n\n // Handle diff mode\n if (diffMode) {\n await runDiffMode(diffConfigPath)\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: Supported 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 const configs = [\n {\n name: \"Recommended\",\n path: path.join(distPath, \"configs\", \"recommended.js\"),\n },\n {\n name: \"Strict\",\n path: path.join(distPath, \"configs\", \"strict.js\"),\n },\n ]\n\n const loadedConfigs: LoadedConfig[] = []\n\n for (const { name, path: configPath } of configs) {\n const config = await loadConfig(configPath)\n if (config) {\n const rules = extractRules(config)\n loadedConfigs.push({ name, rules })\n printRules(name, rules)\n }\n }\n\n if (loadedConfigs.length > 0) {\n printSummary(loadedConfigs)\n\n if (showUsage) {\n printUsageInfo()\n }\n\n console.log(colorize(\"\\n💡 Tips:\", \"bright\"))\n console.log(\"• Use --verbose to see rule options\")\n console.log(\"• Use --usage to see configuration examples\")\n console.log(\"• Red rules will cause build failures\")\n console.log(\"• Yellow rules are warnings only\")\n console.log(\"• Blue rules are disabled by default\")\n\n console.log(colorize(\"\\n🔗 Links:\", \"bright\"))\n console.log(\"• Documentation: https://github.com/jordanburke/eslint-config-functype\")\n console.log(\"• @typescript-eslint: https://typescript-eslint.io/\")\n }\n}\n\n// Run the CLI\nmain().catch((error) => {\n console.error(colorize(\"❌ Unexpected error:\", \"red\"), error)\n process.exit(1)\n})\n"],"mappings":";;;;;AASA,MAAM,oBAAsC;CAC1C;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;CACA;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;CACA;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;CACA;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;CACA;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;AACF;AAUA,SAAS,WAAW,aAA8B;CAChD,IAAI;EACF,YAAY,QAAQ,WAAW;EAC/B,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,2BAA6C;CAC3D,MAAM,UAA4B,CAAC;CACnC,MAAM,YAA8B,CAAC;CACrC,MAAM,WAAqB,CAAC;CAE5B,KAAK,MAAM,OAAO,mBAChB,IAAI,WAAW,IAAI,WAAW,GAC5B,UAAU,KAAK,GAAG;MACb;EACL,QAAQ,KAAK,GAAG;EAChB,IAAI,IAAI,UAAU,CAElB,OAEE,SAAS,KACP,kBAAkB,IAAI,KAAK,yHAC7B;CAEJ;CAIF,MAAM,UADkB,QAAQ,QAAQ,QAAQ,IAAI,QACtB,CAAC,CAAC,WAAW;CAG3C,MAAM,sBAAsB,QAAQ,KAAK,QAAQ,IAAI,WAAW;CAGhE,OAAO;EACL;EACA;EACA;EACA,gBANqB,oBAAoB,SAAS,IAAI,eAAe,oBAAoB,KAAK,GAAG,MAAM;EAOvG;CACF;AACF;;ACxFA,MAAM,YAAY,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAiC7D,MAAM,SAAS;CACb,OAAO;CACP,QAAQ;CACR,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;CACN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ACF;AAGA,KAAK,CAAC,CAAC,OAAO,UAAU;CACtB,QAAQ,MAAM,SAAS,uBAAuB,KAAK,GAAG,KAAK;CAC3D,QAAQ,KAAK,CAAC;AAChB,CAAC"}
@@ -1,5 +1,9 @@
1
+ import { t as Plugin } from "../base-BCK4yx_I.js";
1
2
  declare const _default: {
2
3
  name: string;
4
+ files: string[];
5
+ languageOptions: import("eslint").Linter.LanguageOptions;
6
+ plugins: Record<string, Plugin>;
3
7
  rules: {
4
8
  "prefer-const": string;
5
9
  "no-var": string;
@@ -1,66 +1 @@
1
- import { createValidationError, shouldValidateDependencies, validatePeerDependencies } from "../utils/dependency-validator.js";
2
- // src/configs/recommended.ts
3
- if (shouldValidateDependencies()) {
4
- const result = validatePeerDependencies();
5
- if (!result.isValid) throw createValidationError(result);
6
- if (result.warnings.length > 0) {
7
- console.warn("\n⚠️ eslint-config-functype warnings:");
8
- result.warnings.forEach((warning) => console.warn(` ${warning}`));
9
- console.warn("");
10
- }
11
- }
12
- var recommended_default = {
13
- name: "functype/recommended",
14
- rules: {
15
- "prefer-const": "error",
16
- "no-var": "error",
17
- "no-throw-literal": "error",
18
- "object-shorthand": "error",
19
- "prefer-template": "error",
20
- "prefer-destructuring": ["error", {
21
- array: false,
22
- object: true
23
- }],
24
- "@typescript-eslint/consistent-type-imports": "error",
25
- "@typescript-eslint/no-explicit-any": "error",
26
- "@typescript-eslint/no-unused-vars": ["error", {
27
- argsIgnorePattern: "^_",
28
- varsIgnorePattern: "^(_|[A-Z]$)",
29
- caughtErrors: "all",
30
- caughtErrorsIgnorePattern: "^_",
31
- destructuredArrayIgnorePattern: "^_",
32
- ignoreRestSiblings: true,
33
- args: "after-used"
34
- }],
35
- "@typescript-eslint/no-unused-expressions": ["error", {
36
- allowShortCircuit: true,
37
- allowTernary: true
38
- }],
39
- "@typescript-eslint/no-floating-promises": "error",
40
- "@typescript-eslint/await-thenable": "error",
41
- "@typescript-eslint/no-misused-promises": "error",
42
- "@typescript-eslint/require-await": "error",
43
- "@typescript-eslint/prefer-nullish-coalescing": "error",
44
- "@typescript-eslint/prefer-optional-chain": "error",
45
- "@typescript-eslint/no-unnecessary-condition": "warn",
46
- "@typescript-eslint/strict-boolean-expressions": ["warn", {
47
- allowString: true,
48
- allowNumber: true,
49
- allowNullableObject: true,
50
- allowNullableBoolean: true,
51
- allowNullableString: true,
52
- allowNullableNumber: true,
53
- allowAny: true
54
- }],
55
- "prettier/prettier": [
56
- "error",
57
- {},
58
- { usePrettierrc: true }
59
- ],
60
- "simple-import-sort/imports": "error",
61
- "simple-import-sort/exports": "error"
62
- }
63
- };
64
- export { recommended_default as default };
65
-
66
- //# sourceMappingURL=recommended.js.map
1
+ export { t as default } from "../recommended-DybMAiTx.js";
@@ -1,3 +1,4 @@
1
+ import { t as Plugin } from "../base-BCK4yx_I.js";
1
2
  declare const _default: {
2
3
  name: string;
3
4
  rules: {
@@ -43,5 +44,8 @@ declare const _default: {
43
44
  "simple-import-sort/imports": string;
44
45
  "simple-import-sort/exports": string;
45
46
  };
47
+ files: string[];
48
+ languageOptions: import("eslint").Linter.LanguageOptions;
49
+ plugins: Record<string, Plugin>;
46
50
  };
47
51
  export { _default as default };
@@ -1,4 +1,4 @@
1
- import recommended_default from "./recommended.js";
1
+ import { t as recommended_default } from "../recommended-DybMAiTx.js";
2
2
  // src/configs/strict.ts
3
3
  var strict_default = {
4
4
  ...recommended_default,
@@ -1 +1 @@
1
- {"version":3,"file":"strict.js","names":["recommended"],"sources":["../../src/configs/strict.ts"],"sourcesContent":["import recommended from \"./recommended\"\n\n// ESLint 9.x Flat Config Format - Strict rules overlay\n// Note: Peer dependency validation is inherited from recommended config\nexport default {\n ...recommended,\n name: \"functype/strict\",\n rules: {\n ...recommended.rules,\n\n // Stricter TypeScript rules (non-type-aware)\n \"@typescript-eslint/explicit-function-return-type\": \"error\",\n \"@typescript-eslint/no-non-null-assertion\": \"error\",\n \"@typescript-eslint/strict-boolean-expressions\": \"error\", // Default strict\n },\n}\n"],"mappings":";;AAIA,IAAA,iBAAe;CACb,GAAGA;CACH,MAAM;CACN,OAAO;EACL,GAAGA,oBAAY;EAGf,oDAAoD;EACpD,4CAA4C;EAC5C,iDAAiD;CACnD;AACF"}
1
+ {"version":3,"file":"strict.js","names":["recommended"],"sources":["../../src/configs/strict.ts"],"sourcesContent":["import recommended from \"./recommended\"\n\n// ESLint flat config: recommended, with stricter rules. Its files, parser and plugins are recommended's.\nexport default {\n ...recommended,\n name: \"functype/strict\",\n rules: {\n ...recommended.rules,\n\n // Stricter TypeScript rules (non-type-aware)\n \"@typescript-eslint/explicit-function-return-type\": \"error\",\n \"@typescript-eslint/no-non-null-assertion\": \"error\",\n \"@typescript-eslint/strict-boolean-expressions\": \"error\", // Default strict\n },\n}\n"],"mappings":";;AAGA,IAAA,iBAAe;CACb,GAAGA;CACH,MAAM;CACN,OAAO;EACL,GAAGA,oBAAY;EAGf,oDAAoD;EACpD,4CAA4C;EAC5C,iDAAiD;CACnD;AACF"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,11 @@
1
+ import { t as Plugin } from "./base-BCK4yx_I.js";
1
2
  declare const plugin: {
2
3
  configs: {
3
4
  recommended: {
4
5
  name: string;
6
+ files: string[];
7
+ languageOptions: import("eslint").Linter.LanguageOptions;
8
+ plugins: Record<string, Plugin>;
5
9
  rules: {
6
10
  "prefer-const": string;
7
11
  "no-var": string;
@@ -97,6 +101,9 @@ declare const plugin: {
97
101
  "simple-import-sort/imports": string;
98
102
  "simple-import-sort/exports": string;
99
103
  };
104
+ files: string[];
105
+ languageOptions: import("eslint").Linter.LanguageOptions;
106
+ plugins: Record<string, Plugin>;
100
107
  };
101
108
  testOverrides: {
102
109
  name: string;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import recommended_default from "./configs/recommended.js";
1
+ import { t as recommended_default } from "./recommended-DybMAiTx.js";
2
2
  import strict_default from "./configs/strict.js";
3
3
  import test_overrides_default from "./configs/test-overrides.js";
4
4
  // src/index.ts
@@ -0,0 +1,104 @@
1
+ import { createRequire } from "node:module";
2
+ import { createValidationError, shouldValidateDependencies, validatePeerDependencies } from "./utils/dependency-validator.js";
3
+ // src/configs/base.ts
4
+ if (shouldValidateDependencies()) {
5
+ const result = validatePeerDependencies();
6
+ if (!result.isValid) throw createValidationError(result);
7
+ if (result.warnings.length > 0) {
8
+ console.warn("\n⚠️ eslint-config-functype warnings:");
9
+ result.warnings.forEach((warning) => console.warn(` ${warning}`));
10
+ console.warn("");
11
+ }
12
+ }
13
+ const require = createRequire(import.meta.url);
14
+ /**
15
+ * Load a peer as a consumer's `import x from "name"` would. The peers are CommonJS, so this is the
16
+ * same object, and ESLint accepts the same plugin registered twice. An ES module peer comes back as
17
+ * its namespace, so take its default export.
18
+ */
19
+ const load = (name) => {
20
+ const mod = require(name);
21
+ return mod[Symbol.toStringTag] === "Module" ? mod.default : mod;
22
+ };
23
+ /** The files the presets lint: TypeScript in every module flavour. */
24
+ const typescriptFiles = ["**/*.{ts,tsx,mts,cts}"];
25
+ const isInstalled = (name) => {
26
+ try {
27
+ require.resolve(name);
28
+ return true;
29
+ } catch {
30
+ return false;
31
+ }
32
+ };
33
+ /**
34
+ * Every plugin whose rules the presets set. The two @typescript-eslint packages are required. The
35
+ * prettier and import-sort plugins stay optional, as they were when the presets were rules only, so
36
+ * a config that takes the rules without theirs still loads; the check above warns when one is missing.
37
+ */
38
+ const plugins = {
39
+ "@typescript-eslint": load("@typescript-eslint/eslint-plugin"),
40
+ ...isInstalled("eslint-plugin-prettier") ? { prettier: load("eslint-plugin-prettier") } : {},
41
+ ...isInstalled("eslint-plugin-simple-import-sort") ? { "simple-import-sort": load("eslint-plugin-simple-import-sort") } : {}
42
+ };
43
+ // src/configs/recommended.ts
44
+ var recommended_default = {
45
+ name: "functype/recommended",
46
+ files: typescriptFiles,
47
+ languageOptions: {
48
+ parser: load("@typescript-eslint/parser"),
49
+ parserOptions: { projectService: true }
50
+ },
51
+ plugins,
52
+ rules: {
53
+ "prefer-const": "error",
54
+ "no-var": "error",
55
+ "no-throw-literal": "error",
56
+ "object-shorthand": "error",
57
+ "prefer-template": "error",
58
+ "prefer-destructuring": ["error", {
59
+ array: false,
60
+ object: true
61
+ }],
62
+ "@typescript-eslint/consistent-type-imports": "error",
63
+ "@typescript-eslint/no-explicit-any": "error",
64
+ "@typescript-eslint/no-unused-vars": ["error", {
65
+ argsIgnorePattern: "^_",
66
+ varsIgnorePattern: "^(_|[A-Z]$)",
67
+ caughtErrors: "all",
68
+ caughtErrorsIgnorePattern: "^_",
69
+ destructuredArrayIgnorePattern: "^_",
70
+ ignoreRestSiblings: true,
71
+ args: "after-used"
72
+ }],
73
+ "@typescript-eslint/no-unused-expressions": ["error", {
74
+ allowShortCircuit: true,
75
+ allowTernary: true
76
+ }],
77
+ "@typescript-eslint/no-floating-promises": "error",
78
+ "@typescript-eslint/await-thenable": "error",
79
+ "@typescript-eslint/no-misused-promises": "error",
80
+ "@typescript-eslint/require-await": "error",
81
+ "@typescript-eslint/prefer-nullish-coalescing": "error",
82
+ "@typescript-eslint/prefer-optional-chain": "error",
83
+ "@typescript-eslint/no-unnecessary-condition": "warn",
84
+ "@typescript-eslint/strict-boolean-expressions": ["warn", {
85
+ allowString: true,
86
+ allowNumber: true,
87
+ allowNullableObject: true,
88
+ allowNullableBoolean: true,
89
+ allowNullableString: true,
90
+ allowNullableNumber: true,
91
+ allowAny: true
92
+ }],
93
+ "prettier/prettier": [
94
+ "error",
95
+ {},
96
+ { usePrettierrc: true }
97
+ ],
98
+ "simple-import-sort/imports": "error",
99
+ "simple-import-sort/exports": "error"
100
+ }
101
+ };
102
+ export { recommended_default as t };
103
+
104
+ //# sourceMappingURL=recommended-DybMAiTx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recommended-DybMAiTx.js","names":[],"sources":["../src/configs/base.ts","../src/configs/recommended.ts"],"sourcesContent":["import { createRequire } from \"node:module\"\n\nimport type { ESLint, Linter } from \"eslint\"\n\nimport {\n createValidationError,\n shouldValidateDependencies,\n validatePeerDependencies,\n} from \"../utils/dependency-validator\"\n\n// Check the peers before loading them, so a missing one gets the install command, not a bare\n// \"Cannot find module\". A static import would fail at link time, before this check could run.\nif (shouldValidateDependencies()) {\n const result = validatePeerDependencies()\n if (!result.isValid) {\n throw createValidationError(result)\n }\n\n if (result.warnings.length > 0) {\n console.warn(\"\\n⚠️ eslint-config-functype warnings:\")\n result.warnings.forEach((warning) => console.warn(` ${warning}`))\n console.warn(\"\")\n }\n}\n\n/**\n * ESLint's plugin type. An interface, not an alias: the presets' .d.ts can name an interface, while\n * an alias is expanded to a type in @eslint/core, which a consumer may not be able to resolve.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface Plugin extends ESLint.Plugin {}\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Load a peer as a consumer's `import x from \"name\"` would. The peers are CommonJS, so this is the\n * same object, and ESLint accepts the same plugin registered twice. An ES module peer comes back as\n * its namespace, so take its default export.\n */\nconst load = <T>(name: string): T => {\n const mod = require(name) as { readonly default?: T; readonly [Symbol.toStringTag]?: string }\n return (mod[Symbol.toStringTag] === \"Module\" ? mod.default : mod) as T\n}\n\n/** The files the presets lint: TypeScript in every module flavour. */\nexport const typescriptFiles = [\"**/*.{ts,tsx,mts,cts}\"]\n\nconst isInstalled = (name: string): boolean => {\n try {\n require.resolve(name)\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Every plugin whose rules the presets set. The two @typescript-eslint packages are required. The\n * prettier and import-sort plugins stay optional, as they were when the presets were rules only, so\n * a config that takes the rules without theirs still loads; the check above warns when one is missing.\n */\nexport const plugins: Record<string, Plugin> = {\n \"@typescript-eslint\": load<Plugin>(\"@typescript-eslint/eslint-plugin\"),\n ...(isInstalled(\"eslint-plugin-prettier\") ? { prettier: load<Plugin>(\"eslint-plugin-prettier\") } : {}),\n ...(isInstalled(\"eslint-plugin-simple-import-sort\")\n ? { \"simple-import-sort\": load<Plugin>(\"eslint-plugin-simple-import-sort\") }\n : {}),\n}\n\n/**\n * The TypeScript parser, with type information: `no-floating-promises` and the other type-aware\n * rules need it. `projectService` finds each file's nearest tsconfig.json.\n */\nexport const languageOptions: Linter.LanguageOptions = {\n parser: load<Linter.Parser>(\"@typescript-eslint/parser\"),\n parserOptions: { projectService: true },\n}\n","import { languageOptions, plugins, typescriptFiles } from \"./base\"\n\n// ESLint flat config: a complete preset for TypeScript files. It registers the parser, with type\n// information, and every plugin its rules use, so `export default [recommended]` lints on its own.\nexport default {\n name: \"functype/recommended\",\n files: typescriptFiles,\n languageOptions,\n plugins,\n rules: {\n // Core JavaScript immutability\n \"prefer-const\": \"error\",\n \"no-var\": \"error\",\n \"no-throw-literal\": \"error\",\n \"object-shorthand\": \"error\",\n \"prefer-template\": \"error\",\n \"prefer-destructuring\": [\n \"error\",\n {\n array: false,\n object: true,\n },\n ],\n\n // TypeScript functional patterns (when @typescript-eslint is available)\n \"@typescript-eslint/consistent-type-imports\": \"error\",\n \"@typescript-eslint/no-explicit-any\": \"error\",\n \"@typescript-eslint/no-unused-vars\": [\n \"error\",\n {\n argsIgnorePattern: \"^_\", // Only underscore-prefixed parameters\n varsIgnorePattern: \"^(_|[A-Z]$)\", // Allow underscore-prefixed vars and single uppercase letters (interface generics)\n caughtErrors: \"all\", // Require using catch block errors or prefix with _\n caughtErrorsIgnorePattern: \"^_\", // Allow _error, _e, etc. in catch blocks\n destructuredArrayIgnorePattern: \"^_\",\n ignoreRestSiblings: true,\n args: \"after-used\",\n },\n ],\n \"@typescript-eslint/no-unused-expressions\": [\n \"error\",\n {\n allowShortCircuit: true,\n allowTernary: true,\n },\n ],\n \"@typescript-eslint/no-floating-promises\": \"error\",\n \"@typescript-eslint/await-thenable\": \"error\",\n \"@typescript-eslint/no-misused-promises\": \"error\",\n \"@typescript-eslint/require-await\": \"error\",\n \"@typescript-eslint/prefer-nullish-coalescing\": \"error\",\n \"@typescript-eslint/prefer-optional-chain\": \"error\",\n \"@typescript-eslint/no-unnecessary-condition\": \"warn\",\n // Relax strict-boolean-expressions for functional library patterns\n // This rule is valuable for applications but creates excessive noise in a functional library where:\n // 1. Optional chaining patterns like `if (options?.prop)` are idiomatic and safe\n // 2. String/object truthiness checks are common and intentional (e.g., `if (message)`)\n // 3. The functional design already provides safety through Option/Either patterns\n // 4. Library code often needs flexibility for performance and interoperability\n \"@typescript-eslint/strict-boolean-expressions\": [\n \"warn\",\n {\n allowString: true, // Allow `if (str)` patterns\n allowNumber: true, // Allow `if (num)` patterns\n allowNullableObject: true, // Allow `if (obj?.prop)` patterns\n allowNullableBoolean: true, // Allow `if (bool)` where bool might be null/undefined\n allowNullableString: true, // Allow `if (str)` where str might be null/undefined\n allowNullableNumber: true, // Allow `if (num)` where num might be null/undefined\n allowAny: true, // Allow `if (value)` where value is any type\n },\n ],\n\n // Code formatting (when eslint-plugin-prettier is available)\n \"prettier/prettier\": [\n \"error\",\n {},\n {\n usePrettierrc: true,\n },\n ],\n\n // Import organization (when eslint-plugin-simple-import-sort is available)\n \"simple-import-sort/imports\": \"error\",\n \"simple-import-sort/exports\": \"error\",\n },\n}\n"],"mappings":";;;AAYA,IAAI,2BAA2B,GAAG;CAChC,MAAM,SAAS,yBAAyB;CACxC,IAAI,CAAC,OAAO,SACV,MAAM,sBAAsB,MAAM;CAGpC,IAAI,OAAO,SAAS,SAAS,GAAG;EAC9B,QAAQ,KAAK,wCAAwC;EACrD,OAAO,SAAS,SAAS,YAAY,QAAQ,KAAK,MAAM,SAAS,CAAC;EAClE,QAAQ,KAAK,EAAE;CACjB;AACF;AASA,MAAM,UAAU,cAAc,YAAY,GAAG;;;;;;AAO7C,MAAM,QAAW,SAAoB;CACnC,MAAM,MAAM,QAAQ,IAAI;CACxB,OAAQ,IAAI,OAAO,iBAAiB,WAAW,IAAI,UAAU;AAC/D;;AAGA,MAAa,kBAAkB,CAAC,uBAAuB;AAEvD,MAAM,eAAe,SAA0B;CAC7C,IAAI;EACF,QAAQ,QAAQ,IAAI;EACpB,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;;;;;;AAOA,MAAa,UAAkC;CAC7C,sBAAsB,KAAa,kCAAkC;CACrE,GAAI,YAAY,wBAAwB,IAAI,EAAE,UAAU,KAAa,wBAAwB,EAAE,IAAI,CAAC;CACpG,GAAI,YAAY,kCAAkC,IAC9C,EAAE,sBAAsB,KAAa,kCAAkC,EAAE,IACzE,CAAC;AACP;;AC/DA,IAAA,sBAAe;CACb,MAAM;CACN,OAAO;CACP;EDmEA,QAAQ,KAAoB,2BAA2B;EACvD,eAAe,EAAE,gBAAgB,KAAK;CCpEtC;CACA;CACA,OAAO;EAEL,gBAAgB;EAChB,UAAU;EACV,oBAAoB;EACpB,oBAAoB;EACpB,mBAAmB;EACnB,wBAAwB,CACtB,SACA;GACE,OAAO;GACP,QAAQ;EACV,CACF;EAGA,8CAA8C;EAC9C,sCAAsC;EACtC,qCAAqC,CACnC,SACA;GACE,mBAAmB;GACnB,mBAAmB;GACnB,cAAc;GACd,2BAA2B;GAC3B,gCAAgC;GAChC,oBAAoB;GACpB,MAAM;EACR,CACF;EACA,4CAA4C,CAC1C,SACA;GACE,mBAAmB;GACnB,cAAc;EAChB,CACF;EACA,2CAA2C;EAC3C,qCAAqC;EACrC,0CAA0C;EAC1C,oCAAoC;EACpC,gDAAgD;EAChD,4CAA4C;EAC5C,+CAA+C;EAO/C,iDAAiD,CAC/C,QACA;GACE,aAAa;GACb,aAAa;GACb,qBAAqB;GACrB,sBAAsB;GACtB,qBAAqB;GACrB,qBAAqB;GACrB,UAAU;EACZ,CACF;EAGA,qBAAqB;GACnB;GACA,CAAC;GACD,EACE,eAAe,KACjB;EACF;EAGA,8BAA8B;EAC9B,8BAA8B;CAChC;AACF"}
@@ -46,7 +46,7 @@ function validatePeerDependencies() {
46
46
  for (const dep of PEER_DEPENDENCIES) if (tryResolve(dep.packageName)) available.push(dep);
47
47
  else {
48
48
  missing.push(dep);
49
- if (dep.required) {} else warnings.push(`Optional plugin '${dep.name}' not found. Some rules will be skipped.`);
49
+ if (dep.required) {} else warnings.push(`Optional peer '${dep.name}' not found. A config that uses the whole preset fails on its rules; install it, or use the preset's rules without them.`);
50
50
  }
51
51
  const isValid = missing.filter((dep) => dep.required).length === 0;
52
52
  const missingPackageNames = missing.map((dep) => dep.packageName);
@@ -1 +1 @@
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-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 tryResolve(packageName: string): boolean {\n try {\n import.meta.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 (tryResolve(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-config-functype:\",\n \"\",\n missingList,\n \"\",\n \"📦 Install missing dependencies:\",\n ` ${result.installCommand}`,\n \"\",\n \"📖 See installation guide: https://github.com/jordanburke/eslint-config-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":";AASA,MAAM,oBAAsC;CAC1C;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;CACA;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;CACA;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;CACA;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;CACA;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;AACF;AAUA,SAAS,WAAW,aAA8B;CAChD,IAAI;EACF,YAAY,QAAQ,WAAW;EAC/B,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,2BAA6C;CAC3D,MAAM,UAA4B,CAAC;CACnC,MAAM,YAA8B,CAAC;CACrC,MAAM,WAAqB,CAAC;CAE5B,KAAK,MAAM,OAAO,mBAChB,IAAI,WAAW,IAAI,WAAW,GAC5B,UAAU,KAAK,GAAG;MACb;EACL,QAAQ,KAAK,GAAG;EAChB,IAAI,IAAI,UAAU,CAElB,OAEE,SAAS,KAAK,oBAAoB,IAAI,KAAK,yCAAyC;CAExF;CAIF,MAAM,UADkB,QAAQ,QAAQ,QAAQ,IAAI,QACtB,CAAC,CAAC,WAAW;CAG3C,MAAM,sBAAsB,QAAQ,KAAK,QAAQ,IAAI,WAAW;CAGhE,OAAO;EACL;EACA;EACA;EACA,gBANqB,oBAAoB,SAAS,IAAI,eAAe,oBAAoB,KAAK,GAAG,MAAM;EAOvG;CACF;AACF;AAEA,SAAgB,sBAAsB,QAAiC;CACrE,MAAM,kBAAkB,OAAO,QAAQ,QAAQ,QAAQ,IAAI,QAAQ;CAEnE,IAAI,gBAAgB,WAAW,GAC7B,uBAAO,IAAI,MAAM,sBAAsB;CAKzC,MAAM,UAAU;EACd;EACA;EAJkB,gBAAgB,KAAK,QAAQ,OAAO,IAAI,KAAK,KAAK,IAAI,aAAa,CAAC,CAAC,KAAK,IAKlF;EACV;EACA;EACA,MAAM,OAAO;EACb;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CAEX,OAAO,IAAI,MAAM,OAAO;AAC1B;AAEA,SAAgB,6BAAsC;CAEpD,OAAO,QAAQ,IAAI,aAAa,UAAU,QAAQ,IAAI,6BAA6B;AACrF"}
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-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 tryResolve(packageName: string): boolean {\n try {\n import.meta.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 (tryResolve(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(\n `Optional peer '${dep.name}' not found. A config that uses the whole preset fails on its rules; install it, or use the preset's rules without them.`,\n )\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-config-functype:\",\n \"\",\n missingList,\n \"\",\n \"📦 Install missing dependencies:\",\n ` ${result.installCommand}`,\n \"\",\n \"📖 See installation guide: https://github.com/jordanburke/eslint-config-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":";AASA,MAAM,oBAAsC;CAC1C;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;CACA;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;CACA;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;CACA;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;CACA;EACE,MAAM;EACN,aAAa;EACb,aAAa;EACb,UAAU;CACZ;AACF;AAUA,SAAS,WAAW,aAA8B;CAChD,IAAI;EACF,YAAY,QAAQ,WAAW;EAC/B,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,2BAA6C;CAC3D,MAAM,UAA4B,CAAC;CACnC,MAAM,YAA8B,CAAC;CACrC,MAAM,WAAqB,CAAC;CAE5B,KAAK,MAAM,OAAO,mBAChB,IAAI,WAAW,IAAI,WAAW,GAC5B,UAAU,KAAK,GAAG;MACb;EACL,QAAQ,KAAK,GAAG;EAChB,IAAI,IAAI,UAAU,CAElB,OAEE,SAAS,KACP,kBAAkB,IAAI,KAAK,yHAC7B;CAEJ;CAIF,MAAM,UADkB,QAAQ,QAAQ,QAAQ,IAAI,QACtB,CAAC,CAAC,WAAW;CAG3C,MAAM,sBAAsB,QAAQ,KAAK,QAAQ,IAAI,WAAW;CAGhE,OAAO;EACL;EACA;EACA;EACA,gBANqB,oBAAoB,SAAS,IAAI,eAAe,oBAAoB,KAAK,GAAG,MAAM;EAOvG;CACF;AACF;AAEA,SAAgB,sBAAsB,QAAiC;CACrE,MAAM,kBAAkB,OAAO,QAAQ,QAAQ,QAAQ,IAAI,QAAQ;CAEnE,IAAI,gBAAgB,WAAW,GAC7B,uBAAO,IAAI,MAAM,sBAAsB;CAKzC,MAAM,UAAU;EACd;EACA;EAJkB,gBAAgB,KAAK,QAAQ,OAAO,IAAI,KAAK,KAAK,IAAI,aAAa,CAAC,CAAC,KAAK,IAKlF;EACV;EACA;EACA,MAAM,OAAO;EACb;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CAEX,OAAO,IAAI,MAAM,OAAO;AAC1B;AAEA,SAAgB,6BAAsC;CAEpD,OAAO,QAAQ,IAAI,aAAa,UAAU,QAAQ,IAAI,6BAA6B;AACrF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-functype",
3
- "version": "2.202.2",
3
+ "version": "2.203.0",
4
4
  "type": "module",
5
5
  "description": "Curated ESLint flat config bundle for functional TypeScript programming (ESLint 9.x+)",
6
6
  "main": "dist/index.js",
@@ -1 +0,0 @@
1
- {"version":3,"file":"recommended.js","names":[],"sources":["../../src/configs/recommended.ts"],"sourcesContent":["import {\n createValidationError,\n shouldValidateDependencies,\n validatePeerDependencies,\n} from \"../utils/dependency-validator\"\n\n// Validate peer dependencies on config load\nif (shouldValidateDependencies()) {\n const result = validatePeerDependencies()\n if (!result.isValid) {\n throw createValidationError(result)\n }\n\n // Log warnings for missing optional dependencies\n if (result.warnings.length > 0) {\n console.warn(\"\\n⚠️ eslint-config-functype warnings:\")\n result.warnings.forEach((warning) => console.warn(` ${warning}`))\n console.warn(\"\")\n }\n}\n\n// ESLint 9.x Flat Config Format\n// Complete functional TypeScript config with formatting and import organization\nexport default {\n name: \"functype/recommended\",\n rules: {\n // Core JavaScript immutability\n \"prefer-const\": \"error\",\n \"no-var\": \"error\",\n \"no-throw-literal\": \"error\",\n \"object-shorthand\": \"error\",\n \"prefer-template\": \"error\",\n \"prefer-destructuring\": [\n \"error\",\n {\n array: false,\n object: true,\n },\n ],\n\n // TypeScript functional patterns (when @typescript-eslint is available)\n \"@typescript-eslint/consistent-type-imports\": \"error\",\n \"@typescript-eslint/no-explicit-any\": \"error\",\n \"@typescript-eslint/no-unused-vars\": [\n \"error\",\n {\n argsIgnorePattern: \"^_\", // Only underscore-prefixed parameters\n varsIgnorePattern: \"^(_|[A-Z]$)\", // Allow underscore-prefixed vars and single uppercase letters (interface generics)\n caughtErrors: \"all\", // Require using catch block errors or prefix with _\n caughtErrorsIgnorePattern: \"^_\", // Allow _error, _e, etc. in catch blocks\n destructuredArrayIgnorePattern: \"^_\",\n ignoreRestSiblings: true,\n args: \"after-used\",\n },\n ],\n \"@typescript-eslint/no-unused-expressions\": [\n \"error\",\n {\n allowShortCircuit: true,\n allowTernary: true,\n },\n ],\n \"@typescript-eslint/no-floating-promises\": \"error\",\n \"@typescript-eslint/await-thenable\": \"error\",\n \"@typescript-eslint/no-misused-promises\": \"error\",\n \"@typescript-eslint/require-await\": \"error\",\n \"@typescript-eslint/prefer-nullish-coalescing\": \"error\",\n \"@typescript-eslint/prefer-optional-chain\": \"error\",\n \"@typescript-eslint/no-unnecessary-condition\": \"warn\",\n // Relax strict-boolean-expressions for functional library patterns\n // This rule is valuable for applications but creates excessive noise in a functional library where:\n // 1. Optional chaining patterns like `if (options?.prop)` are idiomatic and safe\n // 2. String/object truthiness checks are common and intentional (e.g., `if (message)`)\n // 3. The functional design already provides safety through Option/Either patterns\n // 4. Library code often needs flexibility for performance and interoperability\n \"@typescript-eslint/strict-boolean-expressions\": [\n \"warn\",\n {\n allowString: true, // Allow `if (str)` patterns\n allowNumber: true, // Allow `if (num)` patterns\n allowNullableObject: true, // Allow `if (obj?.prop)` patterns\n allowNullableBoolean: true, // Allow `if (bool)` where bool might be null/undefined\n allowNullableString: true, // Allow `if (str)` where str might be null/undefined\n allowNullableNumber: true, // Allow `if (num)` where num might be null/undefined\n allowAny: true, // Allow `if (value)` where value is any type\n },\n ],\n\n // Code formatting (when eslint-plugin-prettier is available)\n \"prettier/prettier\": [\n \"error\",\n {},\n {\n usePrettierrc: true,\n },\n ],\n\n // Import organization (when eslint-plugin-simple-import-sort is available)\n \"simple-import-sort/imports\": \"error\",\n \"simple-import-sort/exports\": \"error\",\n },\n}\n"],"mappings":";;AAOA,IAAI,2BAA2B,GAAG;CAChC,MAAM,SAAS,yBAAyB;CACxC,IAAI,CAAC,OAAO,SACV,MAAM,sBAAsB,MAAM;CAIpC,IAAI,OAAO,SAAS,SAAS,GAAG;EAC9B,QAAQ,KAAK,wCAAwC;EACrD,OAAO,SAAS,SAAS,YAAY,QAAQ,KAAK,MAAM,SAAS,CAAC;EAClE,QAAQ,KAAK,EAAE;CACjB;AACF;AAIA,IAAA,sBAAe;CACb,MAAM;CACN,OAAO;EAEL,gBAAgB;EAChB,UAAU;EACV,oBAAoB;EACpB,oBAAoB;EACpB,mBAAmB;EACnB,wBAAwB,CACtB,SACA;GACE,OAAO;GACP,QAAQ;EACV,CACF;EAGA,8CAA8C;EAC9C,sCAAsC;EACtC,qCAAqC,CACnC,SACA;GACE,mBAAmB;GACnB,mBAAmB;GACnB,cAAc;GACd,2BAA2B;GAC3B,gCAAgC;GAChC,oBAAoB;GACpB,MAAM;EACR,CACF;EACA,4CAA4C,CAC1C,SACA;GACE,mBAAmB;GACnB,cAAc;EAChB,CACF;EACA,2CAA2C;EAC3C,qCAAqC;EACrC,0CAA0C;EAC1C,oCAAoC;EACpC,gDAAgD;EAChD,4CAA4C;EAC5C,+CAA+C;EAO/C,iDAAiD,CAC/C,QACA;GACE,aAAa;GACb,aAAa;GACb,qBAAqB;GACrB,sBAAsB;GACtB,qBAAqB;GACrB,qBAAqB;GACrB,UAAU;EACZ,CACF;EAGA,qBAAqB;GACnB;GACA,CAAC;GACD,EACE,eAAe,KACjB;EACF;EAGA,8BAA8B;EAC9B,8BAA8B;CAChC;AACF"}