question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: An import declaration can only be used at the top level of a module

See original GitHub issue

In 1.65, ESLint find problems “An import declaration can only be used at the top level of a module.” but in 1.64.2, ESLint not found any problems

The code is:

import { useRouter } from "vue-router";
const router = useRouter();

import OtherView from './OtherView.vue'

ESLint v2.2.2 Released on 2015/11/16 19:58:32 Last updated 2022/1/13 17:49:56 Identifier dbaeumer.vscode-eslint

Version: 1.65.0 (Universal) Commit: b5205cc8eb4fbaa726835538cd82372cc0222d43 Date: 2022-03-02T11:11:20.886Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Darwin x64 21.3.0

Version: 1.64.2 (Universal) Commit: f80445acd5a3dadef24aa209168452a3d97cc326 Date: 2022-02-09T22:00:58.347Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Darwin x64 21.3.0

Please clone the project: https://github.com/cn2156/vue3-for-test-eslint, then read the README.md to show the details.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
yaegassycommented, Apr 2, 2022

ESlint issue has nothing to do with volar.

Check the eslint extension or eslint-plugin-vue documentation and issue. If you do not find the cause, please report the issue.

0reactions
cn2156commented, Apr 4, 2022

Why in vscode 1.64.2, the lint was passed? It is a bug of vscode ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue 3: Setup Script, TS Problem: "An import declaration can ...
Show activity on this post. when using in Vue 3 the setup script with typescript, I get an error in vscode saying: "An...
Read more >
Vue typescript 4.7.4 for each import in .vue file shows Project ...
For each import in .vue file shows an error: TS1232: An import declaration can only be used at the top level of a...
Read more >
Error message: An import declaration can only be used in a ...
The import line must be at the top of your code (before the $w.onReady. + the path to the imported module is wrong....
Read more >
import declarations may only appear at top level of a module
For bugs involving calls between JavaScript and C++, use the "XPConnect" component.
Read more >
import declaration may only appear at top level of a module
Also, your error SyntaxError: import declarations may only appear at top level of a module may happen if you use an import statement...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found