From 4b94467078f550558f301e398c32bf1156a650aa Mon Sep 17 00:00:00 2001 From: dapplion Date: Wed, 4 Nov 2020 17:34:06 +0000 Subject: [PATCH] Add prettier as an eslint plugin --- .eslintrc.js | 4 +++- package.json | 6 ++++-- prettierrc.js | 11 +++++++++++ yarn.lock | 24 ++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 prettierrc.js diff --git a/.eslintrc.js b/.eslintrc.js index d29e5da..a9f9b74 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -18,7 +18,8 @@ module.exports = { }, plugins: [ "@typescript-eslint", - "eslint-plugin-import" + "eslint-plugin-import", + "prettier" ], extends: [ "eslint:recommended", @@ -29,6 +30,7 @@ module.exports = { ], settings: {}, rules: { + "prettier/prettier": "error", //doesnt work, it reports false errors "constructor-super": "off", "@typescript-eslint/class-name-casing": "error", diff --git a/package.json b/package.json index a7d80a8..c5a773f 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "@babel/preset-typescript": "^7.8.3", "@babel/register": "^7.8.3", "@chainsafe/as-sha256": "0.2.0", + "@chainsafe/eth2-spec-tests": "0.12.0", "@chainsafe/lodestar-spec-test-util": "^0.5.0", "@types/chai": "^4.2.9", "@types/mocha": "^7.0.1", @@ -61,6 +62,7 @@ "chai": "^4.2.0", "eslint": "^6.8.0", "eslint-plugin-import": "^2.20.1", + "eslint-plugin-prettier": "^3.1.4", "karma": "^4.4.1", "karma-chai": "^0.1.0", "karma-chrome-launcher": "^3.1.0", @@ -70,11 +72,11 @@ "karma-webpack": "^4.0.2", "mocha": "^6.2.0", "nyc": "^15.0.0", + "prettier": "^2.1.2", "ts-loader": "^6.2.1", "ts-node": "^8.6.2", "typescript": "^3.7.5", "webpack": "^4.30.0", - "webpack-cli": "^3.3.2", - "@chainsafe/eth2-spec-tests": "0.12.0" + "webpack-cli": "^3.3.2" } } diff --git a/prettierrc.js b/prettierrc.js new file mode 100644 index 0000000..20baea5 --- /dev/null +++ b/prettierrc.js @@ -0,0 +1,11 @@ +module.exports = { + printWidth: 120, + tabWidth: 2, + useTabs: false, + semi: true, + singleQuote: false, + quoteProps: "as-needed", + trailingComma: "es5", + bracketSpacing: false, + arrowParens: "always", +}; \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 1c7d01c..296f5d6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2600,6 +2600,13 @@ eslint-plugin-import@^2.20.1: read-pkg-up "^2.0.0" resolve "^1.12.0" +eslint-plugin-prettier@^3.1.4: + version "3.1.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz#168ab43154e2ea57db992a2cd097c828171f75c2" + integrity sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg== + dependencies: + prettier-linter-helpers "^1.0.0" + eslint-scope@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" @@ -2808,6 +2815,11 @@ fast-deep-equal@^3.1.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4" integrity sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA== +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== + fast-json-stable-stringify@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" @@ -4924,6 +4936,18 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.2.tgz#3050700dae2e4c8b67c4c3f666cdb8af405e1ce5" + integrity sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg== + private@^0.1.6: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"