Skip to content

Commit

Permalink
Add prettier eslint plugin (#466)
Browse files Browse the repository at this point in the history
* Add prettier eslint plugin

* Fix prettier
  • Loading branch information
danez authored Jun 16, 2017
1 parent 4548169 commit ea2eafa
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
lib
node_modules
scripts
test/output
test/fixtures
8 changes: 4 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"es6": true,
"node": true
},
"extends": [
"eslint-config-babel"
],
"extends": ["eslint-config-babel"],
"plugins": ["prettier"],
"rules": {
"arrow-parens": "off"
"arrow-parens": "off",
"prettier/prettier": ["error", { "trailingComma": "all" }]
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"eslint": "^3.8.1",
"eslint-config-babel": "^6.0.0",
"eslint-plugin-flowtype": "^2.25.0",
"eslint-plugin-prettier": "^2.1.2",
"husky": "^0.13.2",
"lint-staged": "^3.3.1",
"nyc": "^11.0.1",
Expand All @@ -44,7 +45,7 @@
"scripts": {
"clean": "rimraf lib/",
"build": "babel src/ --out-dir lib/",
"format": "prettier --write --trailing-comma all \"src/**/*.js\" \"test/*.test.js\" \"test/helpers/*.js\" && prettier --write --trailing-comma es5 \"scripts/*.js\"",
"format": "prettier --write --trailing-comma all \"src/**/*.js\" \"test/**/*.test.js\" \"test/helpers/*.js\" && prettier --write --trailing-comma es5 \"scripts/*.js\"",
"lint": "eslint src test",
"precommit": "lint-staged",
"prepublish": "yarn run clean && yarn run build",
Expand Down
16 changes: 8 additions & 8 deletions test/utils/relative.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@ import os from "os";
import relative from "../../lib/utils/relative.js";

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

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

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

test("should get correct relative path with main root - depth 0 - windows", (t) => {
test("should get correct relative path with main root - depth 0 - windows", t => {
t.is(relative("C:\\", "C:\\the\\root\\one.js"), "the\\root\\one.js");
});
} else {
test("should get correct relative path - depth 0", (t) => {
test("should get correct relative path - depth 0", t => {
t.is(relative("/the/root", "/the/root/one.js"), "one.js");
});

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

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

test("should get correct relative path with main root - depth 0", (t) => {
test("should get correct relative path with main root - depth 0", t => {
t.is(relative("/", "/the/root/one.js"), "the/root/one.js");
});
}
15 changes: 15 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,13 @@ eslint-plugin-flowtype@^2.25.0:
dependencies:
lodash "^4.15.0"

eslint-plugin-prettier@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.1.2.tgz#4b90f4ee7f92bfbe2e926017e1ca40eb628965ea"
dependencies:
fast-diff "^1.1.1"
jest-docblock "^20.0.1"

eslint@^3.8.1:
version "3.19.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc"
Expand Down Expand Up @@ -1890,6 +1897,10 @@ [email protected]:
version "1.0.2"
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550"

fast-diff@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.1.tgz#0aea0e4e605b6a2189f0e936d4b7fbaf1b7cfd9b"

fast-levenshtein@~2.0.4:
version "2.0.6"
resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
Expand Down Expand Up @@ -2680,6 +2691,10 @@ [email protected], jest-diff@^19.0.0:
jest-matcher-utils "^19.0.0"
pretty-format "^19.0.0"

jest-docblock@^20.0.1:
version "20.0.3"
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-20.0.3.tgz#17bea984342cc33d83c50fbe1545ea0efaa44712"

jest-file-exists@^19.0.0:
version "19.0.0"
resolved "https://registry.yarnpkg.com/jest-file-exists/-/jest-file-exists-19.0.0.tgz#cca2e587a11ec92e24cfeab3f8a94d657f3fceb8"
Expand Down

0 comments on commit ea2eafa

Please sign in to comment.