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..8a69310 100644 --- a/package.json +++ b/package.json @@ -32,13 +32,6 @@ "homepage": "https://github.com/wework/eslint-config-wework#readme", "devDependencies": { "auto-changelog": "0.3.1", - "eslint": ">=4.4.1", - "husky": "0.14.3", - "lint-staged": "4.0.3", - "np": "2.16.0", - "nsp": "2.7.0" - }, - "peerDependencies": { "eslint": ">=4.4.1", "eslint-config-airbnb": "15.1.0", "eslint-plugin-import": "2.7.0", @@ -48,9 +41,14 @@ "eslint-plugin-node": "5.1.1", "eslint-plugin-promise": "3.5.0", "eslint-plugin-react": "7.2.0", - "eslint-plugin-security": "1.4.0" + "eslint-plugin-security": "1.4.0", + "husky": "0.14.3", + "lint-staged": "4.0.3", + "np": "2.16.0", + "nsp": "2.7.0" }, - "dependencies": { + "peerDependencies": { + "eslint": ">=4.4.1", "eslint-config-airbnb": "15.1.0", "eslint-plugin-import": "2.7.0", "eslint-plugin-jsx-a11y": "5.1.1",