Way to enforce strict mode on ES6 modules when not implicit due to transpiling issue?
See original GitHub issueIn my .eslint.js
I have something like
module.exports = {
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
impliedStrict: false
}
},
rules: {
strict: ['error', 'global'],
...
}
...
};
When I place 'use strict';
on the top of my JavaScript files ESLint gives me the error:
‘use strict’ is unnecessary inside of modules. (strict)
I was hoping this error wouldn’t appear since I’m disabling the impliedStrict
parser option.
However impliedStrict
is defined as
impliedStrict - enable global strict mode (if ecmaVersion is 5 or greater)
And I’m inside a module there, so perhaps this is a request to extend the definition of impliedStrict
to include modules, or provide another ecmaFeatures named something like impliedStrictModules
?
Background
Meteor 1.3’s ecmascript module enables ES2015 support but it doesn’t include implicit strict mode.
- ESLint for Meteor 1.3 “modules” and strict mode
- [1.3] Full ES2015 module support is claimed, but strict mode not on
If this gets resolved in Meteor, I won’t have a need for this rule. However I don’t think Meteor would fix this until a Major release because breaking changes. I’m guessing other frameworks may have this issue as well if they chose not to enable strict mode in their babel parsing options.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
Feature request opened on eslint-plugin-meteor at Enforce strict mode on ES6 modules when not implicit due to transpiling issue
I agree. Meteor plugin could just clone
strict
rule and modify it to work specifically for meteor’s needs. Closing as it doesn’t look like we need to address anything here.