-
Notifications
You must be signed in to change notification settings - Fork 1
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 linting for scripts and markdown files #52
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- it was inconsistent for Aidan, this should be better?
use `.editorconfig` for settings
- rename test workflow to `validate_datapack` - change test workflow to only run on commits on PRs and commits that are pushed to main
- run with `yarn lint`
- just ran `yarn start lint.fix`
- also run `yarn dlx @yarnpkg/sdks vscode` to make eslint work -- moves some auto generated settings into `.vscode/settings.json` - unavoidable but nbd - adds annoying extension to workspace recommendations `zipfs` but i guess useful similar to `node_modules` stuff idk
- no need to specify `--exact` - revert deleting the whole file earlier (woops)
- convert to using `yarn` directly to run prettier too with dependency caching maybe
- matches README's recommendation, which is based on minimum node version (`16.10`) needed for `corepack enable` / yarn 3.6.3
- any push to any branch since our workflows are very short - no need for `workflow_dispatch` (manual trigger) for now me thinks - pretty sure `push` supercedes `pull_request`
.md
files
aidant19
approved these changes
Dec 30, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a good idea and implementation looks good to me
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
replaces #51
relates to #8
Summary
This PR adds Prettier for style formatting and ESLint for code correctness.
#8 is being actively worked on will add a new
.js
script to the repo once complete, so we want to have consistent formatting and linting to keep the repo clean and readable.We also add these modules to run in our GitHub workflows, with the prettier job needing to pass before the eslint job runs. These workflows use dependency caching to re-use a previously installed
.yarn
directory if theyarn.lock
file is the same and saves a bunch of time. See: https://github.com/actions/setup-node#caching-global-packages-dataConfigs
For Prettier, we use its default config with the exception of preferring single quoted strings over double quoted.
For ESLint, we use its
eslint:recommended
base config and added the additionalno-var
rule.Test plan
Tested scripts locally with
yarn lint
/yarn lint.fix
and intentionally pushed commits with formatting/linting errors to ensure the workflows caught them.See:
Reproducing
in-gameTo run the new scripts, run one of the following:
yarn lint
/yarn start lint
: runs the formatter and linter but does not auto-fix problemsyarn lint.fix
/yarn start lint.fix
: runs the formatter and linter and auto-fixes problemsyarn start eslint.check
/yarn start eslint.fix
: runs only eslint and checks/fixes problemsyarn start prettier.check
/yarn start prettier.fix
: runs only prettier and checks/fixes problemsPreview
Supplemental changes
yarn dlx @yarnpkg/sdks vscode
since our config uses PnP.md
and.js
filespackage.json
(>=16.10
)