auto-import-types
v0.0.6
Published
A vite plugin for auto import types.
Downloads
120
Readme
auto-import-types
Auto Import Types on-demand for Vite. With TypeScript support. The implementation idea by unplugin-auto-import.It will automatically configure declared types in esLint's global option.
Install
npm i auto-import-types
Setup
// vite.config.ts
import { defineConfig } from 'vite'
import AutoImportTypes from 'auto-import-types'
export default defineConfig({
plugins: [AutoImportTypes()],
})
// .eslintrc.js
module.exports = {
extends: ['.eslintrc-auto-import-types.json'],
}
Config Options
type ESLintGlobalsPropValue = boolean | 'readonly' | 'readable' | 'writable' | 'writeable'
interface ESLintConfigs {
globals: Record<string, ESLintGlobalsPropValue>
}
type Options = Partial<{
dtsDir: string
filepath: string
globalsPropValue: ESLintGlobalsPropValue
}>
const defaultOptions = {
dtsDir: 'src/@types',
filepath: '.eslintrc-auto-import-types.json',
globalsPropValue: true,
}