Skip to content

Commit

Permalink
feat: add linters and other config
Browse files Browse the repository at this point in the history
add eslint, prettier, commitlint, husky, std-vs; update package.json scripts

closes #2
  • Loading branch information
Hagop Taminian committed Sep 18, 2020
1 parent fba9fba commit a65d743
Show file tree
Hide file tree
Showing 12 changed files with 1,613 additions and 49 deletions.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build
public
coverage
src/serviceWorker.js
cypress/integration/examples
51 changes: 51 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"extends": ["react-app", "airbnb", "prettier"],
"plugins": ["import", "jsx-a11y", "react"],
"env": {
"browser": true,
"node": true,
"mocha": true,
"jest": true
},
"globals": {
"cy": true,
"Cypress": true
},
"parser": "babel-eslint",
"rules": {
"no-underscore-dangle": [
"error",
{
"allow": ["_id", "__REDUX_DEVTOOLS_EXTENSION__"]
}
],
"jsx-a11y/anchor-is-valid": [
"error",
{
"components": ["Link"],
"specialLink": ["to", "hrefLeft", "hrefRight"],
"aspects": ["noHref", "invalidHref", "preferButton"]
}
],
"react/jsx-filename-extension": [
1,
{
"extensions": [".js", ".jsx"]
}
],
"import/no-named-as-default": 0,
"react/static-property-placement": [
"error",
"property assignment",
{
"childContextTypes": "static public field",
"contextTypes": "static public field",
"contextType": "static public field",
"defaultProps": "static public field",
"displayName": "static public field",
"propTypes": "static public field"
}
],
"react/state-in-constructor": ["error", "never"]
}
}
10 changes: 10 additions & 0 deletions .huskyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"post-checkout": "yarn install",
"pre-commit": "pretty-quick --staged && yarn lint",
"post-commit": "git status",
"post-merge": "yarn install",
"pre-push": "yarn lint && yarn test:once && yarn build"
}
}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "all",
"tabWidth": 2,
"semi": true,
"singleQuote": true
}
34 changes: 34 additions & 0 deletions .versionrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "test",
"section": "Tests"
},
{
"type": "build",
"section": "Build System"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "ci",
"section": "Continuous Integration"
},
{
"type": "chore",
"section": "Chores",
"hidden": true
}
]
}

1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
21 changes: 20 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"lint": "eslint .",
"prettier:check": "prettier --check 'src/**/*.js'",
"prettier:write": "prettier --write 'src/**/*.js'",
"hooks:uninstall": "node node_modules/husky/husky.js uninstall",
"hooks:install": "node node_modules/husky/husky.js install"
},
"eslintConfig": {
"extends": "react-app"
Expand All @@ -30,5 +35,19 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@commitlint/cli": "11.0.0",
"@commitlint/config-conventional": "11.0.0",
"eslint-config-airbnb": "18.2.0",
"eslint-config-prettier": "6.11.0",
"eslint-plugin-import": "2.22.0",
"eslint-plugin-jsx-a11y": "6.3.1",
"eslint-plugin-react": "7.20.6",
"husky": "4.3.0",
"prettier": "2.1.2",
"pretty-quick": "3.0.2",
"standard-version": "9.0.0",
"typescript": "4.0.2"
}
}
4 changes: 3 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ function App() {
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
Edit
<code>src/App.js</code>
and save to reload.
</p>
<a
className="App-link"
Expand Down
9 changes: 0 additions & 9 deletions src/App.test.js

This file was deleted.

5 changes: 0 additions & 5 deletions src/setupTests.js

This file was deleted.

Loading

0 comments on commit a65d743

Please sign in to comment.