diff --git a/README.md b/README.md index 54554881..4a0cf375 100644 --- a/README.md +++ b/README.md @@ -10,21 +10,25 @@ This package is [ybiquitous](https://github.com/ybiquitous)'s personal ESLint co For details, please see "[*Shareable Configs*](https://eslint.org/docs/developer-guide/shareable-configs)" in ESLint documentation. -This package depends almost on -[`eslint-config-airbnb`](https://npmjs.com/eslint-config-airbnb) package. +This package depends almost on following packages: + +- [`eslint-config-airbnb`](https://npm.im/eslint-config-airbnb) +- [`eslint-config-prettier`](https://npm.im/eslint-config-prettier) + +About other packages, please check `dependencies` in [package.json](package.json). ## Install -[npm](https://npmjs.com/): +[npm](https://npm.im/): ```sh -npm install --save-dev eslint eslint-config-ybiquitous +npm install --save-dev eslint eslint-config-ybiquitous prettier ``` [Yarn](https://yarnpkg.com/): ```sh -yarn add --dev eslint eslint-config-ybiquitous +yarn add --dev eslint eslint-config-ybiquitous prettier ``` For past releases, please see [Change Log](CHANGELOG.md). @@ -39,7 +43,7 @@ Edit `.eslintrc`: } ``` -Or, if you do not need [`eslint-plugin-compat`](https://npmjs.com/eslint-plugin-compat): +Or, if you do not need [`eslint-plugin-compat`](https://npm.im/eslint-plugin-compat): ```json { diff --git a/base.js b/base.js index f4494a15..6740c708 100644 --- a/base.js +++ b/base.js @@ -1,5 +1,12 @@ module.exports = { - extends: ['airbnb', 'plugin:eslint-comments/recommended'], + extends: [ + 'airbnb', + 'plugin:eslint-comments/recommended', + 'prettier', + 'prettier/react', + ], + + plugins: ['prettier'], env: { browser: true, @@ -7,6 +14,13 @@ module.exports = { }, rules: { - semi: ['error', 'never'], + 'prettier/prettier': [ + 'error', + { + semi: false, + singleQuote: true, + trailingComma: 'all', + }, + ], }, } diff --git a/package.json b/package.json index c382c85e..4f38aae0 100644 --- a/package.json +++ b/package.json @@ -18,24 +18,29 @@ "homepage": "https://github.com/ybiquitous/eslint-config-ybiquitous#readme", "dependencies": { "eslint-config-airbnb": "^16.0.0", + "eslint-config-prettier": "^2.9.0", "eslint-plugin-compat": "^2.0.1", "eslint-plugin-eslint-comments": "^2.0.1", "eslint-plugin-import": "^2.7.0", "eslint-plugin-jsx-a11y": "^6.0.2", + "eslint-plugin-prettier": "^2.3.1", "eslint-plugin-react": "^7.4.0" }, "devDependencies": { "eslint": "^4.8.0", + "prettier": "^1.8.2", "ybiq": "*" }, "peerDependencies": { - "eslint": "^4.8.0" + "eslint": "^4.8.0", + "prettier": "^1.8.2" }, "scripts": { - "lint:js": "eslint --max-warnings=-1 --ignore-path=.gitignore --ext=.js --ext=.jsx .", + "lint:js": "eslint --ignore-path .gitignore --ext .js,.jsx .", "lint:js:fix": "npm run lint:js -- --fix", "lint:md": "markdownlint *.md", "lint": "npm-run-all --print-name --print-label --parallel lint:*", + "pretest": "eslint --print-config .eslintrc* | eslint-config-prettier-check", "test": "./test.sh", "precommit": "lint-staged", "commitmsg": "commitlint -e", @@ -44,7 +49,7 @@ }, "lint-staged": { "*.{js,jsx}": [ - "eslint --fix --max-warnings=-1 --no-ignore", + "eslint --fix --no-ignore", "git add" ], "*.md": "markdownlint" diff --git a/yarn.lock b/yarn.lock index 43726f90..f65de59d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -751,6 +751,12 @@ eslint-config-airbnb@^16.0.0: dependencies: eslint-config-airbnb-base "^12.1.0" +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-config-ybiquitous@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/eslint-config-ybiquitous/-/eslint-config-ybiquitous-3.0.1.tgz#a326942998bbf1d2fe53d7ddaa6949ff6cbb6970" @@ -819,6 +825,13 @@ eslint-plugin-jsx-a11y@^6.0.2: emoji-regex "^6.1.0" jsx-ast-utils "^1.4.0" +eslint-plugin-prettier@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.3.1.tgz#e7a746c67e716f335274b88295a9ead9f544e44d" + dependencies: + fast-diff "^1.1.1" + jest-docblock "^21.0.0" + eslint-plugin-react@^7.4.0: version "7.5.1" resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.5.1.tgz#52e56e8d80c810de158859ef07b880d2f56ee30b" @@ -965,6 +978,10 @@ fast-deep-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" +fast-diff@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.2.tgz#4b62c42b8e03de3f848460b639079920695d0154" + fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" @@ -1409,6 +1426,10 @@ isomorphic-fetch@^2.1.1: node-fetch "^1.0.1" whatwg-fetch ">=0.10.0" +jest-docblock@^21.0.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" + jest-get-type@^21.2.0: version "21.2.0" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-21.2.0.tgz#f6376ab9db4b60d81e39f30749c6c466f40d4a23" @@ -2061,6 +2082,10 @@ prepend-file@1.3.1: dependencies: tmp "0.0.31" +prettier@^1.8.2: + version "1.8.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.8.2.tgz#bff83e7fd573933c607875e5ba3abbdffb96aeb8" + pretty-format@^21.2.1: version "21.2.1" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-21.2.1.tgz#ae5407f3cf21066cd011aa1ba5fce7b6a2eddb36"