Skip to content

Make package json scripts more consistent

What does this MR do?

Move eslint related yarn scripts to the lint scope

We are currently overloading the eslint command with our custom eslint logic. Unfortunately this causes us to run eslint on all js/vue files and makes it hard to run custom eslint commands. One has to resort to running e.g. node_modules/.bin/eslint directly.

In an effort to consolidate the situation we are renaming the commands (borrowing from our rake syntax) as follows:

  • eslint => lint:eslint
  • eslint-fix => lint:eslint:fix
  • eslint-staged => lint:eslint:staged
  • eslint-staged-fix => lint:eslint:staged:fix
  • eslint-report => lint:eslint:report

All but the eslint command have been replaced with a command that errors out immediately and hints folks to the new command.

Move prettier related yarn scripts to the lint scope

Similar to eslint, this moves our prettier related scripts to the lint scope. We keep the old scripts in place and error out immediately, hinting the user to the new scripts.

Thanks to the introduced scripts/frontend/execute-on-staged-files.sh and the fact that prettier itself has implemented better command line interfaces (--check and --write) since we introduced it, we are able to remove our home made node script in favor of those.

Now the scripts carry the following names:

  • prettier-all => lint:prettier
  • prettier-all-save => lint:prettier:fix
  • prettier-staged => lint:prettier:staged
  • prettier-staged-save: lint:prettier:staged:fixed

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Lukas 'ai-pi' Eipert

Merge request reports