/auto-config-eslint-for-prettier

Will configure ESLint for use with prettier

Primary LanguageJavaScriptMIT LicenseMIT

auto-config-eslint-for-prettier

A cli tool to correctly configure ESLint to work with Prettier.

npm version Coverage Status

Key FeaturesHow To UseCreditsFeatures Under DevelopmentLicense

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
  • Determines and installs missing npm packages for the configuration of ESLint
    • prettier
    • eslint-config-prettier

How To Use

  1. If you haven't already, create a .eslintrc.js file manually or run npx eslint --init
  2. run npx auto-config-eslint-for-prettier

Credits

This software uses the following open source packages:

Dependencies

Development Dependencies

Features Under Development

  • Detect if ESLint isn't setup yet
  • Support eslintrc in YAML format
  • Support eslintrc in JSON format
  • Optionally auto install of Prettier and/or eslint-config-prettier
  • 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