埃斯林特- 配置- aiven
我们的内部ESLint和更漂亮的配置。 我们想要像更美的一样自动格式化代码, 但也做更多的静态检查,像斯林那样。 为了做到两者,我们用 埃斯林特- 插孔- prettier 和 eslint 充当检查和自动固定样式以及其他问题的前端.
配置分为:
@aivenio/eslint-config-aiven- 为 TypeScript 推荐的基础配置 .
@aivenio/eslint-config-aiven/react- 基数 + 反应加分.
@aivenio/eslint-config-aiven/typescript-type-checked- 需要的基数+ TS 规则 已键入
使用量
安装建议的基础
-
npm install @aivenio/eslint-config-aiven -
创建一个
eslint.config.js文件中的文件,并选择要使用的配置 :
import baseConfig from '@aivenio/eslint-config-aiven';
import { defineConfig } from 'eslint/config';
export default defineConfig(baseConfig, { /* further configuration */ });
// Or choose one of the variants:
// import reactConfig from '@aivenio/eslint-config-aiven/react';
// import typeCheckedConfig from '@aivenio/eslint-config-aiven/typescript-type-checked';
// export default defineConfig(reactConfig, typeCheckedConfig, { /* further configuration */ });
使用时 eslint-config-aiven/react,安装所需的对等依赖: eslint-plugin-react, (中文(简体) ), eslint-plugin-react-hooks 财务报告和审定财务报表 eslint-plugin-jsx-a11y。 。 。 .
- 在 package.json 中设置 npm 脚本
"eslint:fix": "eslint --fix \"src/**/*.{ts,tsx}\"",
"eslint:check": "eslint \"src/**/*.{ts,tsx}\"",
- 记住设置一个 CI 任务来插入源代码 。 见 .github/工作流程/测试.yml 用于GH动作实例.
安装用于反应
-
首先在“安装推荐基地”中遵循所有步骤
-
安装额外的同伴依赖关系
npm i --save-dev eslint-plugin-jsx-a11y
npm i --save-dev eslint-plugin-react
- 改变
eslint.config.js在您的仓库中设置以下内容:
import reactConfig from '@aivenio/eslint-config-aiven/react';
import { defineConfig } from 'eslint/config';
export default defineConfig(reactConfig, { /* further configuration */ });
发展
如何创建新版本
当地:
-
运行
npm run release -- --bump <bump>(所有破折号都需要) 撞伤是其中之一major, (中文(简体) ),minor或者说patch。 。 。 .此命令将自动检查一个发布分支, 输入版本突起, 并打开您的浏览器提交 PR .
-
审查创建的公关,并合并到主机上. GH动作会处理其余的.