eslint-import-resolver-vite
v2.0.1
Published
Vite module resolution plugin for eslint-plugin-import.
Downloads
49,127
Maintainers
Readme
eslint-import-resolver-vite
Vite module resolution plugin for eslint-plugin-import
. This plugin will resolve the resolve.alias
option.
Installation
npm install --save-dev eslint-import-resolver-vite
How to use
Vite config file
export const viteConfigObj = {
resolve: {
alias: {
_: path.resolve(__dirname, "src")
}
},
};
ESLint config file
NOTE:
- Since
eslint-plugin-import
doesn't support an async resolver, Vite's ResolvedConfig API cannot be utilized. - This plugin accepts a Vite config object to accommodate various setups, e.g. CJS, ESM, or mixed.
module.exports = {
settings: {
"import/resolver": {
vite: {
viteConfig: require("./vite.config").viteConfigObj, // named export of the Vite config object.
}
}
}
}