@truenine/eslint9-config
Version:
ESLint 9 configuration package for Compose Client projects with TypeScript, Vue, and modern JavaScript support
1 lines • 2.02 kB
Source Map (JSON)
{"version":3,"file":"typescript-rules.mjs","names":[],"sources":["../../src/presets/typescript-rules.ts"],"sourcesContent":["import type {Linter} from 'eslint'\n\n/**\n * TypeScript 专用规则配置\n * 包含 @typescript-eslint 插件的规则,用于增强 TypeScript 代码质量。\n * 这些规则需要类型信息,因此需要配置 parserOptions.project。\n */\nexport const typescriptRulesPreset: Linter.RulesRecord = {\n '@typescript-eslint/prefer-optional-chain': 'error', /* 优先使用可选链和空值合并 */\n '@typescript-eslint/prefer-nullish-coalescing': 'error',\n\n '@typescript-eslint/prefer-includes': 'error', /* 优先使用现代方法 */\n '@typescript-eslint/prefer-string-starts-ends-with': 'error',\n '@typescript-eslint/prefer-for-of': 'error',\n '@typescript-eslint/prefer-reduce-type-parameter': 'error',\n '@typescript-eslint/prefer-regexp-exec': 'error',\n\n '@typescript-eslint/promise-function-async': 'error', /* 异步函数规则 */\n\n '@typescript-eslint/unbound-method': 'off', /* 关闭的规则 */\n '@typescript-eslint/switch-exhaustiveness-check': 'off',\n '@typescript-eslint/no-unnecessary-condition': 'off',\n\n '@typescript-eslint/array-type': ['error', {default: 'array'}], /* 类型相关规则 */\n '@typescript-eslint/no-unnecessary-type-assertion': 'error',\n '@typescript-eslint/no-unnecessary-type-constraint': 'error',\n '@typescript-eslint/no-unnecessary-type-arguments': 'error',\n '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',\n '@typescript-eslint/no-namespace': 'error',\n '@typescript-eslint/prefer-function-type': 'error',\n '@typescript-eslint/prefer-as-const': 'error'\n}\n"],"mappings":";;;;;;AAOA,MAAa,wBAA4C;CACvD,4CAA4C;CAC5C,gDAAgD;CAEhD,sCAAsC;CACtC,qDAAqD;CACrD,oCAAoC;CACpC,mDAAmD;CACnD,yCAAyC;CAEzC,6CAA6C;CAE7C,qCAAqC;CACrC,kDAAkD;CAClD,+CAA+C;CAE/C,iCAAiC,CAAC,SAAS,EAAC,SAAS,SAAQ,CAAC;CAC9D,oDAAoD;CACpD,qDAAqD;CACrD,oDAAoD;CACpD,6DAA6D;CAC7D,mCAAmC;CACnC,2CAA2C;CAC3C,sCAAsC;CACvC"}