0

If I put this to my .eslintrc.js file I expect it to ignore only imports starting with #, but instead it turns off the rule for everything. How can I turn off no-resolved only for files starting with #, as an example require('#testmodule');

  rules: {
    'import/no-unresolved': [2, { ignore: ['^#.+$'] }],
  },
Badr Hari
  • 8,114
  • 18
  • 67
  • 100

1 Answers1

0

afaik the ignore pattern always starts at the begin of the line.

so your pattern looks for lines starting with #, e.g.: #require('testmodule');

but more importantly, you used ignore which expects a boolean and as ['^#.+$'] evals to true the rule simply gets ignored as you've noticed.

using this (or something adapted if you want to use mjs imports) should work:

rules: {
  'import/no-unresolved': [2, { ignorePattern: ['require\(#.+$\)'] }],
},
HannesH
  • 932
  • 2
  • 12