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.
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.
You can install dryer using npm:
npm install -g dryer
You can run dryer by providing a path:
You can also provide a threshold for setting rules to warn based on the failure count:
dryer . 5
The following process is recommended:
- Run dryer on your project - this gives you a
.eslintrcfile with zero failures!
- Run eslint
- Fix any syntax errors
- Fix warnings
- Configure rules that warn, to error
- 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!
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.
There are a handful of limitations currently:
- only works with ESLint
- does not read an existing
- overwrites any existing
- does not configure:
- 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.