From 48eeb11391f1a5b83eb288fbc62213dcf17e2b36 Mon Sep 17 00:00:00 2001 From: Alistair McKinlay Date: Wed, 17 Jul 2019 10:32:26 +0100 Subject: [PATCH] Set up prettier on js/vue --- .eslintrc.yml | 50 ++----------------------------------------------- .prettierignore | 2 -- .prettierrc.yml | 1 + package.json | 2 ++ yarn.lock | 12 ++++++++++++ 5 files changed, 17 insertions(+), 50 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index 05068e87..d6b27290 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -11,48 +11,21 @@ env: node: true rules: - arrow-body-style: error - arrow-parens: [error, always] - arrow-spacing: error block-scoped-var: error - block-spacing: [error, always] - brace-style: [error, 1tbs] - comma-dangle: - - error - - always-multiline curly: [error, all] - dot-location: [error, property] dot-notation: error - eol-last: error eqeqeq: error handle-callback-err: error - indent: [error, tab] - key-spacing: - - error - - beforeColon: false - afterColon: true - keyword-spacing: - - error - - before: true - after: true linebreak-style: [error, unix] no-alert: error no-catch-shadow: error - no-confusing-arrow: - - error - - allowParens: true no-control-regex: off no-console: error no-duplicate-imports: error no-else-return: error no-implicit-globals: error - no-multi-spaces: error - no-multiple-empty-lines: - - error - - max: 1 no-shadow: error no-template-curly-in-string: error - no-trailing-spaces: error no-unsafe-negation: error no-useless-computed-key: error no-useless-constructor: error @@ -61,12 +34,10 @@ rules: - error - functions: false no-var: error - object-curly-spacing: [error, never] object-shorthand: - error - methods - avoidExplicitReturnArrows: true - padded-blocks: [error, never] padding-line-between-statements: - error - blankLine: always @@ -82,31 +53,12 @@ rules: prefer-const: error prefer-rest-params: error prefer-spread: error - quote-props: [error, consistent-as-needed] - quotes: [error, double, avoid-escape] - rest-spread-spacing: error - semi-spacing: error - semi-style: [error, last] - semi: [error, always] - space-before-blocks: error - space-before-function-paren: - - error - - anonymous: never - named: never - asyncArrow: always # Otherwise requires `async()` - space-in-parens: [error, never] - space-infix-ops: error spaced-comment: [error, always] strict: off - template-curly-spacing: error yoda: error - vue/html-indent: [error, tab] vue/require-default-prop: off vue/no-v-html: off vue/no-use-v-if-with-v-for: off - vue/html-closing-bracket-newline: error - vue/multiline-html-element-content-newline: off - vue/singleline-html-element-content-newline: off plugins: - vue @@ -114,3 +66,5 @@ plugins: extends: - eslint:recommended - plugin:vue/recommended + - prettier + - prettier/vue diff --git a/.prettierignore b/.prettierignore index 08d66ad2..c01534b0 100644 --- a/.prettierignore +++ b/.prettierignore @@ -23,5 +23,3 @@ yarn.lock .gitattributes *.css -*.js -*.vue diff --git a/.prettierrc.yml b/.prettierrc.yml index 659327e6..4bad5750 100644 --- a/.prettierrc.yml +++ b/.prettierrc.yml @@ -1,5 +1,6 @@ arrowParens: always bracketSpacing: false +printWidth: 100 trailingComma: "es5" overrides: - files: "*.webmanifest" diff --git a/package.json b/package.json index ddaa8435..7a74d70c 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "coverage": "run-s test:{client,server} && nyc --nycrc-path=test/.nycrc-report.json report", "dev": "run-p watch start", "format:prettier": "prettier --write \"**/*.*\"", + "lint:check-eslint": "eslint --print-config .eslintrc.yml | eslint-config-prettier-check", "lint:eslint": "eslint . --ext .js,.vue --report-unused-disable-directives --color", "lint:prettier": "prettier --list-different \"**/*.*\"", "lint:stylelint": "stylelint --color \"client/**/*.css\"", @@ -84,6 +85,7 @@ "css.escape": "1.5.1", "emoji-regex": "8.0.0", "eslint": "6.0.1", + "eslint-config-prettier": "4.0.0", "eslint-plugin-vue": "5.2.3", "fuzzy": "0.1.3", "graphql-request": "1.8.2", diff --git a/yarn.lock b/yarn.lock index bc3a9760..2277e344 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2973,6 +2973,13 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1 resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= +eslint-config-prettier@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-4.0.0.tgz#16cedeea0a56e74de60dcbbe3be0ab2c645405b9" + integrity sha512-kWuiJxzV5NwOwZcpyozTzDT5KJhBw292bbYro9Is7BWnbNMg15Gmpluc1CTetiCatF8DRkNvgPAOaSyg+bYr3g== + dependencies: + get-stdin "^6.0.0" + eslint-plugin-vue@5.2.3: version "5.2.3" resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-5.2.3.tgz#3ee7597d823b5478804b2feba9863b1b74273961" @@ -3577,6 +3584,11 @@ get-func-name@^2.0.0: resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" integrity sha1-6td0q+5y4gQJQzoGY2YCPdaIekE= +get-stdin@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" + integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== + get-stdin@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-7.0.0.tgz#8d5de98f15171a125c5e516643c7a6d0ea8a96f6"