Skip to content

Commit aecd0a2

Browse files
committed
Add prettier
1 parent 548d4ca commit aecd0a2

File tree

5 files changed

+1562
-269
lines changed

5 files changed

+1562
-269
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": "@segment/eslint-config/browser/legacy"
2+
"extends": ["prettier", "@segment/eslint-config/browser/legacy"]
33
}

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# Binaries
33
##
44

5-
ESLINT := node_modules/.bin/eslint
65
KARMA := node_modules/.bin/karma
76

87
##
@@ -58,12 +57,12 @@ distclean: clean
5857

5958
# Lint JavaScript source files.
6059
lint: install
61-
@$(ESLINT) $(ALL_FILES)
60+
yarn lint
6261
.PHONY: lint
6362

6463
# Attempt to fix linting errors.
6564
fmt: install
66-
@$(ESLINT) --fix $(ALL_FILES)
65+
yarn format
6766
.PHONY: fmt
6867

6968
# Run browser unit tests in a browser.

package.json

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,18 @@
88
],
99
"main": "lib/index.js",
1010
"scripts": {
11-
"test": "make test"
11+
"test": "make test",
12+
"lint": "eslint \"./{lib,test}/**/*.js\"",
13+
"format": "prettier-eslint --write --list-different \"./{lib,test}/**/*.{js,json,md}\"",
14+
"precommit": "lint-staged"
15+
},
16+
"lint-staged": {
17+
"linters": {
18+
"*.{js,json,md}": [
19+
"prettier-eslint --write",
20+
"git add"
21+
]
22+
}
1223
},
1324
"repository": {
1425
"type": "git",
@@ -41,10 +52,12 @@
4152
"browserify-istanbul": "^2.0.0",
4253
"codecov": "^3.0.2",
4354
"component-each": "^0.2.6",
44-
"eslint": "^2.9.0",
45-
"eslint-plugin-mocha": "^2.2.0",
46-
"eslint-plugin-react": "^4.0.0",
47-
"eslint-plugin-require-path-exists": "^1.1.5",
55+
"eslint": "^4.19.1",
56+
"eslint-config-prettier": "^2.9.0",
57+
"eslint-plugin-mocha": "^5.0.0",
58+
"eslint-plugin-react": "^7.9.1",
59+
"eslint-plugin-require-path-exists": "^1.1.8",
60+
"husky": "^0.14.3",
4861
"istanbul": "^0.4.3",
4962
"karma": "1.3.0",
5063
"karma-browserify": "^5.0.4",
@@ -55,8 +68,10 @@
5568
"karma-phantomjs-launcher": "^1.0.0",
5669
"karma-sauce-launcher": "^1.0.0",
5770
"karma-spec-reporter": "0.0.26",
71+
"lint-staged": "^7.2.0",
5872
"mocha": "^2.2.5",
5973
"phantomjs-prebuilt": "^2.1.7",
74+
"prettier-eslint-cli": "^4.7.1",
6075
"watchify": "^3.7.0"
6176
}
6277
}

test/.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": "@segment/eslint-config/mocha"
2+
"extends": ["prettier", "@segment/eslint-config/mocha"]
33
}

0 commit comments

Comments
 (0)