auto-config-eslint-for-prettier
A cli tool to correctly configure ESLint to work with Prettier.
Key Features • How To Use • Credits • Features Under Development • License
Motivation
There is a lot of confusion about how to get Prettier
and ESLint to work together. I wanted to create a tool
that will automagically implement the recommended configurations of ESLint to
work with Prettier. I also wanted it to work similar to eslint --init
To start with, the only mention ESLint makes of Prettier is on their GitHub page's FAQ Section, but no further directions.
Prettier makes
two methodologies
available to integrate with ESLint, but one
isn't recommended.
Furthermore, the suggested
additional package
requires configurations of the .eslintrc.*
file mentioned in the
instructions!
This is a bunch of steps that can and now is automated.
Key Features
- Updates .eslintrc.js file with correct prettier extends for known plugins
- supports the following plugins
@typescript-eslint/eslint-plugin
eslint-plugin-babel
eslint-plugin-flowtype
eslint-plugin-prettier
eslint-plugin-react
eslint-plugin-standard
eslint-plugin-unicorn
eslint-plugin-vue
- supports the following plugins
- Determines and installs missing npm packages for the configuration of ESLint
- prettier
- eslint-config-prettier
How To Use
- If you haven't already, create a
.eslintrc.js
file manually or runnpx eslint --init
- run
npx auto-config-eslint-for-prettier
Credits
This software uses the following open source packages:
Dependencies
Development Dependencies
- Chai
- ESLint
- chai-as-promised
- coveralls
- eslint-config-airbnb-base
- eslint-config-prettier
- eslint-plugin-import
- eslint-plugin-jsdoc
- Generate Changelog
- Husky
- Mocha
- Node.js
- nyc
- Prettier
- Sinon.js
Features Under Development
- [x] Detect if ESLint isn't setup yet
- [x] Support eslintrc in YAML format
- [x] Support eslintrc in JSON format
- [x] Optionally auto install of Prettier and/or eslint-config-prettier
- [x] Add ability to download json(c) rules, from pre-defined keywords
- [ ] Add ability to download json(c) rules, from arbitrary URLs
- [ ] Add ability to read json(c) rules, from a local path
License
MIT
aaronyoung.dev · GitHub @brainomite