{"version":3,"file":"typescript.mjs","names":[],"sources":["../src/configs/typescript/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Linter } from 'eslint';\nimport { ensurePackages } from '../../utils.ts';\nimport type { TypeScriptOptions } from './types.ts';\n\nexport async function typescript(options: TypeScriptOptions = {}): Promise<Linter.Config[]> {\n    const { project } = options;\n\n    await ensurePackages(['typescript-eslint']);\n\n    const tseslint = await import('typescript-eslint');\n\n    const configs: Linter.Config[] = [\n        ...tseslint.default.configs.recommended as Linter.Config[],\n    ];\n\n    if (project) {\n        configs.push({\n            files: ['**/*.{ts,tsx,mts,cts}'],\n            languageOptions: {\n                parserOptions: {\n                    projectService: project === true ? true : undefined,\n                    project: project !== true ? project : undefined,\n                },\n            },\n            rules: {\n                'no-return-await': 'off',\n                '@typescript-eslint/return-await': ['error', 'in-try-catch'],\n            },\n        });\n    }\n\n    configs.push({\n        files: ['**/*.{ts,tsx,mts,cts}'],\n        rules: {\n            // ----------------------------------------\n            // Disable base rules in favor of TS versions\n            // ----------------------------------------\n            'default-param-last': 'off',\n            '@typescript-eslint/default-param-last': 'error',\n\n            'no-empty-function': 'off',\n            '@typescript-eslint/no-empty-function': ['error', { allow: ['arrowFunctions', 'functions', 'methods'] }],\n\n            'no-unused-expressions': 'off',\n            '@typescript-eslint/no-unused-expressions': ['error', {\n                allowShortCircuit: false,\n                allowTernary: false,\n                allowTaggedTemplates: false,\n            }],\n\n            'no-shadow': 'off',\n            'no-useless-constructor': 'off',\n\n            // ----------------------------------------\n            // TS-specific rules\n            // ----------------------------------------\n            '@typescript-eslint/consistent-type-imports': 'warn',\n            '@typescript-eslint/no-empty-object-type': 'off',\n            '@typescript-eslint/no-explicit-any': 'off',\n            '@typescript-eslint/no-shadow': 'off',\n        },\n    });\n\n    return configs;\n}\n"],"mappings":";;AAWA,eAAsB,WAAW,UAA6B,CAAC,GAA6B;CACxF,MAAM,EAAE,YAAY;CAEpB,MAAM,eAAe,CAAC,mBAAmB,CAAC;CAI1C,MAAM,UAA2B,CAC7B,IAAG,MAHgB,OAAO,qBAAA,CAGd,QAAQ,QAAQ,WAChC;CAEA,IAAI,SACA,QAAQ,KAAK;EACT,OAAO,CAAC,uBAAuB;EAC/B,iBAAiB,EACb,eAAe;GACX,gBAAgB,YAAY,OAAO,OAAO,KAAA;GAC1C,SAAS,YAAY,OAAO,UAAU,KAAA;EAC1C,EACJ;EACA,OAAO;GACH,mBAAmB;GACnB,mCAAmC,CAAC,SAAS,cAAc;EAC/D;CACJ,CAAC;CAGL,QAAQ,KAAK;EACT,OAAO,CAAC,uBAAuB;EAC/B,OAAO;GAIH,sBAAsB;GACtB,yCAAyC;GAEzC,qBAAqB;GACrB,wCAAwC,CAAC,SAAS,EAAE,OAAO;IAAC;IAAkB;IAAa;GAAS,EAAE,CAAC;GAEvG,yBAAyB;GACzB,4CAA4C,CAAC,SAAS;IAClD,mBAAmB;IACnB,cAAc;IACd,sBAAsB;GAC1B,CAAC;GAED,aAAa;GACb,0BAA0B;GAK1B,8CAA8C;GAC9C,2CAA2C;GAC3C,sCAAsC;GACtC,gCAAgC;EACpC;CACJ,CAAC;CAED,OAAO;AACX"}