Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move parsing-related dependencies to peer dependencies. #505

Closed
wants to merge 15 commits into from
Closed
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dist
.opt-out
.DS_Store
.eslintcache
.vscode

# these cause more harm than good
# when working with contributors
Expand Down
77 changes: 49 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# prettier-eslint

Formats your JavaScript using [`prettier`][prettier] followed by [`eslint --fix`][eslint]
Formats your JavaScript using [`prettier`][prettier] followed by [`eslint --fix`][eslint], giving ESLint the final say
over any formatting.

[![Build Status][build-badge]][build]
[![Code Coverage][coverage-badge]][coverage]
Expand All @@ -16,6 +17,13 @@ Formats your JavaScript using [`prettier`][prettier] followed by [`eslint --fix`
[![Star on GitHub][github-star-badge]][github-star]
[![Tweet][twitter-badge]][twitter]

## Summary

We recommend (and Prettier [officially recommends](official-recommendation)) that you leverage
[`eslint-config-prettier`](eslint-config-prettier) to simply disable lint rules which conflict with prettier's main
job: formatting; however, you may want more control over the formatting of your code via ESLint formatting rules. This
library aims to give you that control.

## The problem

The [`fix`][fix] feature of [`eslint`][eslint] is pretty great and can
Expand All @@ -41,18 +49,29 @@ This module is distributed via [npm][npm] which is bundled with [node][node] and
should be installed as one of your project's `devDependencies`:

```
npm install --save-dev prettier-eslint
npm install --save-dev prettier-eslint prettier eslint
```

```
yarn add -D prettier-eslint prettier eslint
```

Our parsing-related dependencies are listed as "peer dependencies" meaning you must have them installed in your project
as well.

If you use TypeScript, you should install `typescript` and `@typescript-eslint/parser` to "devDependencies".

If you use Vue, you should install `vue-eslint-parser` to "devDependencies".

## Usage

### Example

```javascript
const format = require("prettier-eslint");
const format = require('prettier-eslint');

// notice, no semicolon in the original text
const sourceCode = "const {foo} = bar";
const sourceCode = 'const {foo} = bar';

const options = {
text: sourceCode,
Expand All @@ -61,7 +80,7 @@ const options = {
ecmaVersion: 7,
},
rules: {
semi: ["error", "never"],
semi: ['error', 'never'],
},
},
prettierOptions: {
Expand Down Expand Up @@ -319,39 +338,41 @@ Contributions of any kind welcome!

MIT

[prettier]: https://github.com/jlongster/prettier
[eslint]: http://eslint.org/
[fix]: http://eslint.org/docs/user-guide/command-line-interface#fix
[npm]: https://www.npmjs.com/
[node]: https://nodejs.org
[all-contributors]: https://github.com/kentcdodds/all-contributors
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why you changed the order of the links

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alphabetized. No real reason for it. Just felt awkward slapping the first-defined links at the end of the list.

[atom-dev-tools]: https://discuss.atom.io/t/how-to-make-developer-tools-appear/16232
[atom-plugin]: https://github.com/prettier/prettier-atom
[build-badge]: https://img.shields.io/travis/prettier/prettier-eslint.svg?style=flat-square
[build]: https://travis-ci.org/prettier/prettier-eslint
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
[coc]: https://github.com/prettier/prettier-eslint/blob/master/other/CODE_OF_CONDUCT.md
[coverage-badge]: https://img.shields.io/codecov/c/github/prettier/prettier-eslint.svg?style=flat-square
[coverage]: https://codecov.io/github/prettier/prettier-eslint
[version-badge]: https://img.shields.io/npm/v/prettier-eslint.svg?style=flat-square
[package]: https://www.npmjs.com/package/prettier-eslint
[donate-badge]: https://img.shields.io/badge/$-support-green.svg?style=flat-square
[donate]: https://www.paypal.me/zimme
[downloads-badge]: https://img.shields.io/npm/dm/prettier-eslint.svg?style=flat-square
[npm-stat]: http://npm-stat.com/charts.html?package=prettier-eslint&from=2016-04-01
[emojis]: https://github.com/kentcdodds/all-contributors#emoji-key
[eslint-config-prettier]: https://github.com/prettier/eslint-config-prettier
[eslint]: http://eslint.org/
[examples-badge]: https://img.shields.io/badge/%F0%9F%92%A1-examples-8C8E93.svg?style=flat-square
[examples]: https://github.com/prettier/prettier-eslint/blob/master/other/EXAMPLES.md
[fix]: http://eslint.org/docs/user-guide/command-line-interface#fix
[github-star-badge]: https://img.shields.io/github/stars/prettier/prettier-eslint.svg?style=social
[github-star]: https://github.com/prettier/prettier-eslint/stargazers
[github-watch-badge]: https://img.shields.io/github/watchers/prettier/prettier-eslint.svg?style=social
[github-watch]: https://github.com/prettier/prettier-eslint/watchers
[license-badge]: https://img.shields.io/npm/l/prettier-eslint.svg?style=flat-square
[license]: https://github.com/prettier/prettier-eslint/blob/master/other/LICENSE
[node]: https://nodejs.org
[npm-stat]: http://npm-stat.com/charts.html?package=prettier-eslint&from=2016-04-01
[npm]: https://www.npmjs.com/
[official-recommendation]: https://prettier.io/docs/en/integrating-with-linters.html
[package]: https://www.npmjs.com/package/prettier-eslint
[prettier]: https://github.com/prettier/prettier
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[prs]: http://makeapullrequest.com
[donate-badge]: https://img.shields.io/badge/$-support-green.svg?style=flat-square
[donate]: https://www.paypal.me/zimme
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
[coc]: https://github.com/prettier/prettier-eslint/blob/master/other/CODE_OF_CONDUCT.md
[roadmap-badge]: https://img.shields.io/badge/%F0%9F%93%94-roadmap-CD9523.svg?style=flat-square
[roadmap]: https://github.com/prettier/prettier-eslint/blob/master/other/ROADMAP.md
[examples-badge]: https://img.shields.io/badge/%F0%9F%92%A1-examples-8C8E93.svg?style=flat-square
[examples]: https://github.com/prettier/prettier-eslint/blob/master/other/EXAMPLES.md
[github-watch-badge]: https://img.shields.io/github/watchers/prettier/prettier-eslint.svg?style=social
[github-watch]: https://github.com/prettier/prettier-eslint/watchers
[github-star-badge]: https://img.shields.io/github/stars/prettier/prettier-eslint.svg?style=social
[github-star]: https://github.com/prettier/prettier-eslint/stargazers
[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20prettier-eslint!%20https://github.com/prettier/prettier-eslint%20%F0%9F%91%8D
[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/prettier/prettier-eslint.svg?style=social
[emojis]: https://github.com/kentcdodds/all-contributors#emoji-key
[all-contributors]: https://github.com/kentcdodds/all-contributors
[atom-plugin]: https://github.com/prettier/prettier-atom
[atom-dev-tools]: https://discuss.atom.io/t/how-to-make-developer-tools-appear/16232
[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20prettier-eslint!%20https://github.com/prettier/prettier-eslint%20%F0%9F%91%8D
[version-badge]: https://img.shields.io/npm/v/prettier-eslint.svg?style=flat-square
[vscode-plugin]: https://github.com/esbenp/prettier-vscode
37 changes: 29 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,32 @@
"keywords": [],
"author": "Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)",
"maintainers": [
"Simon Fridlund <simon@fridlund.email>"
"Simon Fridlund <simon@fridlund.email>",
"Hamza Hamidi <@hamzahamidii>",
"Kyle Holmberg <@kylemh_>"
],
"license": "MIT",
"dependencies": {
"@typescript-eslint/parser": "^3.0.0",
"common-tags": "^1.4.0",
"dlv": "^1.1.0",
"eslint": "^7.9.0",
"indent-string": "^4.0.0",
"lodash.merge": "^4.6.0",
"loglevel-colored-level-prefix": "^1.0.0",
"prettier": "^2.0.0",
"pretty-format": "^23.0.1",
"require-relative": "^0.8.7",
"typescript": "^3.9.3",
"vue-eslint-parser": "~7.1.0"
"require-relative": "^0.8.7"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"@typescript-eslint/parser": "^4.0.0",
"@types/jest": "^25",
"acorn": "^6.1.1",
"ajv": "^6.12.2",
"all-contributors-cli": "^6.7.0",
"babel-jest": "^25.0.0",
"chalk": "^2.1.0",
"eslint": "^7.9.0",
"eslint-config-kentcdodds": "~16.0.1",
"husky": "^2.4.1",
"jest": "^25.0.0",
Expand All @@ -50,7 +50,28 @@
"prettier-eslint-cli": "^5.0.0",
"rimraf": "^2.5.4",
"semantic-release": "^15.13.16",
"strip-indent": "^3.0.0"
"strip-indent": "^3.0.0",
"prettier": "^2.0.0",
"typescript": "^4.0.0",
"vue-eslint-parser": "^7.0.0"
},
"peerDependencies": {
"@typescript-eslint/parser": ">=3.0.0",
"eslint": "^7.9.0",
"prettier": "^2.0.0",
"typescript": ">=3.0.0",
"vue-eslint-parser": "^7.0.0"
},
"peerDependenciesMeta": {
"@typescript-eslint/parser": {
"optional": true
},
"typescript": {
"optional": true
},
"vue-eslint-parser": {
"optional": true
}
},
"engines": {
"node": ">=10.0.0"
Expand Down