0.0.4 • Published 5 months ago

nuxt-eslint-auto-components-import v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Nuxt ESLint - Auto Components Import

npm version npm downloads License Nuxt

!IMPORTANT Experimental :)

Setup

npm i -D nuxt-eslint-auto-components-import @nuxt/eslint

Configuration

export default defineNuxtConfig({
  modules: [
    // Both modules are required
    '@nuxt/eslint',
    'nuxt-eslint-auto-components-import'
  ],
  eslintAutoComponentsImport: {
    // Whether to use relative path imports
    // If false, will use #components alias
    // Default: true
    relative: true
  }
})

!TIP It's recommended to use it with @antfu/nuxt-eslint-auto-explicit-import for the best auto-import experience.

Usage

This module automatically handles component imports. When you use a component in your file, ESLint will automatically add the necessary import statements.

Example

<script setup>
// or
import { TestComponent } from '#components' // when relative: false
import { TestComponent } from './components/TestComponent.vue' // when relative: true
</script>

<!-- ESLint will automatically add the following imports -->
<template>
  <TestComponent />
</template>

Credits

0.0.4

5 months ago

0.0.3

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago