From 742fd9d7a69d5db51b8f4d39685f3b3d174b6f06 Mon Sep 17 00:00:00 2001 From: Jirat Ki Date: Sat, 6 Oct 2018 18:08:28 +0800 Subject: [PATCH 1/2] Remove dependencies and update install instrcution --- README.md | 40 ++++++++++++++++++++++++++++++++++++---- package.json | 11 ----------- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 01650fb..c849035 100644 --- a/README.md +++ b/README.md @@ -18,17 +18,49 @@ ESLint config for WeWork projects. This is an extension of `eslint-config-airbnb ### Install: +**Yarn** + +```sh +( + export PKG=eslint-config-wework; + npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs yarn add --dev "$PKG@latest" +) +``` + +**NPM** + +If using **npm 5+**, use this shortcut + +```sh +npx install-peerdeps --dev eslint-config-wework ``` -npm install eslint-config-wework --save + +If using **npm < 5**, Linux/OSX users can run + +```sh +( + export PKG=eslint-config-wework; + npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest" +) ``` -If you're using `npm` < v3 you'll need to install each of this packages `peerDependencies` explicitly. +Which produces and runs a command like: +```sh +npm install --save-dev eslint-config-airbnb eslint@^#.#.# eslint-plugin-jsx-a11y@^#.#.# eslint-plugin-import@^#.#.# eslint-plugin-react@^#.#.# eslint-config-airbnb@^#.#.# eslint-config-lodash@^#.#.# eslint-config-mocha@^#.#.# eslint-config-node@^#.#.# eslint-config-promise@^#.#.# eslint-config-security@^#.#.# ``` -npm install eslint-config-airbnb eslint-plugin-react eslint-plugin-import eslint-plugin-jsx-a11y --save + +If using **npm < 5**, Windows users can either install all the peer dependencies manually, or use the [install-peerdeps](https://github.com/nathanhleung/install-peerdeps) cli tool. + +```sh +npm install -g install-peerdeps +install-peerdeps --dev eslint-config-airbnb ``` +The cli will produce and run a command like: -Note: make sure the versions of the above packages that are installed satisfy this package's `peerDependencies`, otherwise you might see inconsistent behavior. +```sh +npm install --save-dev eslint-config-airbnb eslint@^#.#.# eslint-plugin-jsx-a11y@^#.#.# eslint-plugin-import@^#.#.# eslint-plugin-react@^#.#.# eslint-config-airbnb@^#.#.# eslint-config-lodash@^#.#.# eslint-config-mocha@^#.#.# eslint-config-node@^#.#.# eslint-config-promise@^#.#.# eslint-config-security@^#.#.# +``` ### Configure: diff --git a/package.json b/package.json index f0b99f5..08f8296 100644 --- a/package.json +++ b/package.json @@ -49,16 +49,5 @@ "eslint-plugin-promise": "3.5.0", "eslint-plugin-react": "7.2.0", "eslint-plugin-security": "1.4.0" - }, - "dependencies": { - "eslint-config-airbnb": "15.1.0", - "eslint-plugin-import": "2.7.0", - "eslint-plugin-jsx-a11y": "5.1.1", - "eslint-plugin-lodash": "2.4.4", - "eslint-plugin-mocha": "4.11.0", - "eslint-plugin-node": "5.1.1", - "eslint-plugin-promise": "3.5.0", - "eslint-plugin-react": "7.2.0", - "eslint-plugin-security": "1.4.0" } } From 5950bc3b33fb97ea0408397049c5fb1499d4c8fd Mon Sep 17 00:00:00 2001 From: Jirat Ki Date: Tue, 9 Oct 2018 13:54:39 +0800 Subject: [PATCH 2/2] Add eslint-* as devDependencies --- package.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/package.json b/package.json index 08f8296..8a69310 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,15 @@ "devDependencies": { "auto-changelog": "0.3.1", "eslint": ">=4.4.1", + "eslint-config-airbnb": "15.1.0", + "eslint-plugin-import": "2.7.0", + "eslint-plugin-jsx-a11y": "5.1.1", + "eslint-plugin-lodash": "2.4.4", + "eslint-plugin-mocha": "4.11.0", + "eslint-plugin-node": "5.1.1", + "eslint-plugin-promise": "3.5.0", + "eslint-plugin-react": "7.2.0", + "eslint-plugin-security": "1.4.0", "husky": "0.14.3", "lint-staged": "4.0.3", "np": "2.16.0",