{"version":3,"file":"typescript.mjs","names":[],"sources":["../../../../src/presets/common/rules/typescript.ts"],"sourcesContent":["import type { LintRules } from \"#/@types/oxlint\";\n\nconst RULES_TYPESCRIPT_NURSERY = {\n    \"typescript/no-unnecessary-condition\": [\n        \"error\",\n        {\n            allowConstantLoopConditions: true,\n            checkTypePredicates: true,\n        },\n    ],\n    \"typescript/prefer-optional-chain\": [\n        \"error\",\n        {\n            allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing: false,\n            checkAny: true,\n            checkBigInt: true,\n            checkBoolean: true,\n            checkNumber: true,\n            checkString: true,\n            checkUnknown: true,\n            requireNullish: false,\n        },\n    ],\n} as const satisfies LintRules;\n\nconst RULES_TYPESCRIPT_PEDANTIC = {\n    \"typescript/no-misused-promises\": [\n        \"error\",\n        {\n            checksConditionals: true,\n            checksSpreads: true,\n            checksVoidReturn: {\n                arguments: true,\n                attributes: true,\n                inheritedMethods: true,\n                properties: true,\n                returns: true,\n                variables: true,\n            },\n        },\n    ],\n    \"typescript/no-mixed-enums\": \"error\",\n    \"typescript/no-unsafe-argument\": \"error\",\n    \"typescript/no-unsafe-assignment\": \"error\",\n    \"typescript/no-unsafe-call\": \"error\",\n    \"typescript/no-unsafe-function-type\": \"error\",\n    \"typescript/no-unsafe-member-access\": \"error\",\n    \"typescript/no-unsafe-return\": \"error\",\n    \"typescript/only-throw-error\": \"error\",\n    \"typescript/prefer-includes\": \"error\",\n    \"typescript/prefer-nullish-coalescing\": [\n        \"error\",\n        {\n            ignoreBooleanCoercion: false,\n            ignoreConditionalTests: false,\n            ignoreIfStatements: false,\n            ignoreMixedLogicalExpressions: false,\n            ignorePrimitives: {\n                bigint: false,\n                boolean: false,\n                number: false,\n                string: false,\n            },\n            ignoreTernaryTests: false,\n        },\n    ],\n    \"typescript/prefer-promise-reject-errors\": [\n        \"error\",\n        {\n            allowEmptyReject: false,\n            allowThrowingAny: false,\n            allowThrowingUnknown: false,\n        },\n    ],\n    \"typescript/prefer-ts-expect-error\": \"error\",\n    \"typescript/restrict-plus-operands\": [\n        \"error\",\n        {\n            allowAny: true,\n            allowBoolean: true,\n            allowNullish: true,\n            allowNumberAndString: true,\n            allowRegExp: true,\n            skipCompoundAssignments: false,\n        },\n    ],\n    \"typescript/return-await\": [\n        \"error\",\n        \"always\",\n    ],\n    \"typescript/strict-boolean-expressions\": [\n        \"error\",\n        {\n            allowAny: true,\n            allowNullableBoolean: false,\n            allowNullableEnum: false,\n            allowNullableNumber: false,\n            allowNullableObject: true,\n            allowNullableString: false,\n            allowNumber: true,\n            allowString: true,\n        },\n    ],\n    \"typescript/strict-void-return\": [\n        \"error\",\n        {\n            allowReturnAny: false,\n        },\n    ],\n    \"typescript/switch-exhaustiveness-check\": [\n        \"error\",\n        {\n            allowDefaultCaseForExhaustiveSwitch: true,\n            considerDefaultExhaustiveForUnions: true,\n            requireDefaultForNonUnion: false,\n        },\n    ],\n} as const satisfies LintRules;\n\nconst RULES_TYPESCRIPT_RESTRICTION = {\n    \"typescript/explicit-member-accessibility\": [\n        \"error\",\n        {\n            accessibility: \"explicit\",\n        },\n    ],\n    \"typescript/no-empty-object-type\": [\n        \"error\",\n        {\n            allowInterfaces: \"with-single-extends\",\n            allowObjectTypes: \"never\",\n        },\n    ],\n    \"typescript/no-import-type-side-effects\": \"error\",\n    \"typescript/no-namespace\": [\n        \"error\",\n        {\n            allowDeclarations: false,\n            allowDefinitionFiles: true,\n        },\n    ],\n    \"typescript/no-non-null-asserted-nullish-coalescing\": \"error\",\n    \"typescript/no-non-null-assertion\": \"error\",\n    \"typescript/promise-function-async\": [\n        \"error\",\n        {\n            allowAny: true,\n            checkArrowFunctions: true,\n            checkFunctionDeclarations: true,\n            checkFunctionExpressions: true,\n            checkMethodDeclarations: true,\n        },\n    ],\n    \"typescript/use-unknown-in-catch-callback-variable\": \"error\",\n} as const satisfies LintRules;\n\nconst RULES_TYPESCRIPT_STYLE = {\n    \"typescript/consistent-type-assertions\": [\n        \"error\",\n        {\n            assertionStyle: \"as\",\n        },\n    ],\n    \"typescript/consistent-type-definitions\": [\n        \"error\",\n        \"type\",\n    ],\n    \"typescript/consistent-type-exports\": [\n        \"error\",\n        {\n            fixMixedExportsWithInlineTypeSpecifier: false,\n        },\n    ],\n    \"typescript/consistent-type-imports\": [\n        \"error\",\n        {\n            disallowTypeAnnotations: true,\n            fixStyle: \"separate-type-imports\",\n            prefer: \"type-imports\",\n        },\n    ],\n    \"typescript/dot-notation\": [\n        \"error\",\n        {\n            allowIndexSignaturePropertyAccess: false,\n            allowKeywords: true,\n            allowPrivateClassPropertyAccess: false,\n            allowProtectedClassPropertyAccess: false,\n        },\n    ],\n    \"typescript/method-signature-style\": [\n        \"error\",\n        \"property\",\n    ],\n    \"typescript/no-empty-interface\": [\n        \"error\",\n        {\n            allowSingleExtends: true,\n        },\n    ],\n    \"typescript/parameter-properties\": [\n        \"error\",\n        {\n            prefer: \"class-property\",\n        },\n    ],\n    \"typescript/prefer-function-type\": \"error\",\n    \"typescript/prefer-reduce-type-parameter\": \"error\",\n    \"typescript/prefer-readonly\": [\n        \"error\",\n        {\n            onlyInlineLambdas: false,\n        },\n    ],\n    \"typescript/prefer-regexp-exec\": \"error\",\n    \"typescript/prefer-return-this-type\": \"error\",\n} as const satisfies LintRules;\n\nconst RULES_TYPESCRIPT_SUSPICIOUS = {\n    \"typescript/consistent-return\": [\n        \"error\",\n        {\n            treatUndefinedAsUnspecified: false,\n        },\n    ],\n    \"typescript/no-confusing-non-null-assertion\": \"error\",\n    \"typescript/no-unnecessary-template-expression\": \"error\",\n    \"typescript/no-unnecessary-type-constraint\": \"error\",\n    \"typescript/no-unnecessary-type-conversion\": \"error\",\n    \"typescript/no-unnecessary-type-parameters\": \"error\",\n    \"typescript/no-unsafe-enum-comparison\": \"error\",\n} as const satisfies LintRules;\n\nconst RULES_TYPESCRIPT = {\n    ...RULES_TYPESCRIPT_NURSERY,\n    ...RULES_TYPESCRIPT_PEDANTIC,\n    ...RULES_TYPESCRIPT_RESTRICTION,\n    ...RULES_TYPESCRIPT_STYLE,\n    ...RULES_TYPESCRIPT_SUSPICIOUS,\n} as const satisfies LintRules;\n\nexport {\n    RULES_TYPESCRIPT,\n    RULES_TYPESCRIPT_NURSERY,\n    RULES_TYPESCRIPT_PEDANTIC,\n    RULES_TYPESCRIPT_RESTRICTION,\n    RULES_TYPESCRIPT_STYLE,\n    RULES_TYPESCRIPT_SUSPICIOUS,\n};\n"],"mappings":"AAEA,MAAM,2BAA2B;CAC7B,uCAAuC,CACnC,SACA;EACI,6BAA6B;EAC7B,qBAAqB;CACzB,CACJ;CACA,oCAAoC,CAChC,SACA;EACI,oEAAoE;EACpE,UAAU;EACV,aAAa;EACb,cAAc;EACd,aAAa;EACb,aAAa;EACb,cAAc;EACd,gBAAgB;CACpB,CACJ;AACJ;AAEA,MAAM,4BAA4B;CAC9B,kCAAkC,CAC9B,SACA;EACI,oBAAoB;EACpB,eAAe;EACf,kBAAkB;GACd,WAAW;GACX,YAAY;GACZ,kBAAkB;GAClB,YAAY;GACZ,SAAS;GACT,WAAW;EACf;CACJ,CACJ;CACA,6BAA6B;CAC7B,iCAAiC;CACjC,mCAAmC;CACnC,6BAA6B;CAC7B,sCAAsC;CACtC,sCAAsC;CACtC,+BAA+B;CAC/B,+BAA+B;CAC/B,8BAA8B;CAC9B,wCAAwC,CACpC,SACA;EACI,uBAAuB;EACvB,wBAAwB;EACxB,oBAAoB;EACpB,+BAA+B;EAC/B,kBAAkB;GACd,QAAQ;GACR,SAAS;GACT,QAAQ;GACR,QAAQ;EACZ;EACA,oBAAoB;CACxB,CACJ;CACA,2CAA2C,CACvC,SACA;EACI,kBAAkB;EAClB,kBAAkB;EAClB,sBAAsB;CAC1B,CACJ;CACA,qCAAqC;CACrC,qCAAqC,CACjC,SACA;EACI,UAAU;EACV,cAAc;EACd,cAAc;EACd,sBAAsB;EACtB,aAAa;EACb,yBAAyB;CAC7B,CACJ;CACA,2BAA2B,CACvB,SACA,QACJ;CACA,yC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