Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support --ignore-path option #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ It's same as `[input]` of stylelint.

Optional. It's same as `--config` flag of stylelint.

### `stylelint_ignore_path`

Optional. Default: `.stylelintignore`.
It's same as `--ignore-path` flag of stylelint.

### `stylelint_ignore`

Optional. Files or glob. It's same as `--ignore-pattern` flag of stylelint.

### `workdir`

Optional. The directory from which to look for and run stylelint. Default '.'
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ inputs:
default: '**/*.css'
stylelint_config:
description: "It's same as `--config` flag of stylelint."
stylelint_ignore_path:
description: "It's same as `--ignore-path` flag of stylelint."
default: '.stylelintignore'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work if a repo doesn't have .stylelintignore?

stylelint_ignore:
description: "Files or glob. It's the same as `--ignore-pattern` of stylelint"
workdir:
Expand All @@ -53,6 +56,7 @@ runs:
INPUT_REPORTER: ${{ inputs.reporter }}
INPUT_STYLELINT_INPUT: ${{ inputs.stylelint_input }}
INPUT_STYLELINT_CONFIG: ${{ inputs.stylelint_config }}
INPUT_STYLELINT_IGNORE_PATH: ${{ inputs.stylelint_ignore_path }}
INPUT_STYLELINT_IGNORE: ${{ inputs.stylelint_ignore }}
INPUT_WORKDIR: ${{ inputs.workdir }}
branding:
Expand Down
4 changes: 2 additions & 2 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ echo "stylelint version: $(npx --no-install -c 'stylelint --version')"
echo '::group:: Running stylelint with reviewdog 🐶 ...'
if [ "${INPUT_REPORTER}" = 'github-pr-review' ]; then
# Use jq and github-pr-review reporter to format result to include link to rule page.
npx --no-install -c "stylelint '${INPUT_STYLELINT_INPUT}' --config='${INPUT_STYLELINT_CONFIG}' --ignore-pattern='${INPUT_STYLELINT_IGNORE}' -f json" \
npx --no-install -c "stylelint '${INPUT_STYLELINT_INPUT}' --config='${INPUT_STYLELINT_CONFIG}' --ignore-path='${INPUT_STYLELINT_IGNORE_PATH}' --ignore-pattern='${INPUT_STYLELINT_IGNORE}' -f json" \
| jq -r '.[] | {source: .source, warnings:.warnings[]} | "\(.source):\(.warnings.line):\(.warnings.column):\(.warnings.severity): \(.warnings.text) [\(.warnings.rule)](\(if .warnings.rule | startswith("scss/") then "https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/\(.warnings.rule | split("scss/") | .[1])/README.md" else "https://stylelint.io/user-guide/rules/\(.warnings.rule)" end))"' \
| reviewdog -efm="%f:%l:%c:%t%*[^:]: %m" -name="${INPUT_NAME}" -reporter="${INPUT_REPORTER}" -level="${INPUT_LEVEL}" -filter-mode="${INPUT_FILTER_MODE}" -fail-on-error="${INPUT_FAIL_ON_ERROR}"
else
npx --no-install -c "stylelint '${INPUT_STYLELINT_INPUT}' --config='${INPUT_STYLELINT_CONFIG}' --ignore-pattern='${INPUT_STYLELINT_IGNORE}' -f json" \
npx --no-install -c "stylelint '${INPUT_STYLELINT_INPUT}' --config='${INPUT_STYLELINT_CONFIG}' --ignore-path='${INPUT_STYLELINT_IGNORE_PATH}' --ignore-pattern='${INPUT_STYLELINT_IGNORE}' -f json" \
| jq -r '.[] | {source: .source, warnings:.warnings[]} | "\(.source):\(.warnings.line):\(.warnings.column):\(.warnings.severity): \(.warnings.text)"' \
| reviewdog -efm="%f:%l:%c:%t%*[^:]: %m" -name="${INPUT_NAME}" -reporter="${INPUT_REPORTER}" -level="${INPUT_LEVEL}" -filter-mode="${INPUT_FILTER_MODE}" -fail-on-error="${INPUT_FAIL_ON_ERROR}"
fi
Expand Down