New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

oxlint-plugin-vue-sfc

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oxlint-plugin-vue-sfc

Vue SFC template rules for oxlint, as a JS plugin. Ports of eslint-plugin-vue rules oxlint has no native equivalent for.

latest
Source
npmnpm
Version
0.2.1
Version published
Weekly downloads
3.5K
308.33%
Maintainers
1
Weekly downloads
 
Created
Source

oxlint-plugin-vue-sfc

Vue SFC template rules for oxlint, as a JS plugin.

oxlint cannot read Vue templates natively (oxc#15761), so projects keep ESLint around for eslint-plugin-vue. These 24 rules self-parse the SFC with @vue/compiler-sfc and walk the real template AST, so the checks run under oxlint instead.

Ports of eslint-plugin-vue rules that oxlint has no native equivalent for. Validated against a production Nuxt monorepo — 1581 SFCs, all template-first — where they replaced the corresponding vue/* ESLint rules outright.

Install

npm i -D oxlint-plugin-vue-sfc

Usage

Extend a preset from your .oxlintrc.json:

{
    "extends": ["./node_modules/oxlint-plugin-vue-sfc/configs/recommended.json"]
}

Two presets:

PresetRulesFor
configs/recommended.jsonall 24plain oxlint — you want the full set
configs/complement.json13you also run oxlint-vue, which covers the other 11

Or wire it up by hand:

{
    "jsPlugins": ["./node_modules/oxlint-plugin-vue-sfc/index.mjs"],
    "rules": {
        "vue-sfc/require-v-for-key": "error",
        "vue-sfc/no-raw-text": "off"
    }
}

The plugin namespace is vue-sfc, not vue — oxlint reserves vue for its native plugin and rejects a JS plugin that claims it.

Rules

RuleDefaultIn complementDescription
vue-sfc/no-child-contenterrordisallow element's child contents which would be overwritten by a directive like v-html or v-text
vue-sfc/no-dupe-v-else-iferrordisallow duplicate conditions in v-if / v-else-if chains
vue-sfc/no-duplicate-attributeserrordisallow duplication of attributes on the same element
vue-sfc/no-lone-templatewarnyesdisallow unnecessary <template>
vue-sfc/no-mutating-propserrordisallow mutation of component props
vue-sfc/no-parsing-errorerroryesdisallow parsing errors in <template>
vue-sfc/no-raw-textoffyesdisallow untranslated raw text in Vue templates (use i18n)
vue-sfc/no-ref-as-operanderroryesrequire .value when using a ref as an operand
vue-sfc/no-template-keyerrordisallow key attribute on <template> without v-for
vue-sfc/no-template-shadowwarnyesdisallow variable declarations from shadowing variables declared in the outer scope
vue-sfc/no-textarea-mustacheerrordisallow mustaches in <textarea>
vue-sfc/no-unused-componentserroryesdisallow registering components that are not used inside templates
vue-sfc/no-unused-varserroryesdisallow unused variable definitions of v-for directives or scope attributes
vue-sfc/no-use-v-if-with-v-forerrordisallow use of v-if on the same element as v-for
vue-sfc/no-useless-template-attributeserroryesdisallow useless attribute on <template>
vue-sfc/no-v-text-v-html-on-componentwarndisallow v-text / v-html on component
vue-sfc/require-component-iserrorrequire v-bind:is of <component> elements
vue-sfc/require-explicit-emitswarnyesrequire emits option with name triggered by $emit()
vue-sfc/require-toggle-inside-transitionerroryesrequire control the display of the content inside <transition>
vue-sfc/require-v-for-keyerrorrequire v-bind:key with v-for directives
vue-sfc/require-valid-default-properroryesenforce props default values to be valid
vue-sfc/this-in-templatewarndisallow usage of this in template
vue-sfc/use-v-on-exacterroryesenforce usage of exact modifier on v-on
vue-sfc/v-on-event-hyphenationwarnyesenforce v-on event naming style on custom components in template

no-raw-text defaults to off: it is an i18n rule (a replacement for @intlify/vue-i18n/no-raw-text) and only makes sense in a translated app. It takes { ignoreTags, ignorePattern }.

Known limitation: diagnostic positions

Template diagnostics currently render on the <script> block, with the true template position prepended to the message:

Comp.vue:13:1  error  vue-sfc(require-v-for-key): [template 3:9] <li> uses v-for without a :key...

oxlint gives JS-plugin rules a script-relative view of an SFC, so a template position — which in a template-first file is a negative offset — cannot be expressed. The workaround clamps the range and puts the real location in the message text.

oxc#26001 fixes this upstream with an actualRange on the diagnostic, and would give every rule here correct positions with no rule changes. Until it lands, editor jump-to-error goes to the script block.

Reduced-scope ports

Six rules deliberately implement less than their upstream counterpart. Each says so in its own file header:

  • no-dupe-v-else-if — exact duplicate conditions only, not subsumption
  • this-in-template, no-mutating-props — lexical template scan
  • require-explicit-emits — silent on an unresolvable named type reference
  • no-unused-vars, no-template-shadow — positioned scan, not a full destructuring-pattern parse
  • no-unused-components — upstream only inspects Options API components: {}, so it is inert in a <script setup> codebase; ported so the check does not vanish if that changes

They gate new violations rather than opening a migration: all 24 report zero diagnostics across the 1581-SFC corpus they were built against.

Tests

npm test    # node:test, 324 specs across 24 rules

License

MIT

Keywords

oxlint

FAQs

Package last updated on 13 Oct 2026

Related posts