script/no-reserved-identifiers
Disallow using Vue compiler reserved identifiers.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
error |
essential, happy-path, ecosystem, nuxt, opinionated |
No | None |
Applies to: JS/TS scripts in Vue SFCs; examples show the relevant Options API or script setup form.
Bad
The bindings __props, __emit, and __sfc__ use identifiers reserved for generated Vue compiler code.
<script setup lang="ts">
const __props = { name: "Ada" };
const __emit = () => {};
const __sfc__ = {};
</script>
Good
The ordinary names props, emit, and componentData avoid those generated identifiers while retaining props and emits declarations.
<script setup lang="ts">
const props = defineProps<{ name: string }>();
const emit = defineEmits<{ save: [] }>();
const componentData = {};
</script>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"script/no-reserved-identifiers": "error"
}
},
});
Then run vp run lint.