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

Upg: execute lint in pre-commit hook if DUST_LINT_ON_COMMIT=1 #6724

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

Fraggle
Copy link
Contributor

@Fraggle Fraggle commented Aug 9, 2024

Description

Lint on pre-commit if DUST_LINT_ON_COMMIT=1.

Risk

None

Deploy Plan

None

@Fraggle Fraggle requested a review from flvndvd August 9, 2024 10:27
@@ -10,6 +10,29 @@ if [ "$current_branch" = "main" ]; then
fi
fi

# Allow commit
exit 0
# If env var viDUST_LINT_ON_COMMIT = 1, run the linter
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# If env var viDUST_LINT_ON_COMMIT = 1, run the linter
# If env var DUST_LINT_ON_COMMIT = 1, run the linter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OOps :)

for directory in "${directories[@]}"; do
if git diff --cached --name-only | grep -qE "^$directory/"; then
# Run the linter on root_path concatenated with the directory
if ! npm run lint --prefix $root_path/$directory; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Usually people go with https://www.npmjs.com/package/lint-staged that pretty output linter errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the pointer, i'll keep the PR as it to avoid distracting myself too much :)

@Fraggle Fraggle force-pushed the sflory-optin-for-linter-in-precommit-hook branch from fcaaf6d to 176592a Compare August 9, 2024 13:14
@Fraggle Fraggle merged commit 1ddbeec into main Aug 9, 2024
2 checks passed
@Fraggle Fraggle deleted the sflory-optin-for-linter-in-precommit-hook branch August 9, 2024 13:15
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