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

Add reusable ESLint workflow. #279

Merged
merged 3 commits into from
Jun 13, 2024
Merged

Add reusable ESLint workflow. #279

merged 3 commits into from
Jun 13, 2024

Conversation

CallumNZ
Copy link
Contributor

@CallumNZ CallumNZ commented Jun 7, 2024

No description provided.

Runs the eslint defined in the given package.json, configured by the associated eslint.config.mjs file.
@CallumNZ CallumNZ marked this pull request as ready for review June 11, 2024 02:36
@CallumNZ CallumNZ changed the title Eslint Add reusable ESLint workflow. Jun 11, 2024
@CallumNZ CallumNZ requested a review from wilsonjord June 11, 2024 02:36
Comment on lines 23 to 27
if [ -n "${{ inputs.paths }}" ]; then
echo "paths=$(echo '${{ inputs.paths }}' | tr '\n' ' ')" >> $GITHUB_OUTPUT
else
exit 1
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: the if statement not needed, as you have paths: required: true in the inputs.
question: is this step even required at all?

env:
PATHS: ${{ steps.parse-paths.outputs.paths }}
run: |
echo "$PATHS" | tr ' ' '\n' | xargs -I '{}' -n 1 sh -c 'ESLINT_USE_FLAT_CONFIG=true $1/node_modules/.bin/eslint -c $1/eslint.config.mjs "$1"' _ '{}'
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: I think making this step work directly with ${{ inputs.paths }} might be worthwhile, maybe utilising bash's for loop automatically splitting by space, tab, and newline...like

for path in $PATHS; do
    do stuff

CallumNZ added 2 commits June 13, 2024 14:44
Removes complicated bash syntax
Now that it's using inputs.paths directly, don't need this parse step.
Also, paths is required, so no need to check that paths have been given
@CallumNZ CallumNZ merged commit 5487be9 into main Jun 13, 2024
16 checks passed
@CallumNZ CallumNZ deleted the eslint branch June 13, 2024 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants