Skip to content

Commit

Permalink
feat: integrate with Prettier (#125)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

Although keeping the lint rules as far as possible, this integration may change your code style a lot.
And installing `prettier` (peer dependency) becomes necessary.
  • Loading branch information
ybiquitous authored Dec 5, 2017
1 parent 1ea089a commit 54bd8e8
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 11 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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
{
Expand Down
18 changes: 16 additions & 2 deletions base.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
module.exports = {
extends: ['airbnb', 'plugin:eslint-comments/recommended'],
extends: [
'airbnb',
'plugin:eslint-comments/recommended',
'prettier',
'prettier/react',
],

plugins: ['prettier'],

env: {
browser: true,
node: true,
},

rules: {
semi: ['error', 'never'],
'prettier/prettier': [
'error',
{
semi: false,
singleQuote: true,
trailingComma: 'all',
},
],
},
}
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -44,7 +49,7 @@
},
"lint-staged": {
"*.{js,jsx}": [
"eslint --fix --max-warnings=-1 --no-ignore",
"eslint --fix --no-ignore",
"git add"
],
"*.md": "markdownlint"
Expand Down
25 changes: 25 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 54bd8e8

Please sign in to comment.