Created
September 19, 2019 15:37
-
-
Save csandman/1eef21d8a85df64e5084a1de2e8b26df to your computer and use it in GitHub Desktop.
Eslint and Prettier package.json config with git hooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "eslint-prettier-demo", | |
"version": "0.1.0", | |
"private": true, | |
"dependencies": { | |
"react": "^16.9.0", | |
"react-dom": "^16.9.0", | |
"react-scripts": "3.1.1" | |
}, | |
"scripts": { | |
"start": "react-scripts start", | |
"build": "react-scripts build", | |
"test": "react-scripts test", | |
"eject": "react-scripts eject", | |
"prettify": "prettier --write \"**/*.*(js|s?css)\"" | |
}, | |
"eslintConfig": { | |
"extends": [ | |
"react-app", | |
"airbnb", | |
"prettier", | |
"prettier/react" | |
], | |
"plugins": [ | |
"prettier" | |
], | |
"rules": { | |
"react/jsx-filename-extension": [ | |
1, | |
{ | |
"extensions": [ | |
".js", | |
".jsx" | |
] | |
} | |
], | |
"react/prop-types": 0, | |
"no-underscore-dangle": 0, | |
"import/imports-first": [ | |
"error", | |
"absolute-first" | |
], | |
"import/newline-after-import": "error" | |
}, | |
"globals": { | |
"window": true, | |
"document": true, | |
"localStorage": true, | |
"FormData": true, | |
"FileReader": true, | |
"Blob": true, | |
"navigator": true | |
}, | |
"parser": "babel-eslint" | |
}, | |
"browserslist": { | |
"production": [ | |
">0.2%", | |
"not dead", | |
"not op_mini all" | |
], | |
"development": [ | |
"last 1 chrome version", | |
"last 1 firefox version", | |
"last 1 safari version" | |
] | |
}, | |
"devDependencies": { | |
"eslint": "^6.4.0", | |
"eslint-config-airbnb": "^18.0.1", | |
"eslint-config-prettier": "^6.3.0", | |
"eslint-plugin-import": "^2.18.2", | |
"eslint-plugin-jsx-a11y": "^6.2.3", | |
"eslint-plugin-prettier": "^3.1.1", | |
"eslint-plugin-react": "^7.14.3", | |
"husky": "^3.0.5", | |
"lint-staged": "^9.2.5", | |
"prettier": "^1.18.2", | |
"pretty-quick": "^1.11.1" | |
}, | |
"prettier": { | |
"tabWidth": 4, | |
"singleQuote": true | |
}, | |
"husky": { | |
"hooks": { | |
"pre-commit": "lint-staged" | |
} | |
}, | |
"lint-staged": { | |
"*.{css,scss,less,json,ts}": [ | |
"pretty-quick --staged", | |
"git add" | |
], | |
"*.{js,jsx}": [ | |
"pretty-quick --staged", | |
"eslint src/ --fix", | |
"git add" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment