Skip to content

Commit 6e387ff

Browse files
committed
Add stylelint and update Aliki's css according to suggestions
1 parent 6b7a515 commit 6e387ff

File tree

7 files changed

+2121
-455
lines changed

7 files changed

+2121
-455
lines changed

.github/workflows/lint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ jobs:
3131
# npx should be available by default so we don't need `setup-node` action
3232
# Don't lint erb files outside of lib as the current directory also includes vendor/bundle
3333
run: npx @herb-tools/linter "lib/**/*.rhtml"
34+
- name: Install npm dependencies
35+
run: npm ci
36+
- name: Run stylelint
37+
run: npm run lint:css

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
/_site
1111
/pkg
1212
/tmp
13+
/node_modules
1314
Gemfile.lock

.stylelintrc.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "stylelint-config-standard",
3+
"plugins": ["stylelint-value-no-unknown-custom-properties"],
4+
"ignoreFiles": [
5+
"lib/rdoc/generator/template/darkfish/css/**/*.css"
6+
],
7+
"rules": {
8+
"csstools/value-no-unknown-custom-properties": true,
9+
"custom-property-no-missing-var-function": true,
10+
"no-descending-specificity": null
11+
}
12+
}

AGENTS.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,26 @@ npx @herb-tools/linter "lib/**/*.rhtml"
6262
**Template Location:** `lib/rdoc/generator/template/**/*.rhtml`
6363
**CI Workflow:** `.github/workflows/lint.yml`
6464

65+
#### Stylelint (CSS Files)
66+
67+
```bash
68+
# Lint CSS files
69+
npm run lint:css
70+
71+
# Auto-fix style issues
72+
npm run lint:css -- --fix
73+
74+
# Lint specific file
75+
npx stylelint "lib/rdoc/generator/template/aliki/css/rdoc.css"
76+
```
77+
78+
**Configuration:** `.stylelintrc.json`
79+
**Features:**
80+
- Detects undefined CSS custom properties (variables)
81+
- Detects missing `var()` function for custom properties
82+
- Style and formatting checks
83+
- Many issues auto-fixable with `--fix`
84+
6585
### Documentation Generation
6686

6787
```bash
@@ -198,6 +218,7 @@ Use Red, Green, Refactor approach:
198218
6. **Lint your changes**:
199219
- Ruby code: `bundle exec rubocop -A` (auto-fix when possible)
200220
- ERB templates: `npx @herb-tools/linter "**/*.rhtml"` (if modified)
221+
- CSS files: `npm run lint:css -- --fix` (if modified)
201222

202223
### Modifying Parsers
203224

@@ -228,15 +249,20 @@ When making changes to theme CSS or templates (e.g., Darkfish or Aliki themes):
228249
6. **Verify with sub-agent**: Use Task tool again to launch agent that uses Browser MCP to verify fixes
229250
- Agent takes screenshots and compares to original issues
230251
- Agent reports back whether issues are resolved
231-
7. **Lint templates** (if modified): Run `npx @herb-tools/linter "lib/rdoc/generator/template/**/*.rhtml"`
252+
7. **Lint changes** (if modified):
253+
- ERB templates: `npx @herb-tools/linter "lib/rdoc/generator/template/**/*.rhtml"`
254+
- CSS files: `npm run lint:css -- --fix`
232255
8. **Stop server**: Kill the HTTP server process when done
233256

234257
**Tip:** Keep HTTP server running during iteration. Just regenerate with `bundle exec rake rerdoc` between changes.
235258

236259
## Notes for AI Agents
237260

238261
1. **Always run tests** after making changes: `bundle exec rake`
239-
2. **Check both RuboCop and Herb** for linting
262+
2. **Lint your changes**:
263+
- RuboCop for Ruby: `bundle exec rubocop -A`
264+
- Herb for ERB templates: `npx @herb-tools/linter "**/*.rhtml"`
265+
- Stylelint for CSS: `npm run lint:css -- --fix`
240266
3. **Regenerate parsers** if you modify `.ry` or `.kpeg` files
241267
4. **Use `rake rerdoc`** to regenerate documentation (not just `rdoc`)
242268
5. **Verify generated files** with `rake verify_generated`

0 commit comments

Comments
 (0)