@ flexent/ slint- config
用于 Flexent 项目的共享 ESLint 配置: TypeScript, styllistic 规则,导入顺序,以及 方法 指针可以检查.
使用量
// eslint.config.mjs
import { restrictImports, sharedConfigs } from '@flexent/eslint-config';
import { vueConfigs } from '@flexent/eslint-config-vue';
export default [
...sharedConfigs,
...vueConfigs,
restrictImports({
files: ['apps/site/{pages,views,components,managers}/**/*.{vue,ts}'],
packages: ['three', 'manifold-3d'],
message: 'Import from a lazily loaded module under scenes/.',
}),
];
方法规则
| 规则 | 它检查什么 |
|---|---|
flexent/module-kind | A 类 PascalCase.ts 模块是一个类模块:没有顶级函数,还有一个以文件命名的类(错误类可能伴随它). kebab-case模块是一个帮助模块:只有函数,没有类. index, (中文(简体) ), types, (中文(简体) ), constants, (中文(简体) ), errors, (中文(简体) ), main, (中文(简体) ), entrypoint 财务报告和审定财务报表 cli 模块适合任何地方。 考证可免. |
flexent/static-members | 静态方法和字段仅被命名为构造器: create 财务报告和审定财务报表 decode 默认,或名称在 { allow: [...] }。 。 。 . XCatalog 课程是免除的。 静态区块绝不允许。 考证可免. |
flexent/max-params | 每个函数或方法最多四个参数;通过这个参数,是一个选项对象。 装饰参数和一个类型脚本 this 不要数. |
flexent/catch-error | 渔获条款具有约束力 catch (error: any),或者无(catch {}),适用于TypeScript,包括测试. |
no-restricted-globals, (中文(简体) ), no-restricted-properties | 无直接 localStorage 或者说 sessionStorage。浏览器存储通过一个 storage.ts 帮助模块,可以免用 . |
restrictImports() | 将重运行时包保存出列出的文件,所以它们只能通过懒散块到达. |
vue/component-api-style (单位:千美元) @flexent/eslint-config-vue(中文(简体) ) | 只有 API 选项:没有 <script setup>没有组成API. |
vue/no-side-effects-in-computed-properties (单位:千美元) @flexent/eslint-config-vue(中文(简体) ) | 计算属性从未指定 . |
其余的配置执行房屋风格: 四空间缩进,单引出,排序导入, curly,方法长度(50行),块内无空白行,不 as const 或者说 satisfies,没有 .forEach 或者说 .reduce 循环.