Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Import in body of module; reorder to top. eslint(import/first) #1577

Open
@lipengzhou

Description

Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have read the FAQ and my problem is not listed.

Tell us about your environment

  • ESLint version: 7.31.0
  • eslint-plugin-vue version: 7.14.0
  • Node version: 14.15.1
  • Operating System: Windows 10

Please show your full configuration:

module.exports = {
 globals: {
 defineProps: 'readonly',
 defineEmits: 'readonly',
 defineExpose: 'readonly',
 withDefaults: 'readonly'
 },
 env: {
 browser: true,
 es2021: true
 },
 extends: ['plugin:vue/vue3-strongly-recommended', 'standard'],
 parserOptions: {
 ecmaVersion: 12,
 parser: '@typescript-eslint/parser',
 sourceType: 'module'
 },
 plugins: ['vue', '@typescript-eslint'],
 rules: {}
}

What did you do?

<script lang="ts">
export default {
 name: 'HomeIndex'
}
</script>
<script lang="ts" setup>
import foo from './foo.vue'

</script>

What did you expect to happen?

If use alongside normal <script> ,the script setup below will cause this error:error Import in body of module; reorder to top import/first

Then I tried to adjust their position, put script setup on top, normal script on the bottom without this error, but at run time will throw an exception:ReferenceError: Cannot access '__default__' before initialization

I think it's a contradictory question。

What actually happened?

error Import in body of module; reorder to top import/first

Repository to reproduce this issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /