Skip to content

Instantly share code, notes, and snippets.

@VanTanev
Last active August 22, 2019 14:32
Show Gist options
  • Save VanTanev/66683d8c71e44bd0b83261fc0c2262bd to your computer and use it in GitHub Desktop.
Save VanTanev/66683d8c71e44bd0b83261fc0c2262bd to your computer and use it in GitHub Desktop.
base husky + prettier + eslintconfig
{
"extends": [
"react-app",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"prettier",
"prettier/react",
"prettier/@typescript-eslint"
],
"plugins": ["jest"]
}
{
"printWidth": 80,
"trailingComma": "all",
"tabWidth": 4,
"semi": false,
"singleQuote": true
}
module.exports = {
'*.{js,jsx,ts,tsx}': [
'eslint --max-warnings=0',
'react-scripts test --bail --watchAll=false --findRelatedTests --passWithNoTests',
() => 'tsc -p tsconfig.json --noEmit',
],
'*.{js,jsx,ts,tsx,json,css,js}': ['prettier --write', 'git add'],
}
{
"devDependencies": {
"eslint-config-prettier": "^4.3.0",
"eslint-config-react-app": "^4.0.1",
"eslint-plugin-jest": "^22.5.1",
"husky": "^2.4.1",
"lint-staged": "^8.1.7",
"prettier": "^1.17.1",
},
"scripts": {
"preinstall": "git submodule update --init --recursive || exit 0",
"lint": "eslint --max-warnings=0 src/**/*.{ts,tsx,js,jsx} && prettier --check src/**/*.{js,jsx,ts,tsx,json,css}",
"lint:fix": "eslint --fix src/**/*.{ts,tsx,js,jsx}; prettier --write src/**/*.{js,jsx,ts,tsx,json,css}"
},
"eslintConfig": {
"extends": "react-app"
},
"husky": {
"hooks": {
"post-checkout": "if echo \"$HUSKY_GIT_PARAMS\" | grep -q \"1$\"; then yarn install --frozen-lockfile; fi",
"post-merge": "yarn install --frozen-lockfile",
"post-rebase": "yarn install",
"pre-commit": "lint-staged --config lint-staged.js"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment