1

I recently started to get the

0:0 warning File ignored by default. Use a negated ignore pattern (like "--ignore-pattern '!<relative/path/to/filename>'") to override

message using eslint with ALE / VIM.

ALE cd to home directory and run the eslint command from there. For example if I edit:

~/tmp/.test/foo.js

It runs something like:

/bin/bash -c cd /home/user && \
/home/user/node_modules/eslint/bin/eslint.js -f json --stdin \
--stdin-filename /home/user/tmp/.test/foo.js < /tmp/v7TXBK0/4/foo.js

I can replicate it by running:

~$ npx eslint tmp/.test/foo.js
# or
~$ node_modules/eslint/bin/eslint.js tmp/.test/foo.js

Even if I add a .eslintrc.js file in ~/tmp/.test/ with:

"ignorePatterns": [
    "!foo.js"
],

or other variants, it still gives the same warning and halts parsing. Using the --debug flag it show that the paths are added to ignore list. It also say:

  eslintrc:ignore-pattern   processed: { 
        basePath: '/home/user', 
        patterns: [ 
              '/**/node_modules/*', 
              '!/tmp/.test/**/foo.js' 
  ] }

  eslintrc:ignore-pattern Check {
        filePath: '/home/user/tmp/.test/foo.js',
        dot: false,
        relativePath: 'tmp/.test/foo.js',
        result: true
  }

What to do here to make it parse the files?

(If I run eslint from the target directory it works fine.)

My real files for current project are in a deeper tree; like: ~/.dir/sub1/sub2/*

Err488
  • 75
  • 4

1 Answers1

0

Tried all kinds of patterns in local .eslintrc.js but to no avail.

Ended up using this as global ~/.eslintrc.js, which works, but perhaps not the best solution:

module.exports = {
        "ignorePatterns": [
                "!*"
        ]
}

This means one can not use "root": true in local / project rc file.

Err488
  • 75
  • 4