@fast-china/eslint-config 2.1.6 → 2.1.7

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/CHANGELOG.md CHANGED
@@ -6,6 +6,16 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 2.1.7 - 2026-09-11
10
+
11
+ ### Added
12
+
13
+ - Rejected direct and indirect dynamic string execution, returned values from Promise executors, type-only inline imports with runtime side effects, and Vue props/ref usage that loses reactivity.
14
+
15
+ ### Changed
16
+
17
+ - Allowed Promise-returning event handlers in Vue templates and TSX attributes while retaining all other `no-misused-promises` checks.
18
+
9
19
  ## 2.1.6 - 2026-09-11
10
20
 
11
21
  ### Added
package/README.md CHANGED
@@ -119,13 +119,13 @@ parserOptions: {
119
119
 
120
120
  Linted files must belong to a discoverable `tsconfig.json`. The same `extraFileExtensions` list is applied to TypeScript, TSX, Vue, and NVue files so Project Service does not reload the project while linting mixed file types. The `typeChecked` and `tsconfigRootDir` wrapper options have been removed. Complex monorepos can override `languageOptions.parserOptions` in a trailing Flat Config when necessary, but every type-aware file override in the same project must keep `extraFileExtensions` identical.
121
121
 
122
- Developers decide whether a Promise must be awaited, returned, or handled from the required ordering and error semantics. Therefore, `no-floating-promises` and `strict-void-return` are disabled, framework allowlists are unnecessary, and `void promise` is rejected. `no-misused-promises`, `await-thenable`, `require-await`, and the unsafe type rules remain strict, so invalid async callbacks, invalid `await` expressions, and `async` functions without asynchronous behavior are still reported.
122
+ Developers decide whether a Promise must be awaited, returned, or handled from the required ordering and error semantics. Therefore, `no-floating-promises` and `strict-void-return` are disabled, framework allowlists are unnecessary, and `void promise` is rejected. `no-misused-promises`, `await-thenable`, `require-await`, and the unsafe type rules remain strict; Promise-returning event handlers are allowed in Vue templates and TSX attributes, while other invalid async callbacks, invalid `await` expressions, and `async` functions without asynchronous behavior are still reported.
123
123
 
124
124
  `return-await` keeps the strict preset's `error-handling-correctness-only` mode instead of forcing stylistic `await` expressions.
125
125
 
126
126
  Named TypeScript and TSX functions and module boundaries require explicit types, while inline callbacks and already typed function expressions keep contextual inference. Vue/NVue SFCs disable function-return and module-boundary annotations and allow unused parameters in declarative callbacks such as `defineEmits` validators; unused variables and imports are still reported. Standalone SFC handler parameters that cannot be inferred back from templates still require explicit types.
127
127
 
128
- Type-only exports use `export type`, and private members assigned only during construction use `readonly`. Primitive values retain the semantic choice between `||` and `??`, while public overloads with different parameter names or standalone JSDoc are preserved. Shared JavaScript rules reject `eval` and the `void` operator, require consistent braces for multiline branches, and place an existing `default` branch last.
128
+ Type-only imports and exports use standalone `import type` and `export type`, and private members assigned only during construction use `readonly`. Primitive values retain the semantic choice between `||` and `??`, while public overloads with different parameter names or standalone JSDoc are preserved. Shared JavaScript rules reject `eval`, implied dynamic execution, the `Function` constructor, Promise executor returns, and the `void` operator; they also require consistent braces for multiline branches and place an existing `default` branch last. Vue setup code cannot use props or refs in ways that lose reactivity.
129
129
 
130
130
  ## React
131
131
 
package/README.zh.md CHANGED
@@ -121,13 +121,13 @@ parserOptions: {
121
121
 
122
122
  被检查文件必须属于可发现的 `tsconfig.json`。TypeScript、TSX、Vue 与 NVue 统一使用相同的 `extraFileExtensions`,避免混合检查文件时 Project Service 重载项目。不再提供 `typeChecked` 和 `tsconfigRootDir` 包装选项;复杂 monorepo 如需指定根目录,可在后置 Flat Config 中直接覆盖 `languageOptions.parserOptions`,但同一项目中所有类型感知文件覆盖必须保持 `extraFileExtensions` 完全一致。
123
123
 
124
- Promise 是否需要等待、返回或处理异常由开发者根据业务顺序和异常语义决定,因此 `no-floating-promises` 与 `strict-void-return` 默认关闭,不维护框架 API 白名单,也不使用 `void promise` 规避检查。`no-misused-promises`、`await-thenable`、`require-await` 及 unsafe 类型规则继续严格启用,异步回调误用、错误的 `await` 和无异步语义的 `async` 仍会报错。
124
+ Promise 是否需要等待、返回或处理异常由开发者根据业务顺序和异常语义决定,因此 `no-floating-promises` 与 `strict-void-return` 默认关闭,不维护框架 API 白名单,也不使用 `void promise` 规避检查。`no-misused-promises`、`await-thenable`、`require-await` 及 unsafe 类型规则继续严格启用;Vue 模板与 TSX 属性允许 Promise 返回的事件处理函数,其他异步回调误用、错误的 `await` 和无异步语义的 `async` 仍会报错。
125
125
 
126
126
  `return-await` 保持严格预置的 `error-handling-correctness-only` 模式,不为了风格强制增加 `await`。
127
127
 
128
128
  普通 TypeScript 与 TSX 的命名函数和模块边界要求显式类型,内联回调和已有函数类型约束的表达式继续使用上下文推断。Vue/NVue SFC 关闭函数返回类型与模块边界类型要求,并允许 `defineEmits` 校验器等声明型回调保留未使用形参;普通未使用变量和导入仍会报错。SFC 中无法从模板反向推断的独立处理函数参数仍应显式标注类型。
129
129
 
130
- 纯类型导出使用 `export type`,只在构造阶段赋值的私有成员使用 `readonly`。原始类型保留 `||` 与 `??` 的业务语义选择;具有不同参数名或独立 JSDoc 的公共重载不强制合并。共享 JavaScript 规则禁止 `eval` `void` 操作符,要求多行条件分支使用一致的花括号,并将已有的 `default` 分支放在最后。
130
+ 纯类型导入和导出使用独立的 `import type` 与 `export type`,只在构造阶段赋值的私有成员使用 `readonly`。原始类型保留 `||` 与 `??` 的业务语义选择;具有不同参数名或独立 JSDoc 的公共重载不强制合并。共享 JavaScript 规则禁止 `eval`、隐式动态代码执行、`Function` 构造器、Promise executor 返回值和 `void` 操作符,要求多行条件分支使用一致的花括号,并将已有的 `default` 分支放在最后。Vue setup 禁止以丢失响应性的方式使用 props 或 ref。
131
131
 
132
132
  ## React
133
133
 
@@ -54,6 +54,10 @@ const createTypeScriptConfigs = (files = GLOBS_TYPESCRIPT) => defineConfig([{
54
54
  ...typescriptRules,
55
55
  ...typescriptTypeCheckedRules
56
56
  }
57
+ }, {
58
+ name: "@fast-china/typescript/tsx-attributes",
59
+ files: [[...files, "**/*.tsx"]],
60
+ rules: { "@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: { attributes: false } }] }
57
61
  }]);
58
62
  //#endregion
59
63
  export { createTypeScriptConfigs, createTypeScriptParserOptions, getTypeScriptPresetConfigs };
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.mjs","names":[],"sources":["../../src/configs/typescript.ts"],"sourcesContent":["import eslint from \"@eslint/js\";\nimport { defineConfig } from \"eslint/config\";\nimport tseslint from \"typescript-eslint\";\nimport { GLOBS_TYPESCRIPT } from \"../constants\";\nimport { javascriptRules, typescriptRules, typescriptTypeCheckedRules } from \"../rules\";\nimport type { Linter } from \"eslint\";\n\n/**\n * 返回 typescript-eslint 严格且类型感知的官方预置。\n *\n * @returns ESLint 核心推荐规则与对应的 typescript-eslint 推荐预置。\n */\nexport const getTypeScriptPresetConfigs = (): Linter.Config[] =>\n\t[\n\t\teslint.configs.recommended,\n\t\t{\n\t\t\tname: \"@fast-china/typescript/javascript-rules\",\n\t\t\trules: javascriptRules,\n\t\t},\n\t\t...tseslint.configs.strictTypeChecked,\n\t\t...tseslint.configs.stylisticTypeChecked,\n\t] as Linter.Config[];\n\n/**\n * 创建 TypeScript 解析器的 Project Service 选项。\n *\n * @remarks\n * TypeScript、TSX、Vue 与 NVue 必须使用完全一致的 `extraFileExtensions`。否则混合检查文件时,\n * TypeScript Server 会因扩展名集合变化而反复重载整个项目。\n *\n * @returns 始终启用 `projectService`,并统一声明 Vue 扩展名的解析器选项。\n */\nexport const createTypeScriptParserOptions = (): Linter.ParserOptions => ({\n\tprojectService: true,\n\textraFileExtensions: [\".vue\", \".nvue\"],\n});\n\n/**\n * 创建 TypeScript 配置。\n *\n * @remarks\n * 始终采用 ESLint 与 typescript-eslint 的 `strictTypeChecked`、`stylisticTypeChecked` 预置并启动 Project Service。\n * 被检查文件必须属于可发现的 tsconfig。特殊项目可在后置 Flat Config 中覆盖解析器选项。\n *\n * @param files - 应用 TypeScript 配置的 ESLint glob 列表。\n * @returns 包含 TypeScript 预置、解析器选项与本地规则的 Flat Config 数组。\n */\nexport const createTypeScriptConfigs = (files: readonly string[] = GLOBS_TYPESCRIPT): ReturnType<typeof defineConfig> =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/typescript/type-checked\",\n\t\t\tfiles: [...files],\n\t\t\textends: getTypeScriptPresetConfigs(),\n\t\t\tlanguageOptions: {\n\t\t\t\tecmaVersion: \"latest\",\n\t\t\t\tparserOptions: createTypeScriptParserOptions(),\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t...typescriptRules,\n\t\t\t\t...typescriptTypeCheckedRules,\n\t\t\t},\n\t\t},\n\t]);\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,mCACZ;CACC,OAAO,QAAQ;CACf;EACC,MAAM;EACN,OAAO;CACR;CACA,GAAG,SAAS,QAAQ;CACpB,GAAG,SAAS,QAAQ;AACrB;;;;;;;;;;AAWD,MAAa,uCAA6D;CACzE,gBAAgB;CAChB,qBAAqB,CAAC,QAAQ,OAAO;AACtC;;;;;;;;;;;AAYA,MAAa,2BAA2B,QAA2B,qBAClE,aAAa,CACZ;CACC,MAAM;CACN,OAAO,CAAC,GAAG,KAAK;CAChB,SAAS,2BAA2B;CACpC,iBAAiB;EAChB,aAAa;EACb,eAAe,8BAA8B;CAC9C;CACA,OAAO;EACN,GAAG;EACH,GAAG;CACJ;AACD,CACD,CAAC"}
1
+ {"version":3,"file":"typescript.mjs","names":[],"sources":["../../src/configs/typescript.ts"],"sourcesContent":["import eslint from \"@eslint/js\";\nimport { defineConfig } from \"eslint/config\";\nimport tseslint from \"typescript-eslint\";\nimport { GLOBS_TYPESCRIPT } from \"../constants\";\nimport { javascriptRules, typescriptRules, typescriptTypeCheckedRules } from \"../rules\";\nimport type { Linter } from \"eslint\";\n\n/**\n * 返回 typescript-eslint 严格且类型感知的官方预置。\n *\n * @returns ESLint 核心推荐规则与对应的 typescript-eslint 推荐预置。\n */\nexport const getTypeScriptPresetConfigs = (): Linter.Config[] =>\n\t[\n\t\teslint.configs.recommended,\n\t\t{\n\t\t\tname: \"@fast-china/typescript/javascript-rules\",\n\t\t\trules: javascriptRules,\n\t\t},\n\t\t...tseslint.configs.strictTypeChecked,\n\t\t...tseslint.configs.stylisticTypeChecked,\n\t] as Linter.Config[];\n\n/**\n * 创建 TypeScript 解析器的 Project Service 选项。\n *\n * @remarks\n * TypeScript、TSX、Vue 与 NVue 必须使用完全一致的 `extraFileExtensions`。否则混合检查文件时,\n * TypeScript Server 会因扩展名集合变化而反复重载整个项目。\n *\n * @returns 始终启用 `projectService`,并统一声明 Vue 扩展名的解析器选项。\n */\nexport const createTypeScriptParserOptions = (): Linter.ParserOptions => ({\n\tprojectService: true,\n\textraFileExtensions: [\".vue\", \".nvue\"],\n});\n\n/**\n * 创建 TypeScript 配置。\n *\n * @remarks\n * 始终采用 ESLint 与 typescript-eslint 的 `strictTypeChecked`、`stylisticTypeChecked` 预置并启动 Project Service。\n * 被检查文件必须属于可发现的 tsconfig。特殊项目可在后置 Flat Config 中覆盖解析器选项。\n *\n * @param files - 应用 TypeScript 配置的 ESLint glob 列表。\n * @returns 包含 TypeScript 预置、解析器选项与本地规则的 Flat Config 数组。\n */\nexport const createTypeScriptConfigs = (files: readonly string[] = GLOBS_TYPESCRIPT): ReturnType<typeof defineConfig> =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/typescript/type-checked\",\n\t\t\tfiles: [...files],\n\t\t\textends: getTypeScriptPresetConfigs(),\n\t\t\tlanguageOptions: {\n\t\t\t\tecmaVersion: \"latest\",\n\t\t\t\tparserOptions: createTypeScriptParserOptions(),\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t...typescriptRules,\n\t\t\t\t...typescriptTypeCheckedRules,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"@fast-china/typescript/tsx-attributes\",\n\t\t\t// 与调用方传入的 TypeScript 范围取交集,避免独立组合时意外接管范围外的 TSX 文件。\n\t\t\tfiles: [[...files, \"**/*.tsx\"]],\n\t\t\trules: {\n\t\t\t\t// TSX 事件属性由框架接管异步结果,允许把 Promise 返回函数传给 void 回调属性;其他误用继续检查。\n\t\t\t\t\"@typescript-eslint/no-misused-promises\": [\"error\", { checksVoidReturn: { attributes: false } }],\n\t\t\t},\n\t\t},\n\t]);\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,mCACZ;CACC,OAAO,QAAQ;CACf;EACC,MAAM;EACN,OAAO;CACR;CACA,GAAG,SAAS,QAAQ;CACpB,GAAG,SAAS,QAAQ;AACrB;;;;;;;;;;AAWD,MAAa,uCAA6D;CACzE,gBAAgB;CAChB,qBAAqB,CAAC,QAAQ,OAAO;AACtC;;;;;;;;;;;AAYA,MAAa,2BAA2B,QAA2B,qBAClE,aAAa,CACZ;CACC,MAAM;CACN,OAAO,CAAC,GAAG,KAAK;CAChB,SAAS,2BAA2B;CACpC,iBAAiB;EAChB,aAAa;EACb,eAAe,8BAA8B;CAC9C;CACA,OAAO;EACN,GAAG;EACH,GAAG;CACJ;AACD,GACA;CACC,MAAM;CAEN,OAAO,CAAC,CAAC,GAAG,OAAO,UAAU,CAAC;CAC9B,OAAO,EAEN,0CAA0C,CAAC,SAAS,EAAE,kBAAkB,EAAE,YAAY,MAAM,EAAE,CAAC,EAChG;AACD,CACD,CAAC"}
@@ -36,6 +36,7 @@ const createVueConfigs = () => defineConfig([{
36
36
  ...typescriptTypeCheckedRules,
37
37
  "@typescript-eslint/explicit-function-return-type": "off",
38
38
  "@typescript-eslint/explicit-module-boundary-types": "off",
39
+ "@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: { attributes: false } }],
39
40
  "@typescript-eslint/no-unused-vars": ["error", {
40
41
  args: "none",
41
42
  caughtErrors: "none",
@@ -1 +1 @@
1
- {"version":3,"file":"vue.mjs","names":[],"sources":["../../src/configs/vue.ts"],"sourcesContent":["import { defineConfig } from \"eslint/config\";\nimport eslintPluginVue from \"eslint-plugin-vue\";\nimport tseslint from \"typescript-eslint\";\nimport vueEslintParser from \"vue-eslint-parser\";\nimport { GLOB_NVUE, GLOB_VUE } from \"../constants\";\nimport { typescriptRules, typescriptTypeCheckedRules, vueRules } from \"../rules\";\nimport { createTypeScriptParserOptions, getTypeScriptPresetConfigs } from \"./typescript\";\n\n/**\n * 创建 Vue 3 单文件组件配置。\n *\n * @remarks\n * 本包只处理 Vue 3,并默认同时接管 UniApp 原生渲染页面使用的 `.nvue`。Vue 模板解析器\n * 通过 `parserOptions.parser` 委托给 typescript-eslint,统一使用类型感知检查。\n *\n * @returns 包含 Vue 模板、脚本解析器、推荐预置与本地规则的 Flat Config 数组。\n */\nexport const createVueConfigs = (): ReturnType<typeof defineConfig> =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/vue/type-checked\",\n\t\t\tfiles: [GLOB_VUE, GLOB_NVUE],\n\t\t\textends: [...getTypeScriptPresetConfigs(), ...eslintPluginVue.configs[\"flat/recommended\"]],\n\t\t\tlanguageOptions: {\n\t\t\t\tecmaVersion: \"latest\",\n\t\t\t\tparser: vueEslintParser,\n\t\t\t\tparserOptions: {\n\t\t\t\t\tparser: tseslint.parser,\n\t\t\t\t\tecmaFeatures: {\n\t\t\t\t\t\tjsx: true,\n\t\t\t\t\t},\n\t\t\t\t\tsourceType: \"module\",\n\t\t\t\t\t...createTypeScriptParserOptions(),\n\t\t\t\t},\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t// Vue SFC 需要显式接管 TypeScript 预置中的核心规则替换,再由本地策略做最终覆写。\n\t\t\t\t...(tseslint.configs.strictTypeChecked[1]?.rules ?? {}),\n\t\t\t\t...typescriptRules,\n\t\t\t\t...typescriptTypeCheckedRules,\n\t\t\t\t// SFC 以模板上下文和快速迭代为主,不强制补写函数返回类型或模块边界类型。\n\t\t\t\t\"@typescript-eslint/explicit-function-return-type\": \"off\",\n\t\t\t\t\"@typescript-eslint/explicit-module-boundary-types\": \"off\",\n\t\t\t\t// defineEmits 校验器和框架回调的形参可用于声明契约而不读取;普通未使用变量和导入仍然报错。\n\t\t\t\t\"@typescript-eslint/no-unused-vars\": [\"error\", { args: \"none\", caughtErrors: \"none\", ignoreRestSiblings: true }],\n\t\t\t\t...vueRules,\n\t\t\t},\n\t\t},\n\t]);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,yBACZ,aAAa,CACZ;CACC,MAAM;CACN,OAAO,CAAC,UAAU,SAAS;CAC3B,SAAS,CAAC,GAAG,2BAA2B,GAAG,GAAG,gBAAgB,QAAQ,mBAAmB;CACzF,iBAAiB;EAChB,aAAa;EACb,QAAQ;EACR,eAAe;GACd,QAAQ,SAAS;GACjB,cAAc,EACb,KAAK,KACN;GACA,YAAY;GACZ,GAAG,8BAA8B;EAClC;CACD;CACA,OAAO;EAEN,GAAI,SAAS,QAAQ,kBAAkB,EAAE,EAAE,SAAS,CAAC;EACrD,GAAG;EACH,GAAG;EAEH,oDAAoD;EACpD,qDAAqD;EAErD,qCAAqC,CAAC,SAAS;GAAE,MAAM;GAAQ,cAAc;GAAQ,oBAAoB;EAAK,CAAC;EAC/G,GAAG;CACJ;AACD,CACD,CAAC"}
1
+ {"version":3,"file":"vue.mjs","names":[],"sources":["../../src/configs/vue.ts"],"sourcesContent":["import { defineConfig } from \"eslint/config\";\nimport eslintPluginVue from \"eslint-plugin-vue\";\nimport tseslint from \"typescript-eslint\";\nimport vueEslintParser from \"vue-eslint-parser\";\nimport { GLOB_NVUE, GLOB_VUE } from \"../constants\";\nimport { typescriptRules, typescriptTypeCheckedRules, vueRules } from \"../rules\";\nimport { createTypeScriptParserOptions, getTypeScriptPresetConfigs } from \"./typescript\";\n\n/**\n * 创建 Vue 3 单文件组件配置。\n *\n * @remarks\n * 本包只处理 Vue 3,并默认同时接管 UniApp 原生渲染页面使用的 `.nvue`。Vue 模板解析器\n * 通过 `parserOptions.parser` 委托给 typescript-eslint,统一使用类型感知检查。\n *\n * @returns 包含 Vue 模板、脚本解析器、推荐预置与本地规则的 Flat Config 数组。\n */\nexport const createVueConfigs = (): ReturnType<typeof defineConfig> =>\n\tdefineConfig([\n\t\t{\n\t\t\tname: \"@fast-china/vue/type-checked\",\n\t\t\tfiles: [GLOB_VUE, GLOB_NVUE],\n\t\t\textends: [...getTypeScriptPresetConfigs(), ...eslintPluginVue.configs[\"flat/recommended\"]],\n\t\t\tlanguageOptions: {\n\t\t\t\tecmaVersion: \"latest\",\n\t\t\t\tparser: vueEslintParser,\n\t\t\t\tparserOptions: {\n\t\t\t\t\tparser: tseslint.parser,\n\t\t\t\t\tecmaFeatures: {\n\t\t\t\t\t\tjsx: true,\n\t\t\t\t\t},\n\t\t\t\t\tsourceType: \"module\",\n\t\t\t\t\t...createTypeScriptParserOptions(),\n\t\t\t\t},\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t// Vue SFC 需要显式接管 TypeScript 预置中的核心规则替换,再由本地策略做最终覆写。\n\t\t\t\t...(tseslint.configs.strictTypeChecked[1]?.rules ?? {}),\n\t\t\t\t...typescriptRules,\n\t\t\t\t...typescriptTypeCheckedRules,\n\t\t\t\t// SFC 以模板上下文和快速迭代为主,不强制补写函数返回类型或模块边界类型。\n\t\t\t\t\"@typescript-eslint/explicit-function-return-type\": \"off\",\n\t\t\t\t\"@typescript-eslint/explicit-module-boundary-types\": \"off\",\n\t\t\t\t// Vue 模板事件由框架接管异步结果,允许 Promise 返回的事件处理函数;其他 Promise 误用继续检查。\n\t\t\t\t\"@typescript-eslint/no-misused-promises\": [\"error\", { checksVoidReturn: { attributes: false } }],\n\t\t\t\t// defineEmits 校验器和框架回调的形参可用于声明契约而不读取;普通未使用变量和导入仍然报错。\n\t\t\t\t\"@typescript-eslint/no-unused-vars\": [\"error\", { args: \"none\", caughtErrors: \"none\", ignoreRestSiblings: true }],\n\t\t\t\t...vueRules,\n\t\t\t},\n\t\t},\n\t]);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,yBACZ,aAAa,CACZ;CACC,MAAM;CACN,OAAO,CAAC,UAAU,SAAS;CAC3B,SAAS,CAAC,GAAG,2BAA2B,GAAG,GAAG,gBAAgB,QAAQ,mBAAmB;CACzF,iBAAiB;EAChB,aAAa;EACb,QAAQ;EACR,eAAe;GACd,QAAQ,SAAS;GACjB,cAAc,EACb,KAAK,KACN;GACA,YAAY;GACZ,GAAG,8BAA8B;EAClC;CACD;CACA,OAAO;EAEN,GAAI,SAAS,QAAQ,kBAAkB,EAAE,EAAE,SAAS,CAAC;EACrD,GAAG;EACH,GAAG;EAEH,oDAAoD;EACpD,qDAAqD;EAErD,0CAA0C,CAAC,SAAS,EAAE,kBAAkB,EAAE,YAAY,MAAM,EAAE,CAAC;EAE/F,qCAAqC,CAAC,SAAS;GAAE,MAAM;GAAQ,cAAc;GAAQ,oBAAoB;EAAK,CAAC;EAC/G,GAAG;CACJ;AACD,CACD,CAAC"}
@@ -11,6 +11,9 @@ export declare const commonRules: {
11
11
  "no-alert": "warn";
12
12
  "no-case-declarations": "error";
13
13
  "no-eval": "error";
14
+ "no-implied-eval": "error";
15
+ "no-new-func": "error";
16
+ "no-promise-executor-return": "error";
14
17
  "no-multi-str": "error";
15
18
  "no-with": "error";
16
19
  "no-void": "error";
@@ -11,6 +11,9 @@ const commonRules = {
11
11
  "no-alert": "warn",
12
12
  "no-case-declarations": "error",
13
13
  "no-eval": "error",
14
+ "no-implied-eval": "error",
15
+ "no-new-func": "error",
16
+ "no-promise-executor-return": "error",
14
17
  "no-multi-str": "error",
15
18
  "no-with": "error",
16
19
  "no-void": "error",
@@ -1 +1 @@
1
- {"version":3,"file":"common.mjs","names":[],"sources":["../../src/rules/common.ts"],"sourcesContent":["import type { RuleOptions } from \"../typegen\";\n\n/**\n * 跨 JavaScript、TypeScript 与 Vue 脚本生效的公共规则。\n *\n * @remarks\n * 默认规则面向 SDK、OA、Admin 与客户端项目使用同一套质量标准。这里只保留\n * 跨语言且误报较少的规则;纯格式和语法偏好交给 Prettier 或项目自行覆盖。\n */\nexport const commonRules = {\n\t// 要求数组回调在所有可到达分支返回值,避免 map/filter 等调用静默产生 undefined。\n\t\"array-callback-return\": \"error\",\n\t// 浏览器弹窗通常不适合生产代码;使用 warn 允许原型调试,同时确保发布前能够被发现。\n\t\"no-alert\": \"warn\",\n\t// switch 的 case 不创建词法作用域;要求用花括号包裹声明,避免跨 case 冲突。\n\t\"no-case-declarations\": \"error\",\n\t// 禁止动态执行字符串代码,避免代码注入和静态分析失效。\n\t\"no-eval\": \"error\",\n\t// 禁止反斜杠续行字符串,优先使用可读性更好的模板字符串。\n\t\"no-multi-str\": \"error\",\n\t// with 会让标识符解析不可预测,并且在严格模式和 ESM 中不可用。\n\t\"no-with\": \"error\",\n\t// Promise 是否等待由业务语义决定,不使用 `void promise` 作为 ESLint 规避语法。\n\t\"no-void\": \"error\",\n\t// 简单单行分支允许省略花括号;多行分支必须使用花括号,同一条件链保持一致。\n\tcurly: [\"error\", \"multi-line\", \"consistent\"],\n\t// default 分支不是强制项,但存在时统一位于其他 case 之后。\n\t\"default-case-last\": \"error\",\n\t// 要求严格相等;保留 `value == null` 同时判断 null/undefined 的常用写法。\n\teqeqeq: [\"error\", \"always\", { null: \"ignore\" }],\n\t// 使用幂运算符代替 Math.pow,使数学表达式更直接。\n\t\"prefer-exponentiation-operator\": \"error\",\n\t// 使用 Object.hasOwn 代替 obj.hasOwnProperty,兼容无原型对象以及同名方法被覆盖的对象。\n\t\"prefer-object-has-own\": \"error\",\n\t// 仅排序同一 import 声明中的导入成员;声明之间的分组和顺序交给 import-x/order。\n\t// 该规则无法自动修复成员顺序,使用 warn 避免历史代码因纯排序问题被立即阻断。\n\t\"sort-imports\": [\n\t\t\"warn\",\n\t\t{\n\t\t\tignoreCase: false,\n\t\t\tignoreDeclarationSort: true,\n\t\t\tignoreMemberSort: false,\n\t\t\tmemberSyntaxSortOrder: [\"none\", \"all\", \"multiple\", \"single\"],\n\t\t\tallowSeparatedGroups: false,\n\t\t},\n\t],\n} satisfies RuleOptions;\n"],"mappings":";;;;;;;;AASA,MAAa,cAAc;CAE1B,yBAAyB;CAEzB,YAAY;CAEZ,wBAAwB;CAExB,WAAW;CAEX,gBAAgB;CAEhB,WAAW;CAEX,WAAW;CAEX,OAAO;EAAC;EAAS;EAAc;CAAY;CAE3C,qBAAqB;CAErB,QAAQ;EAAC;EAAS;EAAU,EAAE,MAAM,SAAS;CAAC;CAE9C,kCAAkC;CAElC,yBAAyB;CAGzB,gBAAgB,CACf,QACA;EACC,YAAY;EACZ,uBAAuB;EACvB,kBAAkB;EAClB,uBAAuB;GAAC;GAAQ;GAAO;GAAY;EAAQ;EAC3D,sBAAsB;CACvB,CACD;AACD"}
1
+ {"version":3,"file":"common.mjs","names":[],"sources":["../../src/rules/common.ts"],"sourcesContent":["import type { RuleOptions } from \"../typegen\";\n\n/**\n * 跨 JavaScript、TypeScript 与 Vue 脚本生效的公共规则。\n *\n * @remarks\n * 默认规则面向 SDK、OA、Admin 与客户端项目使用同一套质量标准。这里只保留\n * 跨语言且误报较少的规则;纯格式和语法偏好交给 Prettier 或项目自行覆盖。\n */\nexport const commonRules = {\n\t// 要求数组回调在所有可到达分支返回值,避免 map/filter 等调用静默产生 undefined。\n\t\"array-callback-return\": \"error\",\n\t// 浏览器弹窗通常不适合生产代码;使用 warn 允许原型调试,同时确保发布前能够被发现。\n\t\"no-alert\": \"warn\",\n\t// switch 的 case 不创建词法作用域;要求用花括号包裹声明,避免跨 case 冲突。\n\t\"no-case-declarations\": \"error\",\n\t// 禁止动态执行字符串代码,避免代码注入和静态分析失效。\n\t\"no-eval\": \"error\",\n\t// 禁止 setTimeout、setInterval 等 API 通过字符串间接执行代码。\n\t\"no-implied-eval\": \"error\",\n\t// 禁止使用 Function 构造器动态编译字符串代码,避免绕过静态分析和安全策略。\n\t\"no-new-func\": \"error\",\n\t// Promise executor 的返回值会被忽略,禁止误把 return 当作 Promise 的解析结果。\n\t\"no-promise-executor-return\": \"error\",\n\t// 禁止反斜杠续行字符串,优先使用可读性更好的模板字符串。\n\t\"no-multi-str\": \"error\",\n\t// with 会让标识符解析不可预测,并且在严格模式和 ESM 中不可用。\n\t\"no-with\": \"error\",\n\t// Promise 是否等待由业务语义决定,不使用 `void promise` 作为 ESLint 规避语法。\n\t\"no-void\": \"error\",\n\t// 简单单行分支允许省略花括号;多行分支必须使用花括号,同一条件链保持一致。\n\tcurly: [\"error\", \"multi-line\", \"consistent\"],\n\t// default 分支不是强制项,但存在时统一位于其他 case 之后。\n\t\"default-case-last\": \"error\",\n\t// 要求严格相等;保留 `value == null` 同时判断 null/undefined 的常用写法。\n\teqeqeq: [\"error\", \"always\", { null: \"ignore\" }],\n\t// 使用幂运算符代替 Math.pow,使数学表达式更直接。\n\t\"prefer-exponentiation-operator\": \"error\",\n\t// 使用 Object.hasOwn 代替 obj.hasOwnProperty,兼容无原型对象以及同名方法被覆盖的对象。\n\t\"prefer-object-has-own\": \"error\",\n\t// 仅排序同一 import 声明中的导入成员;声明之间的分组和顺序交给 import-x/order。\n\t// 该规则无法自动修复成员顺序,使用 warn 避免历史代码因纯排序问题被立即阻断。\n\t\"sort-imports\": [\n\t\t\"warn\",\n\t\t{\n\t\t\tignoreCase: false,\n\t\t\tignoreDeclarationSort: true,\n\t\t\tignoreMemberSort: false,\n\t\t\tmemberSyntaxSortOrder: [\"none\", \"all\", \"multiple\", \"single\"],\n\t\t\tallowSeparatedGroups: false,\n\t\t},\n\t],\n} satisfies RuleOptions;\n"],"mappings":";;;;;;;;AASA,MAAa,cAAc;CAE1B,yBAAyB;CAEzB,YAAY;CAEZ,wBAAwB;CAExB,WAAW;CAEX,mBAAmB;CAEnB,eAAe;CAEf,8BAA8B;CAE9B,gBAAgB;CAEhB,WAAW;CAEX,WAAW;CAEX,OAAO;EAAC;EAAS;EAAc;CAAY;CAE3C,qBAAqB;CAErB,QAAQ;EAAC;EAAS;EAAU,EAAE,MAAM,SAAS;CAAC;CAE9C,kCAAkC;CAElC,yBAAyB;CAGzB,gBAAgB,CACf,QACA;EACC,YAAY;EACZ,uBAAuB;EACvB,kBAAkB;EAClB,uBAAuB;GAAC;GAAQ;GAAO;GAAY;EAAQ;EAC3D,sBAAsB;CACvB,CACD;AACD"}
@@ -41,6 +41,7 @@ export declare const typescriptRules: {
41
41
  fixStyle: "separate-type-imports";
42
42
  prefer: "type-imports";
43
43
  }];
44
+ "@typescript-eslint/no-import-type-side-effects": "error";
44
45
  };
45
46
  /** 仅在 Project Service 提供完整类型信息后应用的 TypeScript 类型感知规则覆写。 */
46
47
  export declare const typescriptTypeCheckedRules: {
@@ -36,7 +36,8 @@ const typescriptRules = {
36
36
  disallowTypeAnnotations: false,
37
37
  fixStyle: "separate-type-imports",
38
38
  prefer: "type-imports"
39
- }]
39
+ }],
40
+ "@typescript-eslint/no-import-type-side-effects": "error"
40
41
  };
41
42
  /** 仅在 Project Service 提供完整类型信息后应用的 TypeScript 类型感知规则覆写。 */
42
43
  const typescriptTypeCheckedRules = {
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.mjs","names":[],"sources":["../../src/rules/typescript.ts"],"sourcesContent":["import type { RuleOptions } from \"../typegen\";\n\n/**\n * TypeScript 本地覆写规则。\n *\n * @remarks\n * 普通 TS/TSX 的命名函数与公共模块边界要求显式类型,内联回调保留上下文推断;\n * strictTypeChecked 与 stylisticTypeChecked 预置负责补充类型语义和官方风格检查。\n */\nexport const typescriptRules = {\n\t// 单独组合 createTypeScriptConfigs() 时也禁止用 void 操作符标记被忽略的 Promise。\n\t\"no-void\": \"error\",\n\t// 普通 TS/TSX 函数要求显式返回类型;内联回调和已有函数类型约束的表达式继续依赖上下文推断。\n\t\"@typescript-eslint/explicit-function-return-type\": [\"error\", { allowExpressions: true, allowTypedFunctionExpressions: true }],\n\t// 导出函数和类的公共方法必须显式声明参数与返回类型,使公共 API 不依赖实现细节推断;参数不允许显式 any。\n\t\"@typescript-eslint/explicit-module-boundary-types\": [\"error\", { allowArgumentsExplicitlyTypedAsAny: false }],\n\t// 使用 TypeScript 版本避免核心规则误判声明合并、类型和值的同名声明。\n\t\"@typescript-eslint/no-redeclare\": \"error\",\n\t// 未使用符号视为错误;仅参数和异常可用下划线明确表示有意忽略。\n\t\"@typescript-eslint/no-unused-vars\": [\n\t\t\"error\",\n\t\t{\n\t\t\targs: \"after-used\",\n\t\t\targsIgnorePattern: \"^_\",\n\t\t\tcaughtErrors: \"all\",\n\t\t\tcaughtErrorsIgnorePattern: \"^_\",\n\t\t\tignoreRestSiblings: true,\n\t\t},\n\t],\n\t// [默认关闭] 声明文件、全局扩展和部分 SDK 仍需要 namespace。\n\t\"@typescript-eslint/no-namespace\": \"off\",\n\t// any 会绕过类型检查,但第三方边界和渐进迁移仍可能需要,因此只警告。\n\t\"@typescript-eslint/no-explicit-any\": \"warn\",\n\t// TypeScript 源码统一使用 ESM import;Node 工具文件由末尾覆写单独放开。\n\t\"@typescript-eslint/no-require-imports\": \"error\",\n\t// 禁止普通空函数,避免遗漏实现;仅允许无函数体逻辑的构造器和有意留空的重写方法。\n\t\"@typescript-eslint/no-empty-function\": [\"error\", { allow: [\"constructors\", \"overrideMethods\"] }],\n\t// 使用 TS 版本识别类型断言等语法;允许常见的短路和三元表达式调用模式。\n\t\"@typescript-eslint/no-unused-expressions\": [\n\t\t\"error\",\n\t\t{\n\t\t\tallowShortCircuit: true,\n\t\t\tallowTernary: true,\n\t\t},\n\t],\n\t// 删除可由 TypeScript 明确推断的原始值类型标注。\n\t\"@typescript-eslint/no-inferrable-types\": \"error\",\n\t// 禁止非空断言,要求显式处理空值边界。\n\t\"@typescript-eslint/no-non-null-assertion\": \"error\",\n\t// 可选链之后再做非空断言逻辑矛盾,通常表示边界条件设计有误。\n\t\"@typescript-eslint/no-non-null-asserted-optional-chain\": \"error\",\n\t// 纯类型依赖必须使用独立的 `import type`,避免生成无用运行时导入并统一导入声明结构。\n\t\"@typescript-eslint/consistent-type-imports\": [\n\t\t\"error\",\n\t\t{\n\t\t\tdisallowTypeAnnotations: false,\n\t\t\tfixStyle: \"separate-type-imports\",\n\t\t\tprefer: \"type-imports\",\n\t\t},\n\t],\n} satisfies RuleOptions;\n\n/** 仅在 Project Service 提供完整类型信息后应用的 TypeScript 类型感知规则覆写。 */\nexport const typescriptTypeCheckedRules = {\n\t// 是否等待、返回或处理 Promise 由开发者根据业务顺序和异常语义决定。\n\t\"@typescript-eslint/no-floating-promises\": \"off\",\n\t// 不限制框架生命周期和事件回调的返回写法。\n\t\"@typescript-eslint/strict-void-return\": \"off\",\n\t// 核心 no-void 已禁止全部 void 操作符,关闭类型感知的重复诊断。\n\t\"@typescript-eslint/no-meaningless-void-operator\": \"off\",\n\t// 保留简洁的 `() => notify()` 回调,其他容易混淆 void 值与返回值的用法继续检查。\n\t\"@typescript-eslint/no-confusing-void-expression\": [\"error\", { ignoreArrowShorthand: true }],\n\t// 数字是模板字符串的常见安全插值;对象、any 和空值仍需显式处理。\n\t\"@typescript-eslint/restrict-template-expressions\": [\"error\", { allowNumber: true }],\n\t// 动态删除对象字段是表单和字典的正常操作;数组 delete 仍由 no-array-delete 禁止。\n\t\"@typescript-eslint/no-dynamic-delete\": \"off\",\n\t// 纯静态工具类可能是 SDK 的有意 API 设计,不强制改写为函数或对象。\n\t\"@typescript-eslint/no-extraneous-class\": \"off\",\n\t// 弃用 API 需要可见,但兼容多个依赖版本时不应直接阻断构建。\n\t\"@typescript-eslint/no-deprecated\": \"warn\",\n\t// TypeScript 类型不一定覆盖外部输入的真实运行时,防御性条件仅提醒审查。\n\t\"@typescript-eslint/no-unnecessary-condition\": \"warn\",\n\t// 语法形式不影响类型安全,不强制 interface/type、索引类型、字面量属性和 RegExp API 的单一写法。\n\t\"@typescript-eslint/consistent-type-definitions\": \"off\",\n\t\"@typescript-eslint/consistent-indexed-object-style\": \"off\",\n\t\"@typescript-eslint/class-literal-property-style\": \"off\",\n\t\"@typescript-eslint/prefer-regexp-exec\": \"off\",\n\t// 纯类型导出必须使用 export type,避免生成或暗示不存在的运行时导出。\n\t\"@typescript-eslint/consistent-type-exports\": \"error\",\n\t// 只在构造阶段赋值且之后保持不变的私有成员应声明为 readonly。\n\t\"@typescript-eslint/prefer-readonly\": \"error\",\n\t// 原始类型的 || 与 ?? 可能承载不同业务语义,不为了风格强制互换。\n\t\"@typescript-eslint/prefer-nullish-coalescing\": [\"error\", { ignorePrimitives: true }],\n\t// 参数名称或独立 JSDoc 属于公共重载契约;仅合并真正重复的签名。\n\t\"@typescript-eslint/unified-signatures\": [\n\t\t\"error\",\n\t\t{\n\t\t\tignoreDifferentlyNamedParameters: true,\n\t\t\tignoreOverloadsWithDifferentJSDoc: true,\n\t\t},\n\t],\n\t// 联合类型和枚举新增成员时,switch 必须覆盖全部分支或显式提供 default。\n\t\"@typescript-eslint/switch-exhaustiveness-check\": \"error\",\n\t// 允许透明转发外部 Promise 的未知拒绝原因;静态可知的 string、number 等仍会被报告。\n\t\"@typescript-eslint/prefer-promise-reject-errors\": [\"error\", { allowThrowingUnknown: true }],\n} satisfies RuleOptions;\n"],"mappings":";;;;;;;;AASA,MAAa,kBAAkB;CAE9B,WAAW;CAEX,oDAAoD,CAAC,SAAS;EAAE,kBAAkB;EAAM,+BAA+B;CAAK,CAAC;CAE7H,qDAAqD,CAAC,SAAS,EAAE,oCAAoC,MAAM,CAAC;CAE5G,mCAAmC;CAEnC,qCAAqC,CACpC,SACA;EACC,MAAM;EACN,mBAAmB;EACnB,cAAc;EACd,2BAA2B;EAC3B,oBAAoB;CACrB,CACD;CAEA,mCAAmC;CAEnC,sCAAsC;CAEtC,yCAAyC;CAEzC,wCAAwC,CAAC,SAAS,EAAE,OAAO,CAAC,gBAAgB,iBAAiB,EAAE,CAAC;CAEhG,4CAA4C,CAC3C,SACA;EACC,mBAAmB;EACnB,cAAc;CACf,CACD;CAEA,0CAA0C;CAE1C,4CAA4C;CAE5C,0DAA0D;CAE1D,8CAA8C,CAC7C,SACA;EACC,yBAAyB;EACzB,UAAU;EACV,QAAQ;CACT,CACD;AACD;;AAGA,MAAa,6BAA6B;CAEzC,2CAA2C;CAE3C,yCAAyC;CAEzC,mDAAmD;CAEnD,mDAAmD,CAAC,SAAS,EAAE,sBAAsB,KAAK,CAAC;CAE3F,oDAAoD,CAAC,SAAS,EAAE,aAAa,KAAK,CAAC;CAEnF,wCAAwC;CAExC,0CAA0C;CAE1C,oCAAoC;CAEpC,+CAA+C;CAE/C,kDAAkD;CAClD,sDAAsD;CACtD,mDAAmD;CACnD,yCAAyC;CAEzC,8CAA8C;CAE9C,sCAAsC;CAEtC,gDAAgD,CAAC,SAAS,EAAE,kBAAkB,KAAK,CAAC;CAEpF,yCAAyC,CACxC,SACA;EACC,kCAAkC;EAClC,mCAAmC;CACpC,CACD;CAEA,kDAAkD;CAElD,mDAAmD,CAAC,SAAS,EAAE,sBAAsB,KAAK,CAAC;AAC5F"}
1
+ {"version":3,"file":"typescript.mjs","names":[],"sources":["../../src/rules/typescript.ts"],"sourcesContent":["import type { RuleOptions } from \"../typegen\";\n\n/**\n * TypeScript 本地覆写规则。\n *\n * @remarks\n * 普通 TS/TSX 的命名函数与公共模块边界要求显式类型,内联回调保留上下文推断;\n * strictTypeChecked 与 stylisticTypeChecked 预置负责补充类型语义和官方风格检查。\n */\nexport const typescriptRules = {\n\t// 单独组合 createTypeScriptConfigs() 时也禁止用 void 操作符标记被忽略的 Promise。\n\t\"no-void\": \"error\",\n\t// 普通 TS/TSX 函数要求显式返回类型;内联回调和已有函数类型约束的表达式继续依赖上下文推断。\n\t\"@typescript-eslint/explicit-function-return-type\": [\"error\", { allowExpressions: true, allowTypedFunctionExpressions: true }],\n\t// 导出函数和类的公共方法必须显式声明参数与返回类型,使公共 API 不依赖实现细节推断;参数不允许显式 any。\n\t\"@typescript-eslint/explicit-module-boundary-types\": [\"error\", { allowArgumentsExplicitlyTypedAsAny: false }],\n\t// 使用 TypeScript 版本避免核心规则误判声明合并、类型和值的同名声明。\n\t\"@typescript-eslint/no-redeclare\": \"error\",\n\t// 未使用符号视为错误;仅参数和异常可用下划线明确表示有意忽略。\n\t\"@typescript-eslint/no-unused-vars\": [\n\t\t\"error\",\n\t\t{\n\t\t\targs: \"after-used\",\n\t\t\targsIgnorePattern: \"^_\",\n\t\t\tcaughtErrors: \"all\",\n\t\t\tcaughtErrorsIgnorePattern: \"^_\",\n\t\t\tignoreRestSiblings: true,\n\t\t},\n\t],\n\t// [默认关闭] 声明文件、全局扩展和部分 SDK 仍需要 namespace。\n\t\"@typescript-eslint/no-namespace\": \"off\",\n\t// any 会绕过类型检查,但第三方边界和渐进迁移仍可能需要,因此只警告。\n\t\"@typescript-eslint/no-explicit-any\": \"warn\",\n\t// TypeScript 源码统一使用 ESM import;Node 工具文件由末尾覆写单独放开。\n\t\"@typescript-eslint/no-require-imports\": \"error\",\n\t// 禁止普通空函数,避免遗漏实现;仅允许无函数体逻辑的构造器和有意留空的重写方法。\n\t\"@typescript-eslint/no-empty-function\": [\"error\", { allow: [\"constructors\", \"overrideMethods\"] }],\n\t// 使用 TS 版本识别类型断言等语法;允许常见的短路和三元表达式调用模式。\n\t\"@typescript-eslint/no-unused-expressions\": [\n\t\t\"error\",\n\t\t{\n\t\t\tallowShortCircuit: true,\n\t\t\tallowTernary: true,\n\t\t},\n\t],\n\t// 删除可由 TypeScript 明确推断的原始值类型标注。\n\t\"@typescript-eslint/no-inferrable-types\": \"error\",\n\t// 禁止非空断言,要求显式处理空值边界。\n\t\"@typescript-eslint/no-non-null-assertion\": \"error\",\n\t// 可选链之后再做非空断言逻辑矛盾,通常表示边界条件设计有误。\n\t\"@typescript-eslint/no-non-null-asserted-optional-chain\": \"error\",\n\t// 纯类型依赖必须使用独立的 `import type`,避免生成无用运行时导入并统一导入声明结构。\n\t\"@typescript-eslint/consistent-type-imports\": [\n\t\t\"error\",\n\t\t{\n\t\t\tdisallowTypeAnnotations: false,\n\t\t\tfixStyle: \"separate-type-imports\",\n\t\t\tprefer: \"type-imports\",\n\t\t},\n\t],\n\t// 禁止 `import { type Foo }` 产生仅用于类型的运行时导入,统一提升为独立的 `import type`。\n\t\"@typescript-eslint/no-import-type-side-effects\": \"error\",\n} satisfies RuleOptions;\n\n/** 仅在 Project Service 提供完整类型信息后应用的 TypeScript 类型感知规则覆写。 */\nexport const typescriptTypeCheckedRules = {\n\t// 是否等待、返回或处理 Promise 由开发者根据业务顺序和异常语义决定。\n\t\"@typescript-eslint/no-floating-promises\": \"off\",\n\t// 不限制框架生命周期和事件回调的返回写法。\n\t\"@typescript-eslint/strict-void-return\": \"off\",\n\t// 核心 no-void 已禁止全部 void 操作符,关闭类型感知的重复诊断。\n\t\"@typescript-eslint/no-meaningless-void-operator\": \"off\",\n\t// 保留简洁的 `() => notify()` 回调,其他容易混淆 void 值与返回值的用法继续检查。\n\t\"@typescript-eslint/no-confusing-void-expression\": [\"error\", { ignoreArrowShorthand: true }],\n\t// 数字是模板字符串的常见安全插值;对象、any 和空值仍需显式处理。\n\t\"@typescript-eslint/restrict-template-expressions\": [\"error\", { allowNumber: true }],\n\t// 动态删除对象字段是表单和字典的正常操作;数组 delete 仍由 no-array-delete 禁止。\n\t\"@typescript-eslint/no-dynamic-delete\": \"off\",\n\t// 纯静态工具类可能是 SDK 的有意 API 设计,不强制改写为函数或对象。\n\t\"@typescript-eslint/no-extraneous-class\": \"off\",\n\t// 弃用 API 需要可见,但兼容多个依赖版本时不应直接阻断构建。\n\t\"@typescript-eslint/no-deprecated\": \"warn\",\n\t// TypeScript 类型不一定覆盖外部输入的真实运行时,防御性条件仅提醒审查。\n\t\"@typescript-eslint/no-unnecessary-condition\": \"warn\",\n\t// 语法形式不影响类型安全,不强制 interface/type、索引类型、字面量属性和 RegExp API 的单一写法。\n\t\"@typescript-eslint/consistent-type-definitions\": \"off\",\n\t\"@typescript-eslint/consistent-indexed-object-style\": \"off\",\n\t\"@typescript-eslint/class-literal-property-style\": \"off\",\n\t\"@typescript-eslint/prefer-regexp-exec\": \"off\",\n\t// 纯类型导出必须使用 export type,避免生成或暗示不存在的运行时导出。\n\t\"@typescript-eslint/consistent-type-exports\": \"error\",\n\t// 只在构造阶段赋值且之后保持不变的私有成员应声明为 readonly。\n\t\"@typescript-eslint/prefer-readonly\": \"error\",\n\t// 原始类型的 || 与 ?? 可能承载不同业务语义,不为了风格强制互换。\n\t\"@typescript-eslint/prefer-nullish-coalescing\": [\"error\", { ignorePrimitives: true }],\n\t// 参数名称或独立 JSDoc 属于公共重载契约;仅合并真正重复的签名。\n\t\"@typescript-eslint/unified-signatures\": [\n\t\t\"error\",\n\t\t{\n\t\t\tignoreDifferentlyNamedParameters: true,\n\t\t\tignoreOverloadsWithDifferentJSDoc: true,\n\t\t},\n\t],\n\t// 联合类型和枚举新增成员时,switch 必须覆盖全部分支或显式提供 default。\n\t\"@typescript-eslint/switch-exhaustiveness-check\": \"error\",\n\t// 允许透明转发外部 Promise 的未知拒绝原因;静态可知的 string、number 等仍会被报告。\n\t\"@typescript-eslint/prefer-promise-reject-errors\": [\"error\", { allowThrowingUnknown: true }],\n} satisfies RuleOptions;\n"],"mappings":";;;;;;;;AASA,MAAa,kBAAkB;CAE9B,WAAW;CAEX,oDAAoD,CAAC,SAAS;EAAE,kBAAkB;EAAM,+BAA+B;CAAK,CAAC;CAE7H,qDAAqD,CAAC,SAAS,EAAE,oCAAoC,MAAM,CAAC;CAE5G,mCAAmC;CAEnC,qCAAqC,CACpC,SACA;EACC,MAAM;EACN,mBAAmB;EACnB,cAAc;EACd,2BAA2B;EAC3B,oBAAoB;CACrB,CACD;CAEA,mCAAmC;CAEnC,sCAAsC;CAEtC,yCAAyC;CAEzC,wCAAwC,CAAC,SAAS,EAAE,OAAO,CAAC,gBAAgB,iBAAiB,EAAE,CAAC;CAEhG,4CAA4C,CAC3C,SACA;EACC,mBAAmB;EACnB,cAAc;CACf,CACD;CAEA,0CAA0C;CAE1C,4CAA4C;CAE5C,0DAA0D;CAE1D,8CAA8C,CAC7C,SACA;EACC,yBAAyB;EACzB,UAAU;EACV,QAAQ;CACT,CACD;CAEA,kDAAkD;AACnD;;AAGA,MAAa,6BAA6B;CAEzC,2CAA2C;CAE3C,yCAAyC;CAEzC,mDAAmD;CAEnD,mDAAmD,CAAC,SAAS,EAAE,sBAAsB,KAAK,CAAC;CAE3F,oDAAoD,CAAC,SAAS,EAAE,aAAa,KAAK,CAAC;CAEnF,wCAAwC;CAExC,0CAA0C;CAE1C,oCAAoC;CAEpC,+CAA+C;CAE/C,kDAAkD;CAClD,sDAAsD;CACtD,mDAAmD;CACnD,yCAAyC;CAEzC,8CAA8C;CAE9C,sCAAsC;CAEtC,gDAAgD,CAAC,SAAS,EAAE,kBAAkB,KAAK,CAAC;CAEpF,yCAAyC,CACxC,SACA;EACC,kCAAkC;EAClC,mCAAmC;CACpC,CACD;CAEA,kDAAkD;CAElD,mDAAmD,CAAC,SAAS,EAAE,sBAAsB,KAAK,CAAC;AAC5F"}
@@ -15,6 +15,8 @@ export declare const vueRules: {
15
15
  "vue/attribute-hyphenation": ["error", "always"];
16
16
  "vue/no-dupe-keys": "error";
17
17
  "vue/no-mutating-props": "error";
18
+ "vue/no-setup-props-reactivity-loss": "error";
19
+ "vue/no-ref-object-reactivity-loss": "error";
18
20
  "vue/no-reserved-component-names": "error";
19
21
  "vue/no-v-text-v-html-on-component": "error";
20
22
  "vue/custom-event-name-casing": ["error", "camelCase"];
@@ -15,6 +15,8 @@ const vueRules = {
15
15
  "vue/attribute-hyphenation": ["error", "always"],
16
16
  "vue/no-dupe-keys": "error",
17
17
  "vue/no-mutating-props": "error",
18
+ "vue/no-setup-props-reactivity-loss": "error",
19
+ "vue/no-ref-object-reactivity-loss": "error",
18
20
  "vue/no-reserved-component-names": "error",
19
21
  "vue/no-v-text-v-html-on-component": "error",
20
22
  "vue/custom-event-name-casing": ["error", "camelCase"],
@@ -1 +1 @@
1
- {"version":3,"file":"vue.mjs","names":[],"sources":["../../src/rules/vue.ts"],"sourcesContent":["import type { RuleOptions } from \"../typegen\";\n\n/**\n * Vue SFC 本地覆写规则。\n *\n * @remarks\n * 上游 `flat/recommended` 负责 Vue 3 正确性与模板约定;本记录补充事件、属性命名和\n * 闭合标签规则。Vue Web、Admin 与 UniApp 使用同一套严重级别。\n */\nexport const vueRules = {\n\t// v-html 可能引入 XSS;保留警告以兼容经过净化的富文本场景。\n\t\"vue/no-v-html\": \"warn\",\n\t// [默认关闭] TypeScript 类型 props 和 required 声明已能表达可选性,不强制每个可选 prop 提供默认值。\n\t\"vue/require-default-prop\": \"off\",\n\t// 组件对外事件必须通过 emits 显式声明,使事件 API 可检查,并避免事件名拼写错误被静默透传。\n\t\"vue/require-explicit-emits\": \"error\",\n\t// [默认关闭] 允许 App、Layout 等约定俗成的单词组件名。\n\t\"vue/multi-word-component-names\": \"off\",\n\t// 允许直接使用 Vue 子包入口,兼容编译器与运行时等明确子模块导入。\n\t\"vue/prefer-import-from-vue\": \"off\",\n\t// 自定义组件的模板属性统一使用 kebab-case;脚本中的 Props 声明仍使用 camelCase。\n\t\"vue/attribute-hyphenation\": [\"error\", \"always\"],\n\n\t// props、data、computed、methods 等选项中禁止同名键,避免成员互相遮蔽或解析到错误来源。\n\t\"vue/no-dupe-keys\": \"error\",\n\t// Props 属于父组件传入的只读数据,子组件应通过 emit 或本地状态更新,不能直接修改。\n\t\"vue/no-mutating-props\": \"error\",\n\t// 组件名不能占用 Vue 内置组件或平台保留名称,避免模板解析与运行时组件发生冲突。\n\t\"vue/no-reserved-component-names\": \"error\",\n\t// 禁止在组件节点使用 v-text/v-html,避免覆盖组件内容并模糊数据边界。\n\t\"vue/no-v-text-v-html-on-component\": \"error\",\n\t// emit、emits 和事件处理引用中的自定义事件名称统一使用 camelCase,原生 DOM 事件不受影响。\n\t\"vue/custom-event-name-casing\": [\"error\", \"camelCase\"],\n\t// [默认关闭] 允许在一个 SFC 中声明仅供当前文件使用的小型辅助组件。\n\t\"vue/one-component-per-file\": \"off\",\n\t// 多行标签的闭合括号独占一行,单行标签保持同行。\n\t\"vue/html-closing-bracket-newline\": [\"error\", { multiline: \"always\", singleline: \"never\" }],\n\t// 模板属性按定义、循环、条件、修饰、普通属性、事件和内容等语义分组并保持稳定顺序。\n\t\"vue/attributes-order\": [\n\t\t\"error\",\n\t\t{\n\t\t\torder: [\"DEFINITION\", \"LIST_RENDERING\", \"CONDITIONALS\", \"RENDER_MODIFIERS\", \"GLOBAL\", \"UNIQUE\", \"OTHER_ATTR\", \"EVENTS\", \"CONTENT\"],\n\t\t},\n\t],\n} satisfies RuleOptions;\n"],"mappings":";;;;;;;;AASA,MAAa,WAAW;CAEvB,iBAAiB;CAEjB,4BAA4B;CAE5B,8BAA8B;CAE9B,kCAAkC;CAElC,8BAA8B;CAE9B,6BAA6B,CAAC,SAAS,QAAQ;CAG/C,oBAAoB;CAEpB,yBAAyB;CAEzB,mCAAmC;CAEnC,qCAAqC;CAErC,gCAAgC,CAAC,SAAS,WAAW;CAErD,8BAA8B;CAE9B,oCAAoC,CAAC,SAAS;EAAE,WAAW;EAAU,YAAY;CAAQ,CAAC;CAE1F,wBAAwB,CACvB,SACA,EACC,OAAO;EAAC;EAAc;EAAkB;EAAgB;EAAoB;EAAU;EAAU;EAAc;EAAU;CAAS,EAClI,CACD;AACD"}
1
+ {"version":3,"file":"vue.mjs","names":[],"sources":["../../src/rules/vue.ts"],"sourcesContent":["import type { RuleOptions } from \"../typegen\";\n\n/**\n * Vue SFC 本地覆写规则。\n *\n * @remarks\n * 上游 `flat/recommended` 负责 Vue 3 正确性与模板约定;本记录补充事件、属性命名和\n * 闭合标签规则。Vue Web、Admin 与 UniApp 使用同一套严重级别。\n */\nexport const vueRules = {\n\t// v-html 可能引入 XSS;保留警告以兼容经过净化的富文本场景。\n\t\"vue/no-v-html\": \"warn\",\n\t// [默认关闭] TypeScript 类型 props 和 required 声明已能表达可选性,不强制每个可选 prop 提供默认值。\n\t\"vue/require-default-prop\": \"off\",\n\t// 组件对外事件必须通过 emits 显式声明,使事件 API 可检查,并避免事件名拼写错误被静默透传。\n\t\"vue/require-explicit-emits\": \"error\",\n\t// [默认关闭] 允许 App、Layout 等约定俗成的单词组件名。\n\t\"vue/multi-word-component-names\": \"off\",\n\t// 允许直接使用 Vue 子包入口,兼容编译器与运行时等明确子模块导入。\n\t\"vue/prefer-import-from-vue\": \"off\",\n\t// 自定义组件的模板属性统一使用 kebab-case;脚本中的 Props 声明仍使用 camelCase。\n\t\"vue/attribute-hyphenation\": [\"error\", \"always\"],\n\n\t// props、data、computed、methods 等选项中禁止同名键,避免成员互相遮蔽或解析到错误来源。\n\t\"vue/no-dupe-keys\": \"error\",\n\t// Props 属于父组件传入的只读数据,子组件应通过 emit 或本地状态更新,不能直接修改。\n\t\"vue/no-mutating-props\": \"error\",\n\t// setup 中直接解构 props 会丢失响应性,要求保留 props 引用或使用 toRefs 等响应式转换。\n\t\"vue/no-setup-props-reactivity-loss\": \"error\",\n\t// 禁止以会丢失响应性的方式解构或传递 ref 对象,确保后续更新仍能被 Vue 追踪。\n\t\"vue/no-ref-object-reactivity-loss\": \"error\",\n\t// 组件名不能占用 Vue 内置组件或平台保留名称,避免模板解析与运行时组件发生冲突。\n\t\"vue/no-reserved-component-names\": \"error\",\n\t// 禁止在组件节点使用 v-text/v-html,避免覆盖组件内容并模糊数据边界。\n\t\"vue/no-v-text-v-html-on-component\": \"error\",\n\t// emit、emits 和事件处理引用中的自定义事件名称统一使用 camelCase,原生 DOM 事件不受影响。\n\t\"vue/custom-event-name-casing\": [\"error\", \"camelCase\"],\n\t// [默认关闭] 允许在一个 SFC 中声明仅供当前文件使用的小型辅助组件。\n\t\"vue/one-component-per-file\": \"off\",\n\t// 多行标签的闭合括号独占一行,单行标签保持同行。\n\t\"vue/html-closing-bracket-newline\": [\"error\", { multiline: \"always\", singleline: \"never\" }],\n\t// 模板属性按定义、循环、条件、修饰、普通属性、事件和内容等语义分组并保持稳定顺序。\n\t\"vue/attributes-order\": [\n\t\t\"error\",\n\t\t{\n\t\t\torder: [\"DEFINITION\", \"LIST_RENDERING\", \"CONDITIONALS\", \"RENDER_MODIFIERS\", \"GLOBAL\", \"UNIQUE\", \"OTHER_ATTR\", \"EVENTS\", \"CONTENT\"],\n\t\t},\n\t],\n} satisfies RuleOptions;\n"],"mappings":";;;;;;;;AASA,MAAa,WAAW;CAEvB,iBAAiB;CAEjB,4BAA4B;CAE5B,8BAA8B;CAE9B,kCAAkC;CAElC,8BAA8B;CAE9B,6BAA6B,CAAC,SAAS,QAAQ;CAG/C,oBAAoB;CAEpB,yBAAyB;CAEzB,sCAAsC;CAEtC,qCAAqC;CAErC,mCAAmC;CAEnC,qCAAqC;CAErC,gCAAgC,CAAC,SAAS,WAAW;CAErD,8BAA8B;CAE9B,oCAAoC,CAAC,SAAS;EAAE,WAAW;EAAU,YAAY;CAAQ,CAAC;CAE1F,wBAAwB,CACvB,SACA,EACC,OAAO;EAAC;EAAc;EAAkB;EAAgB;EAAoB;EAAU;EAAU;EAAc;EAAU;CAAS,EAClI,CACD;AACD"}
@@ -1,6 +1,6 @@
1
1
  # Default Rules and Risk Guide
2
2
 
3
- This document describes the current 2.1.6 configuration model, major rules, and migration risks. Source comments explain current intent only; historical changes belong in `CHANGELOG.md`.
3
+ This document describes the current 2.1.7 configuration model, major rules, and migration risks. Source comments explain current intent only; historical changes belong in `CHANGELOG.md`.
4
4
 
5
5
  ## Configuration model
6
6
 
@@ -51,18 +51,19 @@ The root entry is a fixed Vue 3 + TypeScript + UniApp preset:
51
51
  ### TypeScript
52
52
 
53
53
  - `strictTypeChecked`, `stylisticTypeChecked`, and `projectService: true` are always enabled; TypeScript, TSX, Vue, and NVue share `extraFileExtensions: [".vue", ".nvue"]` to prevent Project Service reloads during mixed-file linting.
54
- - `no-floating-promises` and `strict-void-return` are disabled so Promise waiting follows business semantics; `no-void` rejects `void promise` workarounds. `no-misused-promises`, `await-thenable`, `require-await`, and the unsafe-type rules remain strict.
54
+ - `no-floating-promises` and `strict-void-return` are disabled so Promise waiting follows business semantics; `no-void` rejects `void promise` workarounds. `no-misused-promises`, `await-thenable`, `require-await`, and the unsafe-type rules remain strict, while Promise-returning handlers are allowed in Vue templates and TSX attributes.
55
55
  - Named TypeScript and TSX functions require explicit return types, except inline callbacks and already typed function expressions; exported module boundaries still require explicit types.
56
56
  - Vue/NVue SFCs disable function-return and module-boundary annotations and unused parameter checks, while unused variables and imports remain errors. Templates do not infer parameter types back into standalone script handlers, so those parameters still require explicit annotations.
57
57
  - `explicit-module-boundary-types` is an error and does not allow explicitly typed `any` arguments as an escape hatch.
58
58
  - `no-explicit-any` warns.
59
59
  - Regular TS/TSX parameters and caught errors can use an `_` prefix to mark intentional omissions; ordinary variables cannot use that prefix to evade the check.
60
60
  - `no-empty-function` only allows empty constructors and override methods.
61
- - `consistent-type-imports` fixes type-only dependencies as separate `import type` declarations.
61
+ - `consistent-type-imports` fixes type-only dependencies as separate `import type` declarations, and `no-import-type-side-effects` rejects runtime imports containing only inline type specifiers.
62
62
  - `no-non-null-assertion` is an error.
63
63
  - `switch-exhaustiveness-check` is an error; `no-deprecated` and `no-unnecessary-condition` warn.
64
64
  - Numeric template interpolation and concise void arrow callbacks are allowed; dynamic object deletion and static-only utility classes are not forcibly rewritten.
65
65
  - `consistent-type-exports` and `prefer-readonly` are errors; primitive values are not forced from `||` to `??`.
66
+ - `no-eval`, `no-implied-eval`, and `no-new-func` reject direct or indirect dynamic string execution; `no-promise-executor-return` rejects ignored executor returns, and Vue setup props or refs cannot be used in ways that lose reactivity.
66
67
  - `unified-signatures` preserves public overloads with different parameter names or standalone JSDoc; the stricter core `no-void` replaces `no-meaningless-void-operator`.
67
68
  - `consistent-type-definitions`, `consistent-indexed-object-style`, `class-literal-property-style`, and `prefer-regexp-exec` are disabled as syntax-only preferences.
68
69
 
@@ -1,6 +1,6 @@
1
1
  # 默认规则与风险指南
2
2
 
3
- 本文说明 2.1.6 当前配置模型、主要规则和迁移风险。规则源码注释只解释现行意图;历史差异统一记录在 `CHANGELOG.md`。
3
+ 本文说明 2.1.7 当前配置模型、主要规则和迁移风险。规则源码注释只解释现行意图;历史差异统一记录在 `CHANGELOG.md`。
4
4
 
5
5
  ## 配置模型
6
6
 
@@ -51,18 +51,19 @@ SDK、OA、Admin、Vue Web 与 UniApp 客户端共享同一套 JavaScript、Type
51
51
  ### TypeScript
52
52
 
53
53
  - 始终启用 `strictTypeChecked`、`stylisticTypeChecked` 与 `projectService: true`;TypeScript、TSX、Vue 与 NVue 统一使用 `extraFileExtensions: [".vue", ".nvue"]`,避免混合检查时 Project Service 重载项目。
54
- - `no-floating-promises` 与 `strict-void-return` 关闭,Promise 是否等待由业务语义决定;`no-void` 禁止用 `void promise` 规避检查。`no-misused-promises`、`await-thenable`、`require-await` 和 unsafe 类型规则保持严格。
54
+ - `no-floating-promises` 与 `strict-void-return` 关闭,Promise 是否等待由业务语义决定;`no-void` 禁止用 `void promise` 规避检查。`no-misused-promises`、`await-thenable`、`require-await` 和 unsafe 类型规则保持严格,但 Vue 模板与 TSX 属性允许 Promise 返回的事件处理函数。
55
55
  - TypeScript 与 TSX 的命名函数要求显式返回类型,内联回调和已有函数类型约束的表达式除外;模块导出边界仍要求显式类型。
56
56
  - Vue/NVue SFC 关闭函数返回类型与模块边界类型要求,并关闭形参和 catch 形参的未使用检查;普通未使用变量和导入仍报错。模板不会反向推断独立处理函数的参数类型,这类参数仍需显式标注。
57
57
  - `explicit-module-boundary-types` 为 `error`,模块导出边界必须显式声明类型,不允许用显式 `any` 参数规避。
58
58
  - `no-explicit-any` 为 `warn`。
59
59
  - 普通 TS/TSX 的未使用参数和异常可用 `_` 前缀明确忽略;未使用普通变量不能用该前缀规避。
60
60
  - `no-empty-function` 仅允许空构造函数和空覆写方法。
61
- - `consistent-type-imports` 使用独立 `import type` 修复形式。
61
+ - `consistent-type-imports` 使用独立 `import type` 修复形式,`no-import-type-side-effects` 禁止仅含内联类型说明符的运行时导入。
62
62
  - `no-non-null-assertion` 为 `error`。
63
63
  - `switch-exhaustiveness-check` 为 `error`;`no-deprecated` 与 `no-unnecessary-condition` 为 `warn`。
64
64
  - 模板字符串允许数字插值,箭头简写允许直接返回 void;动态对象字段删除和纯静态工具类不强制改写。
65
65
  - `consistent-type-exports` 与 `prefer-readonly` 为 `error`;原始类型不强制将 `||` 改成 `??`。
66
+ - `no-eval`、`no-implied-eval` 与 `no-new-func` 禁止直接或间接动态执行字符串代码;`no-promise-executor-return` 禁止误用 Promise executor 返回值;Vue setup props 和 ref 禁止以丢失响应性的方式使用。
66
67
  - `unified-signatures` 保留参数名不同或具有独立 JSDoc 的公共重载;`no-meaningless-void-operator` 由更严格的核心 `no-void` 替代。
67
68
  - `consistent-type-definitions`、`consistent-indexed-object-style`、`class-literal-property-style`、`prefer-regexp-exec` 关闭,避免纯语法偏好阻断构建。
68
69
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fast-china/eslint-config",
3
- "version": "2.1.6",
3
+ "version": "2.1.7",
4
4
  "description": "Practical, typed ESLint Flat Config for Vue 3, UniApp, React, Angular, Vite, TypeScript, JavaScript, and Node.js.",
5
5
  "type": "module",
6
6
  "keywords": [