Search code examples
eslintcommonjs

Can I set Tag code in a Javascript file, to be Linted with the CommonJS standards


I am writing some Common JS. This is causing problem because I'm working in ES6 so while the word LET will compile fine when I'm running my tests it needs to be VAR in CommonJS.

Is it possible to use a esLint tag or something to say check certain block of code with different rules.


Solution

  • You can tag specific files with

    /* eslint-env commonjs */
    

    used as a comment in the file