简体   繁体   中英

How to add custom lint rules in create-react-app without ejecting the boilerplate?

I'm trying to add custom lint rules on top of the lint rules that come out of the box with create-react-app. Doing so throws error about versioning issue of certain lint packages while running the build.

Create new files .eslintrc and add following code. You can customize the rules as required.

 { "extends": ["equimper", "prettier"], "plugins": ["prettier"], "rules": { "prettier/prettier": "error", "experimentalDecorators":"true" } } 

Also add following packages as dev depencency. You can modify as required. * will install latest version in this case.

  "devDependencies": { "eslint": "*", "eslint-config-equimper": "*", "eslint-config-prettier": "*", "eslint-plugin-prettier": "*", "prettier": "*" } 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM