Generate lint configurations from scratch - sort of deprecated
JavaScript
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
eslint
.eslintrc
.gitignore
LICENSE
README.md
index.js
package.json

README.md

Stories in Ready

dryer

dryer is a tool for generating lint configurations from scratch. dryer will run a linter with all rules enabled to determine what conventions your code already follows.

Project Status

dryer is not stable and its API may change at any time. Currently, only eslint is supported, but the plan is to add other linters in the future.

2016 10 18 Update: @ianvs did the work of adding the basic functionality to ESLint via the --init flag. From here I'd like to pivot the tool to solving the same problem a different way. Rather than running ESLint configured with multiple permutations of the config in several passes, I'd like to try writing a more general purpose analyzer that can actually count how many times a given pattern exists. This would be more efficient, and also lend itself toward 1) supporting multiple linters and 2) generating a style guide. Some talk of this on Twitter: https://twitter.com/ColinEberhardt/status/788411749385039873

I have no idea if the current version of dryer plays well with the latest version of ESLint. If you notice any problems, you can file an issue, or even submit a pull request. :)

2015 07 15 Update: I'm exploring folding dryer into ESLint. I've already made significant improvements, including:

  • configuration of parser and environment
  • reading rule schemas to derive rule options
  • testing rule options beyond the default

I considered these features necessary for a proper 1.0 release and they are well on their way. Enabling auto-configuration in the ESLint CLI will be very useful for adoption, and there are benefits to directly accessing ESLint's API. If you're interested in seeing this continue to be developed as a part of ESLint, please talk to me @willklein in the ESLint Gitter chat.

dryer will receive these updates in the near future. After I've completed the 1.0 milestone I will revisit whether I'll continue advancing dryer as a standalone tool. If you have any input on this, tweet me @WillsLab.

Usage

You can install dryer using npm:

npm install -g dryer

You can run dryer by providing a path:

dryer .

You can also provide a threshold for setting rules to warn based on the failure count:

dryer . 5

Guide

The following process is recommended:

  1. Run dryer on your project - this gives you a .eslintrc file with zero failures!
  2. Run eslint
  3. Fix any syntax errors
  4. Fix warnings
  5. Configure rules that warn, to error
  6. Identify additional rules that you'd like to enable!

After step 1, you're done with dryer. It gives you a starting point for your linting configs; the rest is up to you!

About

I recently transitioned my company's main repos from JSHint to ESLint. I hand-crafted an initial .eslintrc file through trial-and-error, until I had a configuration with no errors, and a handful of warnings. To make this process easier, I've written this tool to auto-generate linting configs with a similar heuristic.

Current Limitations

There are a handful of limitations currently:

  • only works with ESLint
  • does not read an existing .eslintrc
  • overwrites any existing .eslintrc
  • does not configure:
    • environment
    • globals
    • parser
  • all rules are configured, even when could be excluded (enabled by default)

Some rules that have options that are innumerable. Those rules will never be auto-configurable beyond a suggested default.

Help, Issues and Support

Ask questions, post issues, and share suggestions using Waffle. Waffle is a kanban board backed by GitHub Issues. You can also tweet me @WillsLab.

License

MIT © Will Klein