convention-lint 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -0
- package/dist/convention-lint.js +1 -1
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Convention Lint
|
|
2
|
+
|
|
3
|
+
Enforce consistent naming conventions for files, folders, and HTML/JSX/Vue/Svelte class & id attributes — with real-time diagnostics and Quick Fix.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Search **"Convention Lint"** in the VS Code Marketplace, or:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
ext install Drangon-Knight.convention-lint
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### CLI
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g convention-lint
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
### Real-time Diagnostics (Problems Panel)
|
|
22
|
+
|
|
23
|
+
Convention Lint reports violations directly in the **Problems** panel — just like ESLint or Stylelint.
|
|
24
|
+
|
|
25
|
+
- Inline wavy underlines on violations
|
|
26
|
+
- Detailed messages with violation reason
|
|
27
|
+
- Severity levels: Error, Warning, Information, Hint, or Off
|
|
28
|
+
|
|
29
|
+
### Quick Fix + Fix All
|
|
30
|
+
|
|
31
|
+
Click the lightbulb or press `Ctrl+.` on a violation to auto-convert:
|
|
32
|
+
|
|
33
|
+
- `myClass` → `my-class` (kebab-case)
|
|
34
|
+
- `my-component` → `myComponent` (camelCase)
|
|
35
|
+
- **Fix All Convention Lint** — fix every violation in one click
|
|
36
|
+
|
|
37
|
+
### Disable Comments
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<!-- convention-lint-disable -->
|
|
41
|
+
<div class="IgnoreThis"></div>
|
|
42
|
+
<!-- convention-lint-enable -->
|
|
43
|
+
|
|
44
|
+
<!-- convention-lint-disable-next-line -->
|
|
45
|
+
<div class="ThisLineOnly"></div>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Supported Naming Rules
|
|
49
|
+
|
|
50
|
+
| Rule | Pattern | Example |
|
|
51
|
+
|------|---------|---------|
|
|
52
|
+
| `kebab-case` | lowercase + hyphens | `my-component` |
|
|
53
|
+
| `camelCase` | lowercase first, capitalize words | `myComponent` |
|
|
54
|
+
| `PascalCase` | capitalize all words | `MyComponent` |
|
|
55
|
+
| `snake_case` | lowercase + underscores | `my_component` |
|
|
56
|
+
| `lowercase` | lowercase only, no separators | `mycomponent` |
|
|
57
|
+
|
|
58
|
+
### Supported File Types
|
|
59
|
+
|
|
60
|
+
| Language | Attributes |
|
|
61
|
+
|----------|-----------|
|
|
62
|
+
| HTML | `class`, `id`, `src` |
|
|
63
|
+
| Vue | `class`, `:class`, `v-bind:class` |
|
|
64
|
+
| JSX / TSX | `className` |
|
|
65
|
+
| Angular | `class`, `[ngClass]`, `[class.name]` |
|
|
66
|
+
| Svelte | `class`, `class:name` |
|
|
67
|
+
| PHP | `class`, `id` (template syntax excluded) |
|
|
68
|
+
|
|
69
|
+
### Atomic CSS Detection
|
|
70
|
+
|
|
71
|
+
Automatically skips 300+ utility-first CSS class names (df, jcc, w100px, bgFFFFFF, sm-dn, hover-o80, etc.)
|
|
72
|
+
|
|
73
|
+
## Configuration
|
|
74
|
+
|
|
75
|
+
Create `.convention.json` in your project root:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"convention": {
|
|
80
|
+
"classNamingRule": "kebab-case",
|
|
81
|
+
"idNamingRule": "camelCase",
|
|
82
|
+
"fileNamingRule": "kebab-case",
|
|
83
|
+
"folderNamingRule": "lowercase",
|
|
84
|
+
"extensions": [".html", ".vue", ".jsx", ".tsx", ".svelte", ".php"],
|
|
85
|
+
"ignoreAtomicCSS": true,
|
|
86
|
+
"severity": "warning",
|
|
87
|
+
"ignore": ["node_modules", ".git", "dist"],
|
|
88
|
+
"ignorePatterns": ["**/*.test.*"]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Per-Rule Severity
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"convention": {
|
|
98
|
+
"severity": "warning",
|
|
99
|
+
"classSeverity": "error",
|
|
100
|
+
"idSeverity": "hint",
|
|
101
|
+
"pathSeverity": "off"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## CLI Usage
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
convention-lint lint [dir] # Scan folder
|
|
110
|
+
convention-lint lint --no-fail # Warn only (CI mode)
|
|
111
|
+
convention-lint check <files...> # Check specific files (pre-commit)
|
|
112
|
+
convention-lint watch [dir] # Watch mode
|
|
113
|
+
convention-lint init # Create .convention.json
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Commands
|
|
117
|
+
|
|
118
|
+
| Command | Shortcut | Description |
|
|
119
|
+
|---------|----------|-------------|
|
|
120
|
+
| Check & Save | `Ctrl+S` | Validate then save |
|
|
121
|
+
| Check Folder | — | Scan a folder |
|
|
122
|
+
| Check Workspace | — | Scan all files |
|
|
123
|
+
| Toggle ON/OFF | — | Enable/disable |
|
|
124
|
+
|
|
125
|
+
## Links
|
|
126
|
+
|
|
127
|
+
- [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=Drangon-Knight.convention-lint)
|
|
128
|
+
- [GitHub](https://github.com/Yoodaekyung/Convention-Lint)
|
|
129
|
+
- [Issues](https://github.com/Yoodaekyung/Convention-Lint/issues)
|