Skip to content

Lint_css

FieldValue
TypeSkill Resource
Source~/.copilot/skills/design/scripts/lint_css.sh
DescriptionNot specified

Source Content

#!/usr/bin/env bash
# Stylelint wrapper for the design skill. Run only when .css files changed.
#
# Resolves stylelint in order:
# 1. repo-local ./node_modules/.bin/stylelint (project's own config)
# 2. skill-level ~/.copilot/skills/design/references/assets/stylelint/
# node_modules/.bin/stylelint (config from that dir)
# 3. stylelint on PATH
# 4. none found → warn and exit 0 (graceful skip, never a failure)
#
# Usage: lint_css.sh FILE.css [FILE.css ...]
set -uo pipefail
if [ "$#" -eq 0 ]; then
echo "Usage: lint_css.sh FILE.css [FILE.css ...]" >&2
exit 2
fi
SKILL_STYLELINT_DIR="${HOME}/.copilot/skills/design/references/assets/stylelint"
if [ -x "./node_modules/.bin/stylelint" ]; then
exec "./node_modules/.bin/stylelint" --fix "$@"
elif [ -x "${SKILL_STYLELINT_DIR}/node_modules/.bin/stylelint" ]; then
exec "${SKILL_STYLELINT_DIR}/node_modules/.bin/stylelint" \
--config "${SKILL_STYLELINT_DIR}/stylelint.config.mjs" --fix "$@"
elif command -v stylelint >/dev/null 2>&1; then
exec stylelint --fix "$@"
else
echo "WARNING (stylelint): not installed — skipping." >&2
echo "Install once at the skill level: cd ${SKILL_STYLELINT_DIR} && npm install" >&2
exit 0
fi