From 1aa46546451a991861c21775bfeca275caf8d130 Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 20 Jul 2018 09:36:40 +0900 Subject: [PATCH 1/3] Add packages: eslint-config-prettier eslint-plugin-prettier --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 2a1623c..3dd3935 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,8 @@ "eslint": ">=5.0.0" }, "dependencies": { - "eslint-plugin-node": "^7.0.0" + "eslint-config-prettier": "^2.9.0", + "eslint-plugin-node": "^7.0.0", + "eslint-plugin-prettier": "^2.6.2" } } From 58ce61ae63b7cc72b1ef5a4471b76e739c93ccc9 Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 20 Jul 2018 09:48:16 +0900 Subject: [PATCH 2/3] Enable eslint-plugin-prettier --- eslint.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint.js b/eslint.js index 8155def..08ac1c1 100644 --- a/eslint.js +++ b/eslint.js @@ -1,5 +1,5 @@ module.exports = { - extends: ['eslint:recommended', 'plugin:node/recommended'], + extends: ['eslint:recommended', 'plugin:node/recommended', 'plugin:prettier/recommended'], rules: { // override recomennded 'no-console': 'off', From a2a2afd3d19d002059a42c01ae4ae192aaaf5886 Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 20 Jul 2018 10:52:48 +0900 Subject: [PATCH 3/3] Delete overwriting place of Prettier's unified rules --- eslint.js | 62 ++++--------------------------------- yarn.lock | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 56 deletions(-) create mode 100644 yarn.lock diff --git a/eslint.js b/eslint.js index 08ac1c1..1ef1295 100644 --- a/eslint.js +++ b/eslint.js @@ -5,17 +5,9 @@ module.exports = { 'no-console': 'off', 'no-empty': ['error', { allowEmptyCatch: true }], 'no-unused-vars': ['error', { args: 'none' }], - // Possible Errors - 'no-extra-parens': ['error', 'all', { - conditionalAssign: false, - returnAssign: false, - nestedBinaryExpressions: false - }], // Best Practices 'array-callback-return': 'error', 'block-scoped-var': 'error', - 'curly': ['error', 'multi-line'], - 'dot-location': ['error', 'property'], 'dot-notation': 'error', /** eqeqeq Deprecated option. @see https://github.com/hexojs/eslint-config-hexo/issues/8 */ 'eqeqeq': ['error', 'allow-null'], @@ -28,7 +20,6 @@ module.exports = { 'no-implied-eval': 'error', 'no-lone-blocks': 'error', 'no-loop-func': 'error', - 'no-multi-spaces': 'error', 'no-multi-str': 'error', 'no-new': 'error', 'no-new-func': 'error', @@ -49,7 +40,6 @@ module.exports = { 'no-with': 'error', 'prefer-promise-reject-errors': 'error', 'radix': 'error', - 'wrap-iife': 'error', 'yoda': ['error', 'never'], // Strict Mode 'strict': 'error', @@ -62,68 +52,28 @@ module.exports = { 'handle-callback-err': 'error', 'no-path-concat': 'error', // Stylistic Issues - 'array-bracket-spacing': ['error', 'never'], - 'block-spacing': ['error', 'always'], - 'brace-style': ['error', '1tbs', { allowSingleLine: true }], - 'comma-dangle': ['error', 'never'], - 'comma-spacing': ['error', { - before: false, - after: true - }], - 'comma-style': ['error', 'last'], - 'computed-property-spacing': ['error', 'never'], - 'eol-last': 'error', - 'func-call-spacing': 'error', - 'indent': ['error', 2, { SwitchCase: 1 }], - 'key-spacing': ['error', { - beforeColon: false, - afterColon: true - }], - 'keyword-spacing': 'error', 'linebreak-style': ['error', 'unix'], - 'lines-around-comment': ['error', { beforeBlockComment: true }], 'new-cap': 'error', 'new-parens': 'error', 'no-array-constructor': 'error', - 'no-mixed-operators': 'error', - 'no-multiple-empty-lines': 'error', 'no-nested-ternary': 'error', 'no-new-object': 'error', - 'no-trailing-spaces': 'error', 'no-unneeded-ternary': 'error', - 'no-whitespace-before-property': 'error', 'one-var': ['error', { uninitialized: 'always', initialized: 'never' }], - 'operator-linebreak': ['error', 'before'], - 'quotes': ['error', 'single'], - 'semi': ['error', 'always'], - 'semi-spacing': ['error', { - before: false, - after: true - }], - 'space-before-blocks': ['error', 'always'], - 'space-before-function-paren': ['error', 'never'], - 'space-in-parens': ['error', 'never'], - 'space-infix-ops': 'error', - 'space-unary-ops': ['error', { - words: false, - nonwords: false - }], 'spaced-comment': ['error', 'always'], - 'template-tag-spacing': ['error', 'never'], - 'unicode-bom': ['error', 'never'], // ECMAScript 6 - 'arrow-spacing': 'error', - 'generator-star-spacing': ['error', 'after'], - 'no-confusing-arrow': ['error', { allowParens: true }], 'no-duplicate-imports': 'error', 'no-useless-computed-key': 'error', 'no-useless-constructor': 'error', 'no-useless-rename': 'error', - 'rest-spread-spacing': ['error', 'never'], - 'template-curly-spacing': ['error', 'never'], - 'yield-star-spacing': ['error', 'after'] + 'prettier/prettier': ['error', { + semi: true, + singleQuote: true, + tabWidth: 2, + useTabs: false + }] } }; diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..3e1d35f --- /dev/null +++ b/yarn.lock @@ -0,0 +1,93 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + +eslint-config-prettier@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-2.9.0.tgz#5ecd65174d486c22dff389fe036febf502d468a3" + dependencies: + get-stdin "^5.0.1" + +eslint-plugin-es@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-1.3.1.tgz#5acb2565db4434803d1d46a9b4cbc94b345bd028" + dependencies: + eslint-utils "^1.3.0" + regexpp "^2.0.0" + +eslint-plugin-node@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-7.0.1.tgz#a6e054e50199b2edd85518b89b4e7b323c9f36db" + dependencies: + eslint-plugin-es "^1.3.1" + eslint-utils "^1.3.1" + ignore "^4.0.2" + minimatch "^3.0.4" + resolve "^1.8.1" + semver "^5.5.0" + +eslint-plugin-prettier@^2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.2.tgz#71998c60aedfa2141f7bfcbf9d1c459bf98b4fad" + dependencies: + fast-diff "^1.1.1" + jest-docblock "^21.0.0" + +eslint-utils@^1.3.0, eslint-utils@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" + +fast-diff@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.2.tgz#4b62c42b8e03de3f848460b639079920695d0154" + +get-stdin@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398" + +ignore@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.2.tgz#0a8dd228947ec78c2d7f736b1642a9f7317c1905" + +jest-docblock@^21.0.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" + +minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + dependencies: + brace-expansion "^1.1.7" + +path-parse@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" + +regexpp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.0.tgz#b2a7534a85ca1b033bcf5ce9ff8e56d4e0755365" + +resolve@^1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" + dependencies: + path-parse "^1.0.5" + +semver@^5.5.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"