Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed eslint rule that checks modules #6403

Closed

Conversation

bestander
Copy link
Contributor

Removed eslint rule that checks modules

After we updated to ESLint 2.x, ESLint started complaining 'use strict' is unnecessary inside of modules strict.
This is correct behaviour because according to spec modules are strict.
The problem is that our transforms don't transpile strict mode so we still need to have this pragma in all our code.

I did not find a way to make eslint require "use strict" for ES6 modules: eslint/eslint#2785
So I am removing this.

What stops us from automatically adding strict mode with babel?

Need your feedback, @frantic @martinbigio
David said that you Martin looked into this.

After we updated to ESLint 2.x, ESLint started complaining "'use strict' is unnecessary inside of modules  strict".
This is correct behaviour because according to spec modules are strict.
The problem is that our transforms don't transpile strict mode so we still need to have this pragma in all our code.

I did not find a way to make eslint require "use strict" for ES6 modules: eslint/eslint#2785
So I am removing this.

What stops us from automatically adding strict mode with babel?
@facebook-github-bot
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @frantic, @spicyj and @ericvicenti to be potential reviewers.

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Mar 10, 2016
@facebook-github-bot
Copy link
Contributor

@bestander updated the pull request.

@corbt
Copy link
Contributor

corbt commented Mar 10, 2016

Related: #5796

@janicduplessis
Copy link
Contributor

The babel transform is not currently adding strict mode but it should work since #5422 so we'd need to enable the strict mode transform as per #5796.
The best would be to keep the eslint rule and codemod out all the 'use strict'.

@frantic
Copy link
Contributor

frantic commented Mar 10, 2016

I agree with @janicduplessis, as long as we keep the code consistent it should be easy to write a codemod. cc @vjeux, do you remember why we opted into using 'use strict' manually?

@vjeux
Copy link
Contributor

vjeux commented Mar 10, 2016

I do not know why we don't automatically insert use strict in es6 modules.

@ide
Copy link
Contributor

ide commented Mar 10, 2016

When providesModule was introduced, there was some code that relied on CommonJS semantics which led to two things: 'use strict' was not enforced and people could write code that was valid inside of a function but not a module's top-level scope.

That said to my knowledge FB is still on require and doesn't use language-level ES6 modules (export default) so maybe we could do something where CommonJS modules need "use strict" but ES6 ones are always strict.

@martinbigio
Copy link
Contributor

@facebook-github-bot shipit

@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are an FB employee go to Phabricator to review.

@martinbigio
Copy link
Contributor

As it has been mentioned on #5796, internally at FB we have a few modules which are not strict mode compliant. We can land #5796 as indicated on that issue

@ghost ghost closed this in 26b2aa9 Mar 10, 2016
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants