babel-eslint does not allow dynamic import
I use webpack 2 and I want to make dynamic import. Linter gives the following error on dynamic import (that is import(...)
):
[js] Declaration or statement expected. (JSX attribute) import: true.
I have following .eslintrc
(excerpt):
{
"parser": "babel-eslint",
"parserOptions": {
"allowImportExportEverywhere": true
}
}
Following is installed:
"eslint": "^3.16.1",
"babel-eslint": "^7.2.3",
"babel-plugin-dynamic-import-webpack": "^1.0.1",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
babelrc configuration:
{
"presets": [
"es2015",
"react"
],
"plugins": ["syntax-dynamic-import", "dynamic-import-webpack"]
}
Update: Example where error occurs (react app). (Here the error is just [js] Declaration or statement expected
):
const App = () => {
import('./routes/Main/Main').then((Main) => {});
return(<div />);
};
javascript webpack ecmascript-6 babeljs eslint
add a comment |
I use webpack 2 and I want to make dynamic import. Linter gives the following error on dynamic import (that is import(...)
):
[js] Declaration or statement expected. (JSX attribute) import: true.
I have following .eslintrc
(excerpt):
{
"parser": "babel-eslint",
"parserOptions": {
"allowImportExportEverywhere": true
}
}
Following is installed:
"eslint": "^3.16.1",
"babel-eslint": "^7.2.3",
"babel-plugin-dynamic-import-webpack": "^1.0.1",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
babelrc configuration:
{
"presets": [
"es2015",
"react"
],
"plugins": ["syntax-dynamic-import", "dynamic-import-webpack"]
}
Update: Example where error occurs (react app). (Here the error is just [js] Declaration or statement expected
):
const App = () => {
import('./routes/Main/Main').then((Main) => {});
return(<div />);
};
javascript webpack ecmascript-6 babeljs eslint
allowImportExportEverywhere
has nothing to do withimport()
. The problem has probably nothing to do with your Babel configuration. Please post the code the linter complains about.
– Felix Kling
May 23 '17 at 21:48
stackoverflow.com/questions/42394593/… According to this, it is necessary.
– croraf
May 23 '17 at 21:52
allowImportExportEverywhere
is a configuration forimport
andexport
statements not forimport
function calls. The error is strange though.
– Felix Kling
May 23 '17 at 22:02
It is not because you have bothsyntax-dynamic-import
anddynamic-import-webpack
added to your config? shouldn't one of them be enough?
– Tokimon
Jun 13 '17 at 13:27
add a comment |
I use webpack 2 and I want to make dynamic import. Linter gives the following error on dynamic import (that is import(...)
):
[js] Declaration or statement expected. (JSX attribute) import: true.
I have following .eslintrc
(excerpt):
{
"parser": "babel-eslint",
"parserOptions": {
"allowImportExportEverywhere": true
}
}
Following is installed:
"eslint": "^3.16.1",
"babel-eslint": "^7.2.3",
"babel-plugin-dynamic-import-webpack": "^1.0.1",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
babelrc configuration:
{
"presets": [
"es2015",
"react"
],
"plugins": ["syntax-dynamic-import", "dynamic-import-webpack"]
}
Update: Example where error occurs (react app). (Here the error is just [js] Declaration or statement expected
):
const App = () => {
import('./routes/Main/Main').then((Main) => {});
return(<div />);
};
javascript webpack ecmascript-6 babeljs eslint
I use webpack 2 and I want to make dynamic import. Linter gives the following error on dynamic import (that is import(...)
):
[js] Declaration or statement expected. (JSX attribute) import: true.
I have following .eslintrc
(excerpt):
{
"parser": "babel-eslint",
"parserOptions": {
"allowImportExportEverywhere": true
}
}
Following is installed:
"eslint": "^3.16.1",
"babel-eslint": "^7.2.3",
"babel-plugin-dynamic-import-webpack": "^1.0.1",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
babelrc configuration:
{
"presets": [
"es2015",
"react"
],
"plugins": ["syntax-dynamic-import", "dynamic-import-webpack"]
}
Update: Example where error occurs (react app). (Here the error is just [js] Declaration or statement expected
):
const App = () => {
import('./routes/Main/Main').then((Main) => {});
return(<div />);
};
javascript webpack ecmascript-6 babeljs eslint
javascript webpack ecmascript-6 babeljs eslint
edited May 23 '17 at 21:55
croraf
asked May 23 '17 at 21:43
crorafcroraf
9761122
9761122
allowImportExportEverywhere
has nothing to do withimport()
. The problem has probably nothing to do with your Babel configuration. Please post the code the linter complains about.
– Felix Kling
May 23 '17 at 21:48
stackoverflow.com/questions/42394593/… According to this, it is necessary.
– croraf
May 23 '17 at 21:52
allowImportExportEverywhere
is a configuration forimport
andexport
statements not forimport
function calls. The error is strange though.
– Felix Kling
May 23 '17 at 22:02
It is not because you have bothsyntax-dynamic-import
anddynamic-import-webpack
added to your config? shouldn't one of them be enough?
– Tokimon
Jun 13 '17 at 13:27
add a comment |
allowImportExportEverywhere
has nothing to do withimport()
. The problem has probably nothing to do with your Babel configuration. Please post the code the linter complains about.
– Felix Kling
May 23 '17 at 21:48
stackoverflow.com/questions/42394593/… According to this, it is necessary.
– croraf
May 23 '17 at 21:52
allowImportExportEverywhere
is a configuration forimport
andexport
statements not forimport
function calls. The error is strange though.
– Felix Kling
May 23 '17 at 22:02
It is not because you have bothsyntax-dynamic-import
anddynamic-import-webpack
added to your config? shouldn't one of them be enough?
– Tokimon
Jun 13 '17 at 13:27
allowImportExportEverywhere
has nothing to do with import()
. The problem has probably nothing to do with your Babel configuration. Please post the code the linter complains about.– Felix Kling
May 23 '17 at 21:48
allowImportExportEverywhere
has nothing to do with import()
. The problem has probably nothing to do with your Babel configuration. Please post the code the linter complains about.– Felix Kling
May 23 '17 at 21:48
stackoverflow.com/questions/42394593/… According to this, it is necessary.
– croraf
May 23 '17 at 21:52
stackoverflow.com/questions/42394593/… According to this, it is necessary.
– croraf
May 23 '17 at 21:52
allowImportExportEverywhere
is a configuration for import
and export
statements not for import
function calls. The error is strange though.– Felix Kling
May 23 '17 at 22:02
allowImportExportEverywhere
is a configuration for import
and export
statements not for import
function calls. The error is strange though.– Felix Kling
May 23 '17 at 22:02
It is not because you have both
syntax-dynamic-import
and dynamic-import-webpack
added to your config? shouldn't one of them be enough?– Tokimon
Jun 13 '17 at 13:27
It is not because you have both
syntax-dynamic-import
and dynamic-import-webpack
added to your config? shouldn't one of them be enough?– Tokimon
Jun 13 '17 at 13:27
add a comment |
1 Answer
1
active
oldest
votes
I found the reason why this happens.
It seems VSCode has internal javascript linter that is enabled even if eslint plugin is linting. Disabling this internal linter solves the
issue. So to solve, in project (.vscode/settings.json
), user or global
VSCode settings set the following:
{
...other settings...,
"javascript.validate.enable": false
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44145543%2fbabel-eslint-does-not-allow-dynamic-import%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I found the reason why this happens.
It seems VSCode has internal javascript linter that is enabled even if eslint plugin is linting. Disabling this internal linter solves the
issue. So to solve, in project (.vscode/settings.json
), user or global
VSCode settings set the following:
{
...other settings...,
"javascript.validate.enable": false
}
add a comment |
I found the reason why this happens.
It seems VSCode has internal javascript linter that is enabled even if eslint plugin is linting. Disabling this internal linter solves the
issue. So to solve, in project (.vscode/settings.json
), user or global
VSCode settings set the following:
{
...other settings...,
"javascript.validate.enable": false
}
add a comment |
I found the reason why this happens.
It seems VSCode has internal javascript linter that is enabled even if eslint plugin is linting. Disabling this internal linter solves the
issue. So to solve, in project (.vscode/settings.json
), user or global
VSCode settings set the following:
{
...other settings...,
"javascript.validate.enable": false
}
I found the reason why this happens.
It seems VSCode has internal javascript linter that is enabled even if eslint plugin is linting. Disabling this internal linter solves the
issue. So to solve, in project (.vscode/settings.json
), user or global
VSCode settings set the following:
{
...other settings...,
"javascript.validate.enable": false
}
edited Nov 22 '18 at 10:22
answered Jun 15 '17 at 8:32
crorafcroraf
9761122
9761122
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44145543%2fbabel-eslint-does-not-allow-dynamic-import%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
allowImportExportEverywhere
has nothing to do withimport()
. The problem has probably nothing to do with your Babel configuration. Please post the code the linter complains about.– Felix Kling
May 23 '17 at 21:48
stackoverflow.com/questions/42394593/… According to this, it is necessary.
– croraf
May 23 '17 at 21:52
allowImportExportEverywhere
is a configuration forimport
andexport
statements not forimport
function calls. The error is strange though.– Felix Kling
May 23 '17 at 22:02
It is not because you have both
syntax-dynamic-import
anddynamic-import-webpack
added to your config? shouldn't one of them be enough?– Tokimon
Jun 13 '17 at 13:27