# enforce-style-attribute

Rule `vue/enforce-style-attribute`. Enforce or forbid the use of the `scoped` and `module` attributes in SFC top level style tags

- Source: vue
- Technologies: Vue
- Kind: suspicious
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 30.6M weekly downloads of presets that enable it
- Trend: +109.3% last quarter
- Rank: #481 by reach, #116 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `vue/enforce-style-attribute` | no | no | package `eslint-plugin-vue` | [docs](https://eslint.vuejs.org/rules/enforce-style-attribute.html) |
| Biome | `suspicious/useScopedStyles` | yes | unsafe | group suspicious, since 2.4.5 | [docs](https://biomejs.dev/linter/rules/use-scoped-styles/) |

## Code examples

### Incorrect: the rule reports this

```vue
<style module></style>
```

```vue
<style></style>
```

```vue
<style scoped></style>
```

### Correct: the rule accepts this

```vue
<style scoped></style>
<style lang="scss" src="../path/to/style.scss" scoped></style>
```

```vue
<style module></style>
```

```vue
<style></style>
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import vue from "eslint-plugin-vue";

export default [
  {
    plugins: { vue },
    rules: {
      "vue/enforce-style-attribute": "error",
    },
  },
];
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "suspicious": {
        "useScopedStyles": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |

## Related rules

- [vue/no-boolean-default](https://lintradar.dev/rules/vue/no-boolean-default.md): Disallow boolean defaults
- [vue/no-root-v-if](https://lintradar.dev/rules/vue/no-root-v-if.md): Disallow `v-if` directives on root element
- [vue/no-import-compiler-macros](https://lintradar.dev/rules/vue/no-import-compiler-macros.md): Disallow importing Vue compiler macros
- [vue/no-unused-emit-declarations](https://lintradar.dev/rules/vue/no-unused-emit-declarations.md): Disallow unused emit declarations
- [vue/next-tick-style](https://lintradar.dev/rules/vue/next-tick-style.md): Enforce Promise or callback style in `nextTick`
- [vue/prefer-define-options](https://lintradar.dev/rules/vue/prefer-define-options.md): Enforce use of `defineOptions` instead of default export

---

Web page: https://lintradar.dev/rules/vue/enforce-style-attribute. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
