diff --git a/.stylelintrc.yml b/.stylelintrc.yml index ffea08a8..de2a9d4b 100644 --- a/.stylelintrc.yml +++ b/.stylelintrc.yml @@ -3,11 +3,6 @@ #─────────────────────────────────────────────────────────────────────────────── # DOCS https://stylelint.io/user-guide/rules #─────────────────────────────────────────────────────────────────────────────── -extends: - - stylelint-config-standard - - stylelint-config-recess-order -plugins: - - stylelint-order reportInvalidScopeDisables: true reportNeedlessDisables: true #─────────────────────────────────────────────────────────────────────────────── @@ -16,19 +11,118 @@ reportNeedlessDisables: true defaultSeverity: warning #─────────────────────────────────────────────────────────────────────────────── rules: + annotation-no-unknown: true + at-rule-no-unknown: true + block-no-empty: true + color-no-invalid-hex: true + comment-no-empty: true + custom-property-no-missing-var-function: true + declaration-block-no-duplicate-custom-properties: true + declaration-block-no-duplicate-properties: + - true + - ignore: + - consecutive-duplicates-with-different-syntaxes + declaration-block-no-shorthand-property-overrides: true + font-family-no-duplicate-names: true + font-family-no-missing-generic-family-keyword: true + function-calc-no-unspaced-operator: true + function-linear-gradient-no-nonstandard-direction: true + function-no-unknown: true + keyframe-block-no-duplicate-selectors: true + keyframe-declaration-no-important: true + media-feature-name-no-unknown: true + media-query-no-invalid: true + named-grid-areas-no-invalid: true + no-descending-specificity: true + no-duplicate-at-import-rules: true + no-duplicate-selectors: true + no-empty-source: true + no-invalid-double-slash-comments: true + no-invalid-position-at-import-rule: true + no-irregular-whitespace: true + property-no-unknown: true + selector-anb-no-unmatchable: true + selector-pseudo-class-no-unknown: true + selector-pseudo-element-no-unknown: true + selector-type-no-unknown: + - true + - ignore: + - custom-elements + string-no-newline: true + unit-no-unknown: true + alpha-value-notation: + - percentage + - exceptProperties: + - opacity + - fill-opacity + - flood-opacity + - stop-opacity + - stroke-opacity + at-rule-empty-line-before: + - always + - except: + - blockless-after-same-name-blockless + - first-nested + ignore: + - after-comment + at-rule-no-vendor-prefix: true + color-function-notation: [modern, {ignore: [with-var-inside]}] + color-hex-length: short + comment-empty-line-before: null # does not work well with comment decorators + comment-whitespace-inside: always + custom-property-empty-line-before: never + custom-media-pattern: + - ^([a-z][a-z0-9]*)(-[a-z0-9]+)*$ + - {} + custom-property-pattern: + - ^([a-z][a-z0-9]*)(-[a-z0-9]+)*$ + - {} + declaration-block-no-redundant-longhand-properties: true + declaration-block-single-line-max-declarations: 1 + declaration-empty-line-before: never + font-family-name-quotes: always-where-recommended + function-name-case: lower + function-url-quotes: always + hue-degree-notation: number # compatible with ccc.nvim output + import-notation: url + keyframe-selector-notation: percentage-unless-within-keyword-only-block + keyframes-name-pattern: + - ^([a-z][a-z0-9]*)(-[a-z0-9]+)*$ + - {} + length-zero-no-unit: + - true + - ignore: + - custom-properties + lightness-notation: null # PENDING support from stylelint-lsp + media-feature-name-no-vendor-prefix: true + media-feature-range-notation: context + number-max-precision: 4 + property-no-vendor-prefix: true + rule-empty-line-before: + - always-multi-line + - except: + - first-nested + ignore: + - after-comment + selector-attribute-quotes: always + selector-class-pattern: null # when doing themes, you mostly do not decide on class names + selector-id-pattern: + - ^([a-z][a-z0-9]*)(-[a-z0-9]+)*$ + - {} + selector-no-vendor-prefix: true + selector-not-notation: complex + selector-pseudo-element-colon-notation: double + selector-type-case: lower + shorthand-property-no-redundant-values: true + value-keyword-case: lower + value-no-vendor-prefix: + - true + - ignoreValues: + - box + - inline-box color-named: never color-no-hex: true - color-function-notation: [modern, { ignore: [with-var-inside] }] - hue-degree-notation: number # compatible with ccc.nvim output - comment-empty-line-before: null # does not work well with comment decorators declaration-no-important: true font-weight-notation: numeric - selector-class-pattern: null # when doing themes, you mostly do not decide on class names - no-unknown-custom-properties: [true, { severity: error }] # equivalent to "no undeclared variables" in other linters - declaration-empty-line-before: never - custom-property-empty-line-before: never + no-unknown-custom-properties: [true, {severity: error}] # equivalent to "no undeclared variables" in other linters max-nesting-depth: 3 - - order/order: - - custom-properties - - declarations diff --git a/build.sh b/build.sh index 9d17ac05..90618508 100755 --- a/build.sh +++ b/build.sh @@ -2,9 +2,9 @@ # - Check the yaml from the Style Settings for errors. If there are any, the # build is aborted, the errors are passed (e.g. for a notification) and the # Style Settings tab is opened. -# - bumps version number in css file -# - updates download counts in badges of the .md files -# - updates the stylelint-file +# - bumps version number in css file and manifest +# - updates download counts in badges of the README files +# - copies the stylelint-config for documentation # - git add, commit, pull, and push to the remote repo #─────────────────────────────────────────────────────────────────────────────── @@ -31,33 +31,32 @@ if [[ $? == 1 ]]; then fi rm temp.yml +# Copy for styleint config for documentation purposes +cp "$HOME/.config/+ linter-configs/stylelint/compiled.yml" ./.stylelintrc.yml + #─────────────────────────────────────────────────────────────────────────────── -# Bump version number -versionLine=$(grep -Ewn "^Version" "$CSS_PATH" | cut -d: -f1 | head -n1) -currentVersion=$(sed -n "${versionLine}p" "$CSS_PATH" | cut -d. -f2) +# BUMP VERSION NUMBER +versionLine=$(grep -n --max-count=1 "^Version" "theme.css") +currentVersion=$(echo "$versionLine" | cut -d" " -f2) nextVersion=$((currentVersion + 1)) + +versionLineNum=$(echo "$versionLine" | cut -d: -f1) manifest="$(dirname "$CSS_PATH")/manifest.json" -sed -E -i '' "${versionLine}s/(.*\.)[[:digit:]]+/\1$nextVersion/" "$CSS_PATH" +sed -E -i '' "${versionLineNum}s/(.*\.)[[:digit:]]+/\1$nextVersion/" "$CSS_PATH" sed -E -i '' "s/(\"version\": \".*\.).*/\1$nextVersion\",/" "$manifest" -#─────────────────────────────────────────────────────────────────────────────── - -# Copy for documentation purposes -cp "$HOME/.config/+ linter-configs/stylelint/compiled.yml" ./.stylelintrc.yml - # Update Theme Download numbers in README.md dl=$(curl -s "https://releases.obsidian.md/stats/theme" | grep -oe '"Shimmering Focus","download":[[:digit:]]*' | cut -d: -f2) sed -E -i '' "s/badge.*-[[:digit:]]+-/badge\/downloads-$dl-/" ./README.md #─────────────────────────────────────────────────────────────────────────────── -# git add, commit, pull, and push +# GIT ADD, COMMIT, PULL, AND PUSH # needs piping stderr to stdin, since git push reports an error even on success git add --all && git commit -m "publish (automated)" git pull && git push 2>&1 -#─────────────────────────────────────────────────────────────────────────────── #─────────────────────────────────────────────────────────────────────────────── # INFO specific to my setup