css/no-id-selectors
Discourage use of ID selectors in CSS.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
warning |
opinionated, nuxt |
No | None |
Applies to: Plain CSS style blocks (scss, sass, less and stylus blocks are skipped).
Bad
#submit ties the style rule to an ID selector.
<style scoped>
#submit {
font-weight: 600;
}
</style>
Good
The .submit class expresses the reusable styling hook without an ID selector.
<style scoped>
.submit {
font-weight: 600;
}
</style>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"css/no-id-selectors": "warn"
}
},
});
Then run vp run lint.