1.21.0 • Published 2 months ago

do-me-lint v1.21.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 months ago

DoMeLint

tests

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 and pnpm.
  • 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.

For monorepos you need to run the script from each project's directory.

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:

  1. Environment variables
  2. Settings in .domelintrc.yml
  3. Default values

All settings are optional

Setting in .domelintrc.ymlDescriptionDefaultEnvironment variable
semi booleanForce semicolons to be required (true) or forbidden (false)DML_SEMI "1" (other values are false)
ignoredRules Array<string>Ignored rules will be not addedDML_IGNORED_RULES comma-separated string
relaxedRules Array<string>Relaxed rules generate warningsDML_RELAXED_RULES comma-separated string
jestFiles stringPattern for Jest specs src/**/{__tests__/*,*.{spec,test}}.{js,ts,jsx,tsx}DML_JEST_FILES string
Extended debug infoDML_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

Supported ESLint plugins

1.21.0

2 months ago

1.20.0

3 months ago

1.19.0

3 months ago

1.18.0

3 months ago

1.15.0

4 months ago

1.14.0

4 months ago

1.17.0

4 months ago

1.16.0

4 months ago

1.13.0

4 months ago

1.12.0

5 months ago

1.11.0

5 months ago

1.9.0

12 months ago

1.8.0

12 months ago

1.10.0

12 months ago

1.7.0

2 years ago

1.6.5

2 years ago

1.6.4

2 years ago

1.6.3

2 years ago

1.6.2

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.0

3 years ago

1.0.2

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.3-beta.2

3 years ago

1.0.3-beta.1

3 years ago

1.0.3

3 years ago

1.1.0-beta.2

3 years ago

1.1.0-beta.1

3 years ago

1.1.0-beta.10

3 years ago

1.1.0-beta.3

3 years ago

1.0.0

3 years ago

1.0.0-beta.10

3 years ago

1.0.0-beta.9

3 years ago

1.0.0-beta.8

3 years ago

1.0.0-beta.7

3 years ago

1.0.0-beta.6

3 years ago

1.0.0-beta.5

3 years ago

1.0.0-beta.4

3 years ago

1.0.0-beta.3

3 years ago

1.0.0-beta

3 years ago