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

use Spyglass for datapack linting #37

Open
TheAfroOfDoom opened this issue Dec 22, 2023 · 3 comments
Open

use Spyglass for datapack linting #37

TheAfroOfDoom opened this issue Dec 22, 2023 · 3 comments
Labels
devops Issues relating to CI/supporting tooling; e.g. yarn scripts, GitHub workflows enhancement New feature or request

Comments

@TheAfroOfDoom
Copy link
Owner

TheAfroOfDoom commented Dec 22, 2023

we can rely on Spyglass now that v4 is out once CLI linting is implemented

click to view outdated ticket description

we get a little bit of linting in vscode with Datapack Helper Plus, but DHP is pretty buggy and we shouldn't rely on it to actually lint, I don't think.

instead we should probably write a script in-house to do stuff before we run the test server:

we'd want the linting script to ensure to run on specific files (.mcfunction, .json, etc.) and check that:

  • they have a new-line at the end of the file
  • all (most? idk) strings use single quotes ' instead of "
  • all SNBT has the correct white space; e.g.
    • {Tags:["tag1","tag2"]} wrong ❌
    • { Tags: ["tag1", "tag2"] } correct ✔️

we'll probably want more rules than above but that's a decent start.


adding linting ensures our files have consistent styling (like SNBT whitespace)


we'd also want to add this script to the datapack.yml/resourcepack.yml workflows so that we run the linting script before we run the test server done

@TheAfroOfDoom TheAfroOfDoom added enhancement New feature or request devops Issues relating to CI/supporting tooling; e.g. yarn scripts, GitHub workflows labels Dec 22, 2023
TheAfroOfDoom added a commit that referenced this issue Dec 22, 2023
@TheAfroOfDoom

This comment was marked as resolved.

@TheAfroOfDoom TheAfroOfDoom changed the title create linting script add linting rules for datapack/resourcepack Jan 8, 2024
@TheAfroOfDoom
Copy link
Owner Author

TheAfroOfDoom commented Jan 8, 2024

infrastructure for this was added in a50e084 (#62)

should be pretty easy now to add rules for the things mentioned above

see 787cd85 (#62)

@TheAfroOfDoom
Copy link
Owner Author

TheAfroOfDoom commented Jan 27, 2024

#37 (comment)

the TODO linting rule was done in e1b3d7a (#67)

@TheAfroOfDoom TheAfroOfDoom changed the title add linting rules for datapack/resourcepack use Spyglass for datapack linting Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devops Issues relating to CI/supporting tooling; e.g. yarn scripts, GitHub workflows enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant