eslint-plugin-assets
v1.0.6
Published
Helps check whether statically imported resources exist
Downloads
48
Maintainers
Readme
eslint-plugin-assets
Helps check whether statically imported resources exist, Even if you use aliases or files starting width .
For example, in the Vite project, there may be a client. d.ts file for static resources, and all ts cannot handle whether this file exists well. Especially during development, it may cause build code errors and cause some build problems. This plugin can effectively avoid this situation
Installation
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-assets
:
npm install eslint-plugin-assets --save-dev
Usage
Add assets
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"assets"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"assets/check": "error"
}
}
You can also use advanced(alias & extensions) configuration to config files you need check!
{
"rules": {
"assets/check": [
"error", {
alias: {'@': 'src'} // default,
extensions: ['.png', '.jpg', '.jpeg', '.gif', '.svg'] // default
}
]
}
}