My project uses Webpack and es6 modules for most of the files. These files run in browser, and bundled by Webpack.
There are just a small number of files, that run in node. They are not touched by Webpack and I don't see any benefit including them in webpack. They don't support import
as it's not implemented yet in node (or V8).
Now in .eslintrc
, if I set parserOptions.sourceType
to script
, it errs out in the browser files ("import
and export
only allowed in module!"). If parserOptions.sourceType
set to module
, it errs out in node files.
So how to do per-file parserOptions
? /* eslint-env xxx */
doesn't work in this case
Edit
I can probably use directory-specific .eslintrc
, but that would mean duplicate all other configs for the sake of changing just one option. Any better option?
.eslintrc
files? I was under the impression that they inherited the config from any.eslintrc
in the parent directory. I have a vague memory of using that feature. – Purity