exadel-inc / esl

Lightweight and flexible UI component library based on web components technology for creating basic UX modules
https://esl-ui.com
MIT License
58 stars 9 forks source link

[🔨 lint]: integrate ` lint-staged` plugin to speedup commit checks #1078

Closed ala-n closed 2 years ago

ala-n commented 2 years ago

As an ESL team member, I want to have a balance between the quality of checks and their speed.

It is requested to make a commit check via the lint-staged plugin to limit the number of checks started for commit changes.

Priority Normal

fshovchko commented 2 years ago

I'm afraid lint-staged doesn't satisfy our needs with running eslint checks, because for some reason lint-staged renderer doesn't print out warnings. The only time it will print any of the information when eslint check finished with an error. See issue on lint-staged repository covering the problem: https://github.com/okonet/lint-staged/issues/313

ala-n commented 2 years ago

I'm afraid lint-staged doesn't satisfy our needs with running eslint checks, because for some reason lint-staged renderer doesn't print out warnings. The only time it will print any of the information when eslint check finished with an error. See issue on lint-staged repository covering the problem: okonet/lint-staged#313

I should disagree with you. Lint Staged does not post-process logs of any tool it runs, it is tool-agnostic Please check that you are going to configure lint staged correctly, pay attention to:

  1. it should not introduce any new check behaviour for us it should run exact the same things that currently runs on recommit hook or restricted, we do not expect warnings < 3 should fail commit
  2. --verbose - param that is used to leave any of the tool console output
  3. --quiet - param to hide useless debug output of lint-staged itself
  4. You configure lint commands correctly, do not lint outside files, so do not use commands that prepared in npm scripts
  5. Make sure you left the common params :
    • --max-warnings 3 for eslint
    • --silent --noStackTrace for jest
    • -n -t -d spaces for lintspace
  6. Check if that's possible to speed up jest by limiting target tests
  7. I suggest the following mapping
    "*.ts": ["eslint ...", "jest ..."]
    "*.less": ["stylelint ..."]
    "*": ["lintspaces ..."]
  8. Make sure you understand our goal correct: ONLY PRE-COMMIT hook is expected as a target for optimization
  9. Check if that's possible to configure lintstaged via yml file