Set of modern JS for React and React Native formatting guides, using ESLint and Prettier.
Install packages
npm install --dev prettier-config-nure eslint-config nure lint-staged husky
Create a .eslintrc.json
file with the following contents
{
"extends": ["eslint-config-nure"]
}
Next create a .prettierrc.js
file with the following contents
module.exports = {
...require("prettier-config-nure")
};
And finally add the following lines to your package.json
file, if you want to ensure no rules are being ignored using lint-staged (optional).
"name": "My project",
"version": "0.1.0",
"scripts": {
...
},
+ "husky": {
+ "hooks": {
+ "pre-commit": "lint-staged"
+ }
+ },
+ "lint-staged": {
+ "*.{js,jsx}": "eslint --fix",
+ "*.{js,jsx,ts,tsx,md,html,css}": "prettier --write"
+ }
This package includes a ESLint configuration that extends eslint-config-react-app
and adds some extra rules
Prettier configuration compatible with eslint-config-nure
MIT