Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
vite-plugin-checker
Advanced tools
Vite plugin that runs TypeScript type checker on a separate process.
vite-plugin-checker is a Vite plugin that provides various types of code checking functionalities, such as TypeScript, VLS (Vetur Language Server), and ESLint. It helps developers catch errors and enforce coding standards during the development process.
TypeScript Checking
This feature enables TypeScript checking in your Vite project. It ensures that TypeScript errors are caught during the development process.
import { defineConfig } from 'vite';
import Checker from 'vite-plugin-checker';
export default defineConfig({
plugins: [
Checker({ typescript: true })
]
});
VLS (Vetur Language Server) Checking
This feature integrates VLS (Vetur Language Server) checking into your Vite project, which is particularly useful for Vue.js projects. It helps catch errors and enforce coding standards for Vue components.
import { defineConfig } from 'vite';
import Checker from 'vite-plugin-checker';
export default defineConfig({
plugins: [
Checker({ vls: true })
]
});
ESLint Checking
This feature enables ESLint checking in your Vite project. It helps enforce coding standards and catch linting errors in your JavaScript/TypeScript code.
import { defineConfig } from 'vite';
import Checker from 'vite-plugin-checker';
export default defineConfig({
plugins: [
Checker({ eslint: { files: ['./src'] } })
]
});
vite-plugin-eslint is a Vite plugin that specifically focuses on integrating ESLint into your Vite project. It provides similar ESLint checking functionalities as vite-plugin-checker but does not offer TypeScript or VLS checking.
vite-plugin-ts-checker is a Vite plugin that focuses on TypeScript type checking. It provides similar TypeScript checking functionalities as vite-plugin-checker but does not offer ESLint or VLS checking.
vite-plugin-vue is a Vite plugin that provides Vue.js support, including VLS (Vetur Language Server) integration. It offers similar VLS checking functionalities as vite-plugin-checker but does not provide TypeScript or ESLint checking.
A Vite plugin that can run TypeScript, VLS, vue-tsc, ESLint in worker thread.
Install plugin.
yarn add vite-plugin-checker -D
Add it to Vite config file.
// vite.config.js
import checker from 'vite-plugin-checker'
export default {
plugins: [checker({ typescript: true })], // e.g. use TypeScript check
}
Open localhost page and start development 🚀.
It's recommended to open browser for a better terminal display, see #27.
Detailed configuration is in advanced config section.
Make sure typescript is installed as a peer dependency.
Add typescript
field to plugin config.
export default {
plugins: [checker({ typescript: true } /** TS options */)],
}
yarn add vls -D
vls
field to plugin config.module.exports = {
plugins: [checker({ vls: true })],
}
Only support checking in build mode since vue-tsc
doesn't support watch mode for now.
Make sure vue-tsc is installed as a peer dependency.
Add vueTsc
field to plugin config.
(Optional) The type check is powered by vue-tsc
so it supports Vue2 according to the documentation, you need to install @vue/runtime-dom
by yourself.
export default {
plugins: [checker({ vueTsc: true })],
}
Make sure eslint is installed as a peer dependency.
Add eslint
field to plugin config.
export default {
plugins: [
checker({
eslint: {
files: ['./src'],
extensions: '.ts',
},
}),
],
}
Plugin can accept an object configuration.
export default {
plugins: [checker(config /** Object config below */)],
}
field | Type | Default value | Description |
---|---|---|---|
overlay | boolean | Same as server.hmr.overlay | Show Vite error overlay when there's an error |
field | Type | Default value | Description |
---|---|---|---|
enableBuild | boolean | true | Enable checking in build mode |
For each checker config fields below:
true
to use checker with it's default valuesfield | Type | Default value | Description |
---|---|---|---|
root | string | Vite config root | Root path to find tsconfig file |
tsconfigPath | string | "tsconfig.json" | Relative tsconfig path to root |
coming soon.
field | Type | Default value | Description |
---|---|---|---|
coming soon.
field | Type | Default value | Description |
---|---|---|---|
field | Type | Default value | Description |
---|---|---|---|
files | string | string[] | This value is required | The lint target files. This can contain any of file paths, directory paths, and glob patterns. (Details). |
extensions | string[] | ['.js'] | Specify linted file extensions, 'extensions' must be an array of non-empty strings, e.g. ['.jsx', '.js'] . (Details). |
Run projects in playground/*
to try it out.
pnpm i
npm run build
cd ./playground/<ONE_EXAMPLE> # ts / vls / vue-tsc / vanilla ts
npm run dev # test serve
npm run build # test build
MIT License © 2021 fi3ework
0.3.1 (2021-07-19)
FAQs
Vite plugin that runs TypeScript type checker on a separate process.
The npm package vite-plugin-checker receives a total of 851,176 weekly downloads. As such, vite-plugin-checker popularity was classified as popular.
We found that vite-plugin-checker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.