Skip to content

Commit d39fd81

Browse files
committed
Add and configure prettier with pre-commit hook
1 parent da0a79c commit d39fd81

File tree

4 files changed

+81
-14
lines changed

4 files changed

+81
-14
lines changed

.eslintrc.js

+16-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
module.exports = {
2-
extends: "airbnb",
3-
parser: "babel-eslint",
2+
extends: ['airbnb', 'prettier'],
3+
parser: 'babel-eslint',
4+
plugins: ['prettier'],
45
env: {
56
browser: true,
67
es6: true,
78
jest: true
89
},
910
rules: {
10-
"import/no-extraneous-dependencies": ["error", { devDependencies: true }],
11-
"react/jsx-filename-extension": [1, { extensions: [".js", ".jsx"] }],
12-
"jsx-a11y/label-has-associated-control": [ "error", {
13-
"required": {
14-
"some": [ "nesting", "id" ]
11+
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
12+
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
13+
'jsx-a11y/label-has-associated-control': [
14+
'error',
15+
{
16+
required: {
17+
some: ['nesting', 'id']
18+
}
1519
}
16-
}],
17-
"jsx-a11y/label-has-associated-control": ["error", { assert: "either" } ],
18-
"jsx-a11y/label-has-for": 'off'
20+
],
21+
'jsx-a11y/label-has-associated-control': ['error', { assert: 'either' }],
22+
'jsx-a11y/label-has-for': 'off',
23+
'prettier/prettier': 'error'
1924
}
20-
}
25+
};

.prettierrc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"arrowParens": "avoid",
3+
"bracketSpacing": true,
4+
"htmlWhitespaceSensitivity": "css",
5+
"insertPragma": false,
6+
"jsxBracketSameLine": false,
7+
"jsxSingleQuote": true,
8+
"printWidth": 80,
9+
"proseWrap": "preserve",
10+
"quoteProps": "as-needed",
11+
"requirePragma": false,
12+
"semi": true,
13+
"singleQuote": true,
14+
"tabWidth": 2,
15+
"trailingComma": "none",
16+
"useTabs": false
17+
}

package-lock.json

+44-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,16 @@
6262
"cross-env": "^5.2.0",
6363
"eslint": "^5.16.0",
6464
"eslint-config-airbnb": "^17.1.1",
65+
"eslint-config-prettier": "^6.0.0",
6566
"eslint-plugin-import": "^2.18.2",
6667
"eslint-plugin-jsx-a11y": "^6.2.3",
68+
"eslint-plugin-prettier": "^3.1.0",
6769
"eslint-plugin-react": "^7.14.3",
6870
"husky": "^3.0.1",
6971
"jest": "^24.8.0",
7072
"jest-styled-components": "^6.3.3",
7173
"lint-staged": "^9.2.1",
74+
"prettier": "1.18.2",
7275
"prop-types": "^15.7.2",
7376
"react": "^16.8.2",
7477
"react-dom": "^16.8.2",
@@ -90,6 +93,7 @@
9093
"lint-staged": {
9194
"*.js": [
9295
"eslint --fix",
96+
"prettier --write",
9397
"git add"
9498
]
9599
}

0 commit comments

Comments
 (0)