do-me-lint
v1.22.0
Published
CLI tool to make your JS/TS projects linted with ESLint and Prettier for the best possible developer experience.
Downloads
67
Readme
DoMeLint
What
CLI tool to make your JS/TS projects linted with ESLint and Prettier for the best possible developer experience.
For whom
For busy developers who appreciate the benefits of code linting but find it tedious. For those who find themselves in the following situations:
I spend too much time to read ESLint rule docs. It indicates that you are not happy with just applying recommended configs. To make a concious choice you have to learn what is considered a warning, how it might conflict with other rules, test all the rule options. For hundreds of rules.
I don't remember why this rule is here. Is your current config specific to the project? Do you keep track of the reasons to enable or disable a specific rule?
I'm not sure if a rule is enabled in my config at all. ESLint configurations work like layers: one recommended config can enable a rule, another one can cancel it, recommended configs are usually extended from some "base" in a tree-like hierarchy. In addition your project config may be impacted by the parent folder config unless you explicitly forbid it.
I'd like to use modern ESLint plugins, but I have no time to monitor it. You suspect that ESLint world is awesome, but trying out all these plugins?
Sometimes I see more than one warning for the same code. It indicates you have conflicting rules, or some cases are covered by Typescript.
Features
- Configures ESLint, Prettier and your IDE (currently VSCode only)
- Scans your codebase: fixes all fixable ESLint rules and formats all files with Prettier
- Adds all Git-ignored patterns to
.prettierignore
and.eslintignore
- Provides you a detailed report of the most common errors
- Rules are finely selected for you from the best plugins
- Your projects gets only relevant rules, e.g. you get Typescript plugin and rules only if you have typescript as a dependency
- All ESlint configuration is stored in a single
.eslintrc.yml
file. DoMeLint ensures there are no conflicting configurations. No extended, recommended or nested configurations - what you see is what you get. - No configuration needed
- Still fully flexible: you can specify your file patterns, disable rules that are not worth fixing , and have completely own, team- or company-wide ruleset (see configuration section)
- Supports new projects and existing codebases
- Automatically updates linting dependencies using your project's dependency manager. Currently supports
npm
,yarn
andpnpm
. - Supports monorepos - configures IDE once for the whole repo while keeping linting configurations per project
Usage
cd [path-to-your-project]
npx do-me-lint
Best practices
You can achieve best results running do-me-lint
once or periodically if you want to keep the configuration up to date.
It makes sense to keep .domelintrc.yml
as part of your git repository.
Troubleshooting
If there are too many warnings to fix in one go:
- revert the changes
- disable the rules you don't want to fix (see configuration section,
ignoreRules
) - apply the command again
If do-me-lint
throws an error or stops responding at the "Checking required NPM dependencies" step, run it again in the debug mode:
DML_DEBUG=1 npx do-me-lint
Configuration
do-me-lint
reads script settings in the following priority:
- Environment variables
- Settings in
.domelintrc.yml
- Default values
All settings are optional
| Setting in .domelintrc.yml
| Description | Default | Environment variable |
| ------------------------------------------------ | --------------------------------------------------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------- |
| semi boolean
| Force semicolons to be required (true
) or forbidden (false
) | | DML_SEMI "1"
(other values are false) |
| ignoredRules Array<string>
| Ignored rules will be not added | | DML_IGNORED_RULES comma-separated string
|
| relaxedRules Array<string>
| Relaxed rules generate warnings | | DML_RELAXED_RULES comma-separated string
|
| jestFiles string
| Pattern for Jest specs | src/**/{__tests__/*,*.{spec,test}}
.{js,ts,jsx,tsx}
| DML_JEST_FILES string
|
| — | Extended debug info | | DML_DEBUG "1"
(other values are false) |
Your .domelintrc.yml
may look like this:
semi: true
ignoredRules:
- max-params
- prefer-template
# generate warnings instead of errors
relaxedRules:
- func-names