Skip to content

Commit ea2eafa

Browse files
authored
Add prettier eslint plugin (#466)
* Add prettier eslint plugin * Fix prettier
1 parent 4548169 commit ea2eafa

File tree

5 files changed

+30
-13
lines changed

5 files changed

+30
-13
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
lib
22
node_modules
3+
scripts
34
test/output
45
test/fixtures

.eslintrc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"es6": true,
44
"node": true
55
},
6-
"extends": [
7-
"eslint-config-babel"
8-
],
6+
"extends": ["eslint-config-babel"],
7+
"plugins": ["prettier"],
98
"rules": {
10-
"arrow-parens": "off"
9+
"arrow-parens": "off",
10+
"prettier/prettier": ["error", { "trailingComma": "all" }]
1111
}
1212
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"eslint": "^3.8.1",
3232
"eslint-config-babel": "^6.0.0",
3333
"eslint-plugin-flowtype": "^2.25.0",
34+
"eslint-plugin-prettier": "^2.1.2",
3435
"husky": "^0.13.2",
3536
"lint-staged": "^3.3.1",
3637
"nyc": "^11.0.1",
@@ -44,7 +45,7 @@
4445
"scripts": {
4546
"clean": "rimraf lib/",
4647
"build": "babel src/ --out-dir lib/",
47-
"format": "prettier --write --trailing-comma all \"src/**/*.js\" \"test/*.test.js\" \"test/helpers/*.js\" && prettier --write --trailing-comma es5 \"scripts/*.js\"",
48+
"format": "prettier --write --trailing-comma all \"src/**/*.js\" \"test/**/*.test.js\" \"test/helpers/*.js\" && prettier --write --trailing-comma es5 \"scripts/*.js\"",
4849
"lint": "eslint src test",
4950
"precommit": "lint-staged",
5051
"prepublish": "yarn run clean && yarn run build",

test/utils/relative.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,35 @@ import os from "os";
33
import relative from "../../lib/utils/relative.js";
44

55
if (os.platform() === "win32") {
6-
test("should get correct relative path - depth 0 - windows", (t) => {
6+
test("should get correct relative path - depth 0 - windows", t => {
77
t.is(relative("C:\\the\\root", "C:\\the\\root\\one.js"), "one.js");
88
});
99

10-
test("should get correct relative path - depth 1 - windows", (t) => {
10+
test("should get correct relative path - depth 1 - windows", t => {
1111
t.is(relative("C:\\the\\root", "C:\\the\\rootone.js"), "..\\rootone.js");
1212
});
1313

14-
test("should get correct relative path - depth 2 - windows", (t) => {
14+
test("should get correct relative path - depth 2 - windows", t => {
1515
t.is(relative("C:\\the\\root", "C:\\therootone.js"), "C:\\therootone.js");
1616
});
1717

18-
test("should get correct relative path with main root - depth 0 - windows", (t) => {
18+
test("should get correct relative path with main root - depth 0 - windows", t => {
1919
t.is(relative("C:\\", "C:\\the\\root\\one.js"), "the\\root\\one.js");
2020
});
2121
} else {
22-
test("should get correct relative path - depth 0", (t) => {
22+
test("should get correct relative path - depth 0", t => {
2323
t.is(relative("/the/root", "/the/root/one.js"), "one.js");
2424
});
2525

26-
test("should get correct relative path - depth 1", (t) => {
26+
test("should get correct relative path - depth 1", t => {
2727
t.is(relative("/the/root", "/the/rootone.js"), "../rootone.js");
2828
});
2929

30-
test("should get correct relative path - depth 2", (t) => {
30+
test("should get correct relative path - depth 2", t => {
3131
t.is(relative("/the/root", "/therootone.js"), "/therootone.js");
3232
});
3333

34-
test("should get correct relative path with main root - depth 0", (t) => {
34+
test("should get correct relative path with main root - depth 0", t => {
3535
t.is(relative("/", "/the/root/one.js"), "the/root/one.js");
3636
});
3737
}

yarn.lock

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,6 +1717,13 @@ eslint-plugin-flowtype@^2.25.0:
17171717
dependencies:
17181718
lodash "^4.15.0"
17191719

1720+
eslint-plugin-prettier@^2.1.2:
1721+
version "2.1.2"
1722+
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.1.2.tgz#4b90f4ee7f92bfbe2e926017e1ca40eb628965ea"
1723+
dependencies:
1724+
fast-diff "^1.1.1"
1725+
jest-docblock "^20.0.1"
1726+
17201727
eslint@^3.8.1:
17211728
version "3.19.0"
17221729
resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc"
@@ -1890,6 +1897,10 @@ [email protected]:
18901897
version "1.0.2"
18911898
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550"
18921899

1900+
fast-diff@^1.1.1:
1901+
version "1.1.1"
1902+
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.1.tgz#0aea0e4e605b6a2189f0e936d4b7fbaf1b7cfd9b"
1903+
18931904
fast-levenshtein@~2.0.4:
18941905
version "2.0.6"
18951906
resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
@@ -2680,6 +2691,10 @@ [email protected], jest-diff@^19.0.0:
26802691
jest-matcher-utils "^19.0.0"
26812692
pretty-format "^19.0.0"
26822693

2694+
jest-docblock@^20.0.1:
2695+
version "20.0.3"
2696+
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-20.0.3.tgz#17bea984342cc33d83c50fbe1545ea0efaa44712"
2697+
26832698
jest-file-exists@^19.0.0:
26842699
version "19.0.0"
26852700
resolved "https://registry.yarnpkg.com/jest-file-exists/-/jest-file-exists-19.0.0.tgz#cca2e587a11ec92e24cfeab3f8a94d657f3fceb8"

0 commit comments

Comments
 (0)