commit d58acd24a2e12e02bb996ab1df2f523ece660831
parent 90d8ebb321c8f7c4dd8ad3178717bd5685a2e0d8
Author: Vladimir Kutepov <frenzzy.man@gmail.com>
Date: Wed, 14 Dec 2016 15:31:21 +0300
Add pre-commit hook that automatically formats staged files
Diffstat:
4 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/.editorconfig b/.editorconfig
@@ -16,5 +16,5 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
-[*.md]
-trim_trailing_whitespace = false
+# editorconfig-tools is unable to ignore longs strings or urls
+max_line_length = null
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
@@ -3,7 +3,7 @@
React Starter Kit is currently the most widely adopted Node.js/React boilerplate used by many
tech startups around the globe. We're working hard to keep it up to date, making sure that it
follows best practices and high coding standards, paying extremely close attention to details.
-
+
Your contributions are welcome and are greatly appreciated! Every little bit helps, and credit
will always be given.
@@ -21,7 +21,7 @@ Feedback is the breakfast for champions! We'd love to hear your opinions, discus
improvements, architecture, theory, internal implementation, etc. Please, join or start a new
conversation in our [issue tracker](https://github.com/kriasoft/react-starter-kit/issues),
[Gitter](https://gitter.im/kriasoft/react-starter-kit) chat room, or let's talk face-to-face on
-[Appear.in](https://appear.in/react) or [Skype](http://hatscripts.com/addskype?koistya).
+[Appear.in](https://appear.in/react) or [Skype](http://hatscripts.com/addskype?koistya).
### Documentation
@@ -48,7 +48,7 @@ forked repo, check that it meets these guidelines:
* Create a separate PR for each small feature or bug fix.
* [Squash](http://stackoverflow.com/questions/5189560/squash-my-last-x-commits-together-using-git)
your commits into one for each PR.
-* Run `npm test` to make sure that your code style is OK and there are no any regression bugs.
+* Run `npm test` to make sure that your code style is OK and there are no any regression bugs.
* When contributing to an opt-in feature, apply the `[feature/...]` tag as a prefix to your PR title
#### Style Guide
diff --git a/LICENSE.txt b/LICENSE.txt
@@ -1,4 +1,4 @@
- The MIT License
+The MIT License
Copyright (c) 2014-2016 Konstantin Tarkus, KriaSoft LLC.
diff --git a/package.json b/package.json
@@ -56,6 +56,7 @@
"browser-sync": "^2.18.2",
"chai": "^3.5.0",
"css-loader": "^0.26.0",
+ "editorconfig-tools": "^0.1.1",
"enzyme": "^2.6.0",
"eslint": "^3.10.2",
"eslint-config-airbnb": "^13.0.0",
@@ -69,6 +70,7 @@
"git-repository": "^0.1.4",
"glob": "^7.1.1",
"json-loader": "^0.5.4",
+ "lint-staged": "^3.2.2",
"mkdirp": "^0.5.1",
"mocha": "^3.1.2",
"pixrem": "^3.0.2",
@@ -89,6 +91,7 @@
"postcss-selector-matches": "^2.0.5",
"postcss-selector-not": "^2.0.0",
"postcss-url": "^5.1.2",
+ "pre-commit": "^1.2.2",
"raw-loader": "^0.5.1",
"react-addons-test-utils": "15.4.0",
"react-deep-force-update": "^2.0.1",
@@ -96,6 +99,7 @@
"redbox-react": "^1.3.3",
"rimraf": "^2.5.4",
"sinon": "^2.0.0-pre.3",
+ "stylefmt": "^5.0.2",
"stylelint": "^7.6.0",
"stylelint-config-standard": "^15.0.0",
"url-loader": "^0.5.7",
@@ -169,9 +173,26 @@
]
}
},
+ "pre-commit": "lint:staged",
+ "lint-staged": {
+ "*": [
+ "editorconfig-tools fix",
+ "git add"
+ ],
+ "*.{js,jsx}": [
+ "eslint --fix",
+ "git add"
+ ],
+ "*.{css,less,scss,sss}": [
+ "stylefmt",
+ "stylelint",
+ "git add"
+ ]
+ },
"scripts": {
"lint:js": "eslint src tools",
"lint:css": "stylelint \"src/**/*.{css,less,scss,sss}\"",
+ "lint:staged": "lint-staged",
"lint": "npm run lint:js && npm run lint:css",
"test": "mocha \"src/**/*.test.js\" --require babel-register --require test/setup.js",
"test:watch": "npm run test -- --reporter min --watch",