UNPKG

@sylphlab/eslint-config-sylph-strict

Version:

Strict ESLint Flat Configuration for SylphLab TypeScript Projects (Extends Standard)

1 lines 5.05 kB
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { sylph as sylphStandard } from '@sylphlab/eslint-config-sylph';\nimport functionalPlugin from 'eslint-plugin-functional';\nimport tseslint from 'typescript-eslint';\n\n/**\n * Sylph ESLint Strict Configuration (Flat Config)\n *\n * Extends the standard Sylph configuration with stricter rules, including:\n * - Functional programming enforcement (immutability, no-throw).\n * - Lower complexity and line limits enforced as errors.\n * - Stricter type checking enforcement (no-explicit-any as error).\n * - Stricter abbreviation rules.\n */\nexport const sylphStrict = [\n // 1. Start with the standard configuration\n ...sylphStandard,\n\n // 2. Add Functional Programming Rules (Strict Immutability/No-Throw Focus)\n {\n plugins: { functional: functionalPlugin },\n rules: {\n // Re-enable functional plugin rules removed from standard\n ...functionalPlugin.configs.recommended.rules,\n 'functional/no-mixed-types': 'off',\n 'functional/functional-parameters': 'off',\n 'functional/no-conditional-statements': 'off',\n 'functional/no-expression-statements': 'off',\n 'functional/no-try-statements': 'warn', // Keep warn, `try` is sometimes necessary boundary\n 'functional/no-throw-statements': 'error', // CRITICAL: Force explicit error handling\n 'functional/prefer-property-signatures': 'off',\n 'functional/immutable-data': [\n 'error',\n { ignoreClasses: true, ignoreIdentifierPattern: '^mutable|draft' },\n ], // CRITICAL: Force immutability\n },\n },\n {\n // Relax functional rules for config files (same as standard, but needed here too)\n files: ['prettier.config.cjs', '**/*.config.{js,cjs}', 'eslint.config.js'],\n rules: { 'functional/immutable-data': 'off' },\n },\n\n // 3. Re-apply Stricter Overrides (Error Severity, Lower Limits)\n {\n files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],\n // Ensure parser options are set correctly if not inherited perfectly\n languageOptions: {\n parser: tseslint.parser,\n parserOptions: {\n project: true,\n extraFileExtensions: ['.cjs'],\n },\n },\n rules: {\n // --- Re-apply strict TypeScript rules as errors ---\n '@typescript-eslint/explicit-function-return-type': ['error', { allowExpressions: true }],\n '@typescript-eslint/explicit-module-boundary-types': ['error'],\n '@typescript-eslint/no-explicit-any': ['error', { ignoreRestArgs: true }], // CRITICAL: Back to error\n\n // --- Re-apply strict Unicorn rules as errors ---\n 'unicorn/prevent-abbreviations': [\n 'error', // CRITICAL: Back to error\n { replacements: { env: false, config: false, src: false, dist: false, pkg: false } },\n ],\n\n // --- Re-apply strict limits as errors ---\n complexity: ['error', { max: 10 }], // CRITICAL: Back to error, low limit\n 'max-lines': ['error', { max: 350, skipBlankLines: true, skipComments: true }], // CRITICAL: Back to error, low limit\n 'max-lines-per-function': ['error', { max: 60, skipBlankLines: true, skipComments: true }], // CRITICAL: Back to error, low limit\n 'max-depth': ['error', 4], // CRITICAL: Back to error, low limit\n 'max-params': ['error', 4], // CRITICAL: Back to error, low limit\n\n // --- Consider adding SonarJS cognitive complexity as error ---\n // 'sonarjs/cognitive-complexity': ['error', 15],\n },\n },\n\n // 4. Ensure Test/Config Relaxations Still Apply (Inherited, but good to be aware)\n // The relaxations defined in the standard config for test/config files\n // should still apply here as this config includes the standard one.\n];\n\nexport default sylphStrict;\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,gBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAuC,yCACvCC,EAA6B,yCAC7BC,EAAqB,kCAWRJ,EAAc,CAEzB,GAAG,EAAAK,MAGH,CACE,QAAS,CAAE,WAAY,EAAAC,OAAiB,EACxC,MAAO,CAEL,GAAG,EAAAA,QAAiB,QAAQ,YAAY,MACxC,4BAA6B,MAC7B,mCAAoC,MACpC,uCAAwC,MACxC,sCAAuC,MACvC,+BAAgC,OAChC,iCAAkC,QAClC,wCAAyC,MACzC,4BAA6B,CAC3B,QACA,CAAE,cAAe,GAAM,wBAAyB,gBAAiB,CACnE,CACF,CACF,EACA,CAEE,MAAO,CAAC,sBAAuB,uBAAwB,kBAAkB,EACzE,MAAO,CAAE,4BAA6B,KAAM,CAC9C,EAGA,CACE,MAAO,CAAC,sCAAsC,EAE9C,gBAAiB,CACf,OAAQ,EAAAC,QAAS,OACjB,cAAe,CACb,QAAS,GACT,oBAAqB,CAAC,MAAM,CAC9B,CACF,EACA,MAAO,CAEL,mDAAoD,CAAC,QAAS,CAAE,iBAAkB,EAAK,CAAC,EACxF,oDAAqD,CAAC,OAAO,EAC7D,qCAAsC,CAAC,QAAS,CAAE,eAAgB,EAAK,CAAC,EAGxE,gCAAiC,CAC/B,QACA,CAAE,aAAc,CAAE,IAAK,GAAO,OAAQ,GAAO,IAAK,GAAO,KAAM,GAAO,IAAK,EAAM,CAAE,CACrF,EAGA,WAAY,CAAC,QAAS,CAAE,IAAK,EAAG,CAAC,EACjC,YAAa,CAAC,QAAS,CAAE,IAAK,IAAK,eAAgB,GAAM,aAAc,EAAK,CAAC,EAC7E,yBAA0B,CAAC,QAAS,CAAE,IAAK,GAAI,eAAgB,GAAM,aAAc,EAAK,CAAC,EACzF,YAAa,CAAC,QAAS,CAAC,EACxB,aAAc,CAAC,QAAS,CAAC,CAI3B,CACF,CAKF,EAEOR,EAAQC","names":["index_exports","__export","index_default","sylphStrict","__toCommonJS","import_eslint_config_sylph","import_eslint_plugin_functional","import_typescript_eslint","sylphStandard","functionalPlugin","tseslint"]}