Skip to content

Help with conditional rule: Check whether variable is unused #781

Answered by jdkato
wilhelmer asked this question in Q&A
Discussion options

You must be logged in to vote

While this feels like something that shouldn't be done using Vale (it's more appropriate for an MDX syntax linter), it is possible:

extends: conditional
message: "'%s' has been imported but not used."
level: error
scope: raw
first: "(?<=import )(.*)(?= from)"
second: '(?<=<)(\w+)'

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@wilhelmer
Comment options

Answer selected by wilhelmer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants