Skip to content

Commit

Permalink
feat: Run Prettier, tests and lints only on staged commits
Browse files Browse the repository at this point in the history
  • Loading branch information
one-aalam committed Apr 5, 2020
1 parent bb43044 commit 2770d84
Show file tree
Hide file tree
Showing 5 changed files with 295 additions and 20 deletions.
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
language: node_js
node_js:
- 10.16.1
- 10.16.1
cache:
directories:
directories:
- node_modules
script:
- yarn
- yarn tslint
- yarn build
- yarn
- yarn tslint
- yarn test:ci
- yarn build
14 changes: 7 additions & 7 deletions config/jest/cssTransform.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module.exports = {
process() {
return 'module.exports = {};'
},
getCacheKey() {
return 'cssTransform'
},
}
process() {
return 'module.exports = {};';
},
getCacheKey() {
return 'cssTransform';
},
};
17 changes: 16 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"husky": "^4.2.3",
"identity-obj-proxy": "^3.0.0",
"jest": "^25.2.7",
"lint-staged": "^10.1.2",
"prettier": "^2.0.2",
"react-test-renderer": "^16.13.1",
"tslint": "^6.1.1",
"tslint-config-airbnb": "^5.11.2",
Expand All @@ -40,7 +42,20 @@
},
"husky": {
"hooks": {
"pre-commit": "npm run tslint"
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.+(ts|tsx)": [
"prettier --write",
"git add",
"jest --findRelatedTests",
"tslint"
]
},
"prettier": {
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 120
}
}
6 changes: 2 additions & 4 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import Layout from '../components/layout';

export default () => (
<Layout>
<h1 className="title">{SITE_CONFIG.siteName}</h1>
<p className="description">
{SITE_CONFIG.seo.description}
</p>
<h1 className="title">{SITE_CONFIG.siteName}</h1>
<p className="description">{SITE_CONFIG.seo.description}</p>
</Layout>
);
Loading

0 comments on commit 2770d84

Please sign in to comment.