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 support for linting ECR files #509

Open
nobodywasishere opened this issue Nov 23, 2024 · 5 comments
Open

Add support for linting ECR files #509

nobodywasishere opened this issue Nov 23, 2024 · 5 comments
Labels

Comments

@nobodywasishere
Copy link
Contributor

This should be a simple process of checking if the filename ends with .ecr, then calling ECR.process_file or ECR.process_string (with a clean rescue in case an error occurs), and running the linter over the outputted code.

@nobodywasishere
Copy link
Contributor Author

Only major issues would be Lint/UselessAssign, as there may be other .ecr files rendered within the current scope later. That's one downside of ECR in comparison to Jinja, where ECR files are just expanded into the current scope instead of having their own that vars are passed into. If this was merged, it'd probably be worth it to turn off that rule for ECR files.

@nobodywasishere
Copy link
Contributor Author

image image image

Prototype branch here: https://github.com/nobodywasishere/ameba/tree/nobody/ecr-lint

Combined with linting while typing, this makes writing ECR a significantly better experience.

@Sija
Copy link
Member

Sija commented Nov 24, 2024

That sounds like a helpful feature to have ❤️
One thing I'm not really fond of is monkey-patching ECR lexer, although I do understand it's needed for this to work.
Perhaps we could wait with the integration until the required changes make their way into the upstream.

@nobodywasishere
Copy link
Contributor Author

That was my plan, started working on a PR for this last night. Monkey patch was just a hack to showcase proof of concept.

@Sija
Copy link
Member

Sija commented Dec 4, 2024

Unblocked by crystal-lang/crystal#15222

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants