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

feat: implement new lint prefer-ascii #837

Merged
merged 7 commits into from
Sep 5, 2021

Conversation

magurotuna
Copy link
Member

This PR implements a new lint rule prefer-ascii that makes sure that the code is composed of only ASCII characters.

Rendered doc: https://github.com/magurotuna/deno_lint/blob/ace535166b4f42a603f9ff5c540d104b4e932647/docs/rules/prefer_ascii.md

In addition, moves display_diagnostics function into diagnostics.rs and adds test cases. The previous logic of this function didn't take multi-byte characters into account, which has been fixed as well. However, to properly display diagnostic annotations for double-width characters, we still need to wait for my patch to land: rust-lang/annotate-snippets-rs#46
With the current version of annotate-snippets, displayed diagnostics may point to the wrong position if the snippet contains double-width characters, like:

image

Closes #832

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@bartlomieju bartlomieju merged commit e62d882 into denoland:main Sep 5, 2021
@magurotuna magurotuna deleted the prefer-ascii branch September 10, 2021 10:42
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.

New lint: prefer-ascii for Deno's internal JS
2 participants