diff --git a/.eslintignore b/.eslintignore index 8bd9527d..baf2ec04 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,5 @@ lib node_modules +scripts test/output test/fixtures diff --git a/.eslintrc b/.eslintrc index 50bf9694..e5cddf5d 100644 --- a/.eslintrc +++ b/.eslintrc @@ -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" }] } } diff --git a/package.json b/package.json index 6caf093e..d3db2258 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/test/utils/relative.test.js b/test/utils/relative.test.js index 851cc830..96183b2d 100644 --- a/test/utils/relative.test.js +++ b/test/utils/relative.test.js @@ -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"); }); } diff --git a/yarn.lock b/yarn.lock index 6c6c2bc8..a2b6abc4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -1890,6 +1897,10 @@ extsprintf@1.0.2: 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" @@ -2680,6 +2691,10 @@ jest-diff@19.0.0, 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"