eslint-processor-vue-blocks enables ESLint to process individual blocks within Vue Single File Components (SFCs) by creating virtual files for each block (e.g., `<style>`, `<custom-block>`). This allows for more granular linting, applying different ESLint configurations and rules to specific parts of a Vue component. The current stable version is 2.0.0, which introduced breaking changes by requiring ESLint v9+ and becoming an ESM-only package. The package is maintained by Antfu and sees updates driven by ecosystem changes like new ESLint versions or Vue SFC parsing improvements. Its key differentiator is providing a flexible way to extend `eslint-plugin-vue`'s default processing, enabling linting of styles or custom blocks independently, which `eslint-plugin-vue` typically delegates or ignores.
npm install eslint-processor-vue-blocksVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure `eslint-processor-vue-blocks` with ESLint flat config to lint Vue SFC `<style>` and custom blocks alongside `eslint-plugin-vue`.
Upgrade ESLint to version 9.x or later. Ensure your project dependencies reflect `"eslint": "^9.0.0"`.
If you are using CommonJS, you must switch your ESLint configuration (e.g., `eslint.config.js`) to use ESM syntax (`import`/`export`) or use a tool like `esm-hook` to enable ESM in your CJS environment. Ensure your `package.json` specifies `"type": "module"` if your config is in a `.js` file.
It is generally recommended to set `script: false` and `template: false` in the `blocks` option of `processorVueBlocks` to avoid conflicts with `eslint-plugin-vue`'s built-in processing.
Ensure `@vue/compiler-sfc` is installed in your project. Add `npm i -D @vue/compiler-sfc` or `yarn add -D @vue/compiler-sfc`.
Ensure your ESLint configuration file (`eslint.config.js`) is treated as an ES Module. This typically means adding `"type": "module"` to your `package.json` or renaming the config file to `.mjs`.
Verify that you are using `import processorVueBlocks from 'eslint-processor-vue-blocks'` and that your environment supports ES Modules.
Install `eslint-plugin-vue` (e.g., `npm i -D eslint-plugin-vue`) and ensure it is included in your ESLint flat config under the `plugins` key.