dev.meghraj
dev.meghraj

Reputation: 9120

How to specifiy ES version within js comment when using ESLint

We are using using ESLint project wide, and there is grunt, clouser-complier, typescript etc to do all hard work to make all js file es5 compliant.

but there is one file which we don't process via these tools, because that is small file we've to serve to browser directly.

How can i specify version of that file to es5 to eslint, so it don't show errors and warnings for that particular file, i saw there are options we can set via comment on top, but how js version could be set.

Upvotes: 1

Views: 471

Answers (2)

dev.meghraj
dev.meghraj

Reputation: 9120

As per https://github.com/xojs/eslint-config-xo/issues/16#issuecomment-190302577

its not possible to do, so only thing we can do is completely turn it off by this comment.

/* eslint-disable */

thanks @felipekm

Upvotes: 0

Telokis
Telokis

Reputation: 3389

Eslint supports an overrides property inside its config file:

overrides: [
    {
        files: [
            "path/to/file.js"
        ],
        parserOptions: {
            ecmaVersion: 5
        },
    },
],

Upvotes: 2

Related Questions