# max-eslint-config-react **Repository Path**: max-lu/max-eslint-config-react ## Basic Information - **Project Name**: max-eslint-config-react - **Description**: 一套React的eslint规范 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-04-13 - **Last Updated**: 2022-05-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: eslint规范 ## README # eslint rules ## Usage: - 在项目中的 .eslintrc.js ```js module.exports = { root: true, parser: '@typescript-eslint/parser', parserOptions: { tsconfigRootDir: __dirname, project: ['./tsconfig.json'], }, extends: [ "./eslint-config" ], plugins: [ ], rules: { }, }; ``` ## TODO * [ ] 自定义 eslint rules ## 注意 tslint已弃用 # 强烈建议 > 每个人在自己的工程中配置 pre-commit 钩子,在提交代码之前进行检查 * [husky](https://github.com/typicode/husky) 用 node 配置钩子 * [lint-staged](https://github.com/okonet/lint-staged) 只检查将要提交的代码 * [commitlint](https://github.com/marionebl/commitlint) 检查 commit 规范 配置完后类似于以下这个样子 ```json "husky": { "hooks": { "pre-commit": "lint-staged", "commit-msg": "commitlint -e $GIT_PARAMS" } }, "commitlint": { "extends": ["@commitlint/config-conventional"] }, "lint-staged": { "*.{ts,tsx}": [ "tslint -p . --fix", "git add" ] }, ```