From 6553a3438a1f58ce50da63719c34be8975862541 Mon Sep 17 00:00:00 2001 From: Julien Wajsberg Date: Wed, 28 Jun 2017 02:57:36 +0200 Subject: [PATCH] add prettier --- .eslintrc.js | 146 ++++++++++++++------------------------------------- package.json | 5 +- 2 files changed, 43 insertions(+), 108 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 6735aa3b5f..ada0caa68f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,111 +1,43 @@ module.exports = { - "env": { - "browser": true, - "es6": true, - "node": true + "env": { + "browser": true, + "es6": true, + "node": true + }, + "parser": "babel-eslint", + "extends": [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:flowtype/recommended", + "plugin:react/recommended", + "prettier", + "prettier/flowtype", + "prettier/react" + ], + "parserOptions": { + "ecmaFeatures": { + "experimentalObjectRestSpread": true, + "jsx": true }, - "parser": "babel-eslint", - "extends": ["eslint:recommended", "plugin:react/recommended"], - "parserOptions": { - "ecmaFeatures": { - "experimentalObjectRestSpread": true, - "jsx": true - }, - "sourceType": "module" - }, - "plugins": [ - "react", - "flowtype", - "import" - ], - "rules": { - // Flow type rules: - "flowtype/define-flow-type": 1, - "flowtype/use-flow-type": 1, - "flowtype/generic-spacing": [2, "never"], - "flowtype/space-before-type-colon": [ 2, "never" ], - "flowtype/space-after-type-colon": [ 2, "always" ], - "flowtype/delimiter-dangle": [ 2, "always-multiline" ], - - // ES6 Import rules: - "import/no-duplicates": "error", - "import/no-unresolved": "error", - "import/named": "error", - - // JS Rules: - "indent": [ - "error", - 2, - { "SwitchCase": 1 } - ], - "linebreak-style": [ "error", "unix" ], - "quotes": [ "error", "single", { "avoidEscape": true } ], - "semi": [ "error", "always" ], - "no-extra-semi": "error", - "comma-dangle": [ "error", "always-multiline" ], - "no-console": [ "error", { allow: ["log", "warn", "error"] } ], - "eqeqeq": "error", - "consistent-return": "error", - "curly": ["error", "all" ], - "dot-location": ["error", "property"], - "dot-notation": "error", - "no-alert": "error", - "no-caller": "error", - "no-constant-condition": ["error", { checkLoops: false }], - "no-else-return": "error", - "no-eval": "error", - "no-implied-eval": "error", - "no-extend-native": "error", - "no-native-reassign": "error", - "no-extra-bind": "error", - "no-labels": "error", - "no-implicit-globals": "error", - "no-invalid-this": "error", - "no-iterator": "error", - "no-lone-blocks": "error", - "no-loop-func": "error", - "no-multi-spaces": "error", - "no-param-reassign": "error", - "no-proto": "error", - "no-return-assign": "error", - "no-script-url": "error", - "no-self-compare": "error", - "no-throw-literal": "error", - "no-unmodified-loop-condition": "error", - "no-unused-expressions": "error", - "no-useless-concat": "error", - "no-useless-escape": "error", - "no-void": "error", - "no-with": "error", - "radix": "error", - "yoda": ["error", "never", { "exceptRange": true }], - "brace-style": ["error", "1tbs", { "allowSingleLine": true }], - "camelcase": "error", - "comma-spacing": "error", - "comma-style": "error", - "jsx-quotes": ["error", "prefer-single"], - "key-spacing": "error", - "keyword-spacing": "error", - "no-new-object": "error", - "no-spaced-func": "error", - "semi-spacing": "error", - "space-in-parens": ["error", "never"], - "spaced-comment": "error", - "generator-star-spacing": "error", - "no-var": "error", - "prefer-const": "error", - "array-bracket-spacing": "error", - "space-before-function-paren": ["error", { - "anonymous": "always", - "named": "never", - "asyncArrow": "always", - }], - "arrow-parens": ["error", "as-needed"], - }, - "settings": { - "react": { - "pragma": "React", - "version": "15.0" - } + "sourceType": "module" + }, + "plugins": [ + "react", + "flowtype", + "import", + "prettier" + ], + "rules": { + // ES6 Import rules: + "import/no-duplicates": "error", + "import/no-unresolved": "error", + "import/named": "error", + "prettier/prettier": ["error", { singleQuote: true, trailingComma: "es5" }] + }, + "settings": { + "react": { + "pragma": "React", + "version": "15.0" } + } }; diff --git a/package.json b/package.json index 877270dfcf..70e9d016a2 100644 --- a/package.json +++ b/package.json @@ -46,11 +46,11 @@ "prop-types": "^15.5.10", "query-string": "^4.2.3", "react": "^15.6.1", - "react-transition-group": "^1.2.0", "react-addons-perf": "^15.4.2", "react-contextmenu": "^2.6.3", "react-dom": "^15.6.1", "react-redux": "^5.0.5", + "react-transition-group": "^1.2.0", "redux": "^3.7.0", "redux-logger": "^3.0.6", "redux-thunk": "^2.2.0", @@ -98,8 +98,10 @@ "devtools-license-check": "^0.2.0", "eslint": "^3.10.2", "eslint-config-google": "^0.6.0", + "eslint-config-prettier": "^2.2.0", "eslint-plugin-flowtype": "^2.30.0", "eslint-plugin-import": "^2.2.0", + "eslint-plugin-prettier": "^2.1.2", "eslint-plugin-react": "^6.4.0", "express": "^4.15.3", "fake-indexeddb": "^1.0.12", @@ -114,6 +116,7 @@ "local-web-server": "^1.2.6", "lodash.clonedeep": "^4.5.0", "mkdirp": "^0.5.1", + "prettier": "^1.5.1", "raw-loader": "^0.5.1", "react-test-renderer": "^15.6.1", "rimraf": "^2.5.4",