Search code examples
javascriptconsolejslinteslint

Do ESLint on a console to check if all files of a project are fine


I just installed ESLint and created a package.json for my project (which is an meteor project).

npm install -g eslint

Now I would like to test all my *.js-files in my project folder. How do I do that?

I tried to do

cd project
eslint -c package.json *.js

But nothing is happening.

At the end I want to do a test, if all files are ok, so I can do a merge / deploy or what so ever.


Solution

  • eslint app-directory/

    The -c lets you define a config file, though the package.json won't serve as a valid eslint config.

    This is a example eslint conifg: https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/es6.js

    You just can create a .eslintrc file from where you execute your eslint command and it will use it as a default config (without you specifying it via -c)