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 frontend linting #228

Merged
merged 24 commits into from
Nov 19, 2024
Merged

Add frontend linting #228

merged 24 commits into from
Nov 19, 2024

Conversation

glass-ships
Copy link
Member

@glass-ships glass-ships commented Nov 15, 2024

New version of #220 based on master rather than restructure.

  • Adds eslint and prettier configs
  • Adds a lint and test:lint script in package.json
    • Can be run with bun|npm run test:lint to preview warnings/errors, or bun|npm run lint to apply fixable changes
  • Adds a format script in package.json to only run prettier without linting
  • Applies formatting changes
  • Address unfixable linting errors
  • Add make target for formatting/linting
    • Address bun vs npm
  • Automate linting to pre-commit or a github action
    • Same as above

@glass-ships glass-ships marked this pull request as ready for review November 19, 2024 16:57
@bmaranville
Copy link
Member

How would this work for applying formatting changes? Is there a pre-commit hook that will do formatting like ruff does for python?

@glass-ships
Copy link
Member Author

unfortunately there isn't currently a pre-commit hook for running eslint/prettier via npm or anything, so the idea is that the test-webview-client workflow would run bun run test:lint and if there are errors/formatting changes to apply, the action will fail, so the user would have to run bun run lint or bun run format locally to address those, then push the changes.

it is somewhat annoyingly manual, but the other option would be adding another formatting workflow that runs bun run format and pushes the changes back to the same branch, which could potentially get a little messy. i'm ok with either option, really

@bmaranville
Copy link
Member

I see the commented-out local runner for eslint in .pre-commit-config.yaml

Is that something that could be made to work?

@glass-ships
Copy link
Member Author

possible, but it previously failed because npm/bun aren't installed on the pre-commit CI runner. could try adding a line that installs it

@glass-ships
Copy link
Member Author

yeah, i've tried a few things and i'm not sure how easy it'll be to get pre-commit.ci to play nicely with the node stuff. may be worth looking into how to develop a proper hook at some point

@glass-ships glass-ships merged commit aa1061f into master Nov 19, 2024
12 checks passed
@glass-ships glass-ships deleted the lint-frontend branch November 20, 2024 00:07
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