ESLINT how to setup and use

To use eslint on your site, probably the best idea is to install it locally and do it in drupal core dir as that is location of ESLINT config files that ship by default with drupal core (.eslintrc.json and .eslintignore). So you should go to drupal core directory and then install it via yarn:

cd core && yarn install

after that you can run Eslint on your file, for example we can do it like this.

$ core/node_modules/.bin/eslint themes/custom/my_theme/js/my_custom_javascript.js 

this will give you all the info you should do to make your JS proper, you can fix that automatically with adding one flag to line above

$ core/node_modules/.bin/eslint themes/custom/my_theme/js/my_custom_javascript.js --fix