Skip to content
Back to skills

2918 Strict Css Modules 4880e0b8

ASecurity

**Impact: MEDIUM** - catches typos in CSS module class names at compile time When using CSS modules with `<style module>`, Vue doesn't validate class names by default. Enable `strictCssModules` to catch typos and undefined classes.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
toolsgovuegit

Works with

  • cli

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 2918-strict-css-modules_4880e0b8 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2918 Strict Css Modules 4880e0b8?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 2918 Strict Css Modules 4880e0b8
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2918-strict-css-modules-4880e0b8/badge)](https://www.skillsdirectory.com/skills/tools-only-2918-strict-css-modules-4880e0b8)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
title: Enable Strict CSS Modules Type Checking
impact: MEDIUM
impactDescription: catches typos in CSS module class names at compile time
type: capability
tags: strictCssModules, vueCompilerOptions, css-modules, style-module
---

# Enable Strict CSS Modules Type Checking

**Impact: MEDIUM** - catches typos in CSS module class names at compile time

When using CSS modules with `<style module>`, Vue doesn't validate class names by default. Enable `strictCssModules` to catch typos and undefined classes.

## Problem

CSS module class name errors go undetected:

```vue
<script setup lang="ts">
// No error for typo in class name
</script>

<template>
  <div :class="$style.buttn">Click me</div>
</template>

<style module>
.button {
  background: blue;
}
</style>
```

The typo `buttn` instead of `button` silently fails at runtime.

## Solution

Enable `strictCssModules` in your tsconfig:

```json
// tsconfig.json or tsconfig.app.json
{
  "vueCompilerOptions": {
    "strictCssModules": true
  }
}
```

Now `$style.buttn` will show a type error because `buttn` doesn't exist in the CSS module.

## What Gets Checked

| Access | With strictCssModules |
|--------|----------------------|
| `$style.validClass` | OK |
| `$style.typo` | Error: Property 'typo' does not exist |
| `$style['dynamic']` | OK (dynamic access not checked) |

## Limitations

- Only checks static property access (`$style.className`)
- Dynamic access (`$style[variable]`) is not validated
- Only works with `<style module>`, not external CSS files

## Reference

- [Vue Language Tools Wiki - Vue Compiler Options](https://github.com/vuejs/language-tools/wiki/Vue-Compiler-Options)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.