Julian Laval
Julian Laval

Reputation: 1260

ESLint file in sibling directory

Bit of an embarrassing question, apologies in advance!

I am able to run ESLint perfectly fine from the command line on files in the current directory:

eslint file1.js

However, attempting to do so on files in a sibling directory does not yield any visible output:

eslint ../folder2/file2.js

The file exists and seems to be recognised as such, since attempting to lint a file that doesn't exist yields an error.

Could someone please point me in the right direction?

Upvotes: 2

Views: 769

Answers (1)

Julian Laval
Julian Laval

Reputation: 1260

Solved!

It would seem that ESLint automatically attempts to search for an .eslintrc config file in the directory of the file being linted, rather than the working directory.

As such, the lack of output on eslint ../folder2/file2.js is simply due to no rules being applied and thus the JavaScript being automatically valid.

Fixing this is tantamount to specifying the config parameter to point to the working directory .eslintrc when running the command:

eslint -c .eslintrc ../folder2/file2.js

Upvotes: 2

Related Questions