Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Ensures es6 Imports and Exports Don't Cause Errors #79

Closed

Conversation

ggwicz
Copy link

@ggwicz ggwicz commented Aug 1, 2019

Before this change, let's say you have some simple code like the following atop a JS file:

import Cool from './Cool';
import Wow from './Wow';

Even with es6: true enabled in our coding standards' .eslintrc.js file, these trigger a linting error as follows:

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'

This is an error that is often fixed just by adding sourceType: module to the .eslintrc.js's parserOptions option, but I've found that it required all of the changes seen in this file diff to make it work.

@ggwicz ggwicz requested a review from aubreypwd August 1, 2019 15:17
@ggwicz ggwicz self-assigned this Aug 1, 2019
@ggwicz ggwicz added the bug label Aug 1, 2019
@aubreypwd
Copy link
Contributor

@ggwicz Just acknowledging this. Are we sure that this doesn't affect es5 JS? Also do you think you could also add a patch for this in https://github.com/WebDevStudios/js-coding-standards which will be the future home of JS coding standards?

@ggwicz
Copy link
Author

ggwicz commented Aug 6, 2019

@aubreypwd To my knowledge there shouldn't be negative effects is using es5, since es6 is backwards compatible. And this change is additive—it just whitelists an es6 feature, essentially, no blacklisting of es5 features.

@ggwicz
Copy link
Author

ggwicz commented Aug 6, 2019

This is now recreated over in the JS Coding Standards repo → WebDevStudios/js-coding-standards#6

@ggwicz ggwicz removed the bug label Aug 6, 2019
@aubreypwd
Copy link
Contributor

With the new modern package js-coding-standards, I am not experiencing this:

Could you verify if this is still happening for you using the newer package?

@aubreypwd
Copy link
Contributor

Closing out for WebDevStudios/eslint-config-js-coding-standards#6 since WDS-Coding-Standards will soon be deprecated.

@aubreypwd aubreypwd closed this Feb 20, 2020
@aubreypwd aubreypwd deleted the fix/ensure-es-imports-exports-dont-cause-error branch February 20, 2020 14:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants