Skip to content

Commit

Permalink
[CI] Add stylelint to help prevent typos in CSS (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frenzie committed Mar 1, 2024
1 parent 119b873 commit f0ba598
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 3 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,17 @@ jobs:

- name: Lint
run: .ci/script.sh

# NPM tests

- name: Uses Node.js
uses: actions/setup-node@v4
with:
node-version: 'latest'
# No cache, there are complaints about lockfiles that we don't want otherwise. See <https://github.com/actions/setup-node/issues/928>.
# cache: 'npm'

- run: npm init --yes && npm install stylelint stylelint-config-standard

- name: Check CSS syntax (only epub.css, html5.css and fb2.css)
run: npx stylelint cr3gui/data/epub.css cr3gui/data/html5.css cr3gui/data/fb2.css
66 changes: 66 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"extends": "stylelint-config-standard",
"rules": {
"comment-empty-line-before": null,
"declaration-block-no-redundant-longhand-properties": null,
"declaration-block-single-line-max-declarations": null,
"length-zero-no-unit": [true, { "severity": "warning" }],
"no-descending-specificity": [true, { "severity": "warning" }],
"no-duplicate-selectors": [true, { "severity": "warning" }],
"property-no-unknown": [true, {
"ignoreProperties": [
"binding",

"hyphenate"
]
}],
"rule-empty-line-before": null,
"selector-attribute-quotes": null,
"selector-class-pattern": "(^([a-z][a-z0-9]*)(-[a-z0-9]+)*$|^fb2_info$)",
"selector-type-case": ["lower", {
"ignoreTypes": ["DocFragment", "rubyBox"]
}],
"selector-type-no-unknown": [true, {
"ignoreTypes": [
"noframes",
"rbc",

"DocFragment",
"rubyBox",

"empty-line",

"author",
"date",
"description",
"genre",

"epigraph",
"v",
"stanza",
"poem",
"text-author",
"epigraph",

"book-title",
"subtitle",
"title-info",
"keywords",
"lang",
"src-lang",
"translator",
"document-info",
"publish-info",
"custom-info",
"coverpage",
"underline",
"spacing",
"emphasis",
"underline",
"strikethrough",
"spacing"
]
}],
"shorthand-property-no-redundant-values": null
}
}
4 changes: 1 addition & 3 deletions cr3gui/data/fb2.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ title, h1, h2, h3, h4, h5, h6, subtitle {
h1, h2, h3, h4, h5, h6 {
display: block;
margin-top: 0.5em;
margin-bottom: 0.3em;
padding: 10px ;
margin-top: 0.5em;
margin-bottom: 0.5em;
padding: 10px ;
}
title, h1, h2 {
page-break-before: always;
Expand Down

0 comments on commit f0ba598

Please sign in to comment.