From 532d3f24cb6d4c57da14f3336e511630d6515250 Mon Sep 17 00:00:00 2001 From: "Paul \"TBBle\" Hampson" Date: Sat, 26 May 2018 18:07:08 +1000 Subject: [PATCH] Integrate prettier into eslint and CLI The VSCode extension for Prettier appears to have stopped working, and this gives us the same config as appears to be default with VSCode. It also appears to match the create-react-app defaults. ESLint config from https://medium.com/technical-credit/using-prettier-with-vs-code-and-create-react-app-67c2449b9d08 --- .eslintrc | 8 ++++++-- .prettierrc | 4 ++++ package.json | 1 + yarn.lock | 15 +++++++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 .prettierrc diff --git a/.eslintrc b/.eslintrc index 4bed466..7b6d396 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,3 +1,7 @@ { - "extends": "react-app" -} \ No newline at end of file + "extends": "react-app", + "plugins": ["prettier"], + "rules": { + "prettier/prettier": "error" + } +} diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..c1a6f66 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "singleQuote": true, + "trailingComma": "es5" +} diff --git a/package.json b/package.json index 78dd437..dbe3123 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "canvas-prebuilt": "^1.6.5-prerelease.1", "echarts": "^4.0.4", "echarts-for-react": "^2.0.8", + "eslint-plugin-prettier": "^2.6.0", "gh-pages": "^1.1.0", "prettier": "^1.12.1", "probability-distributions": "^0.9.1", diff --git a/yarn.lock b/yarn.lock index 2596935..463732e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3353,6 +3353,13 @@ eslint-plugin-jsx-a11y@6.0.3: emoji-regex "^6.1.0" jsx-ast-utils "^2.0.0" +eslint-plugin-prettier@^2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.0.tgz#33e4e228bdb06142d03c560ce04ec23f6c767dd7" + dependencies: + fast-diff "^1.1.1" + jest-docblock "^21.0.0" + eslint-plugin-react@7.7.0: version "7.7.0" resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.7.0.tgz#f606c719dbd8a1a2b3d25c16299813878cca0160" @@ -3653,6 +3660,10 @@ fast-deep-equal@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" +fast-diff@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.2.tgz#4b62c42b8e03de3f848460b639079920695d0154" + fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" @@ -5082,6 +5093,10 @@ jest-diff@^22.4.0, jest-diff@^22.4.3: jest-get-type "^22.4.3" pretty-format "^22.4.3" +jest-docblock@^21.0.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" + jest-docblock@^22.4.0, jest-docblock@^22.4.3: version "22.4.3" resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-22.4.3.tgz#50886f132b42b280c903c592373bb6e93bb68b19"