-
I'm having trouble understanding the conditional extension point syntax. I want to create a rule that notifies me when a variable has been defined via Example import Profile from "@site/static/img/icons/profile.svg";
import Admonition from '@theme-original/Admonition';
import Notif from "@site/static/img/icons/notification.svg";
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
1. On the left-side menu, click <Profile className="icon"/> **Profile** > <Profile className="icon"/> **Profile**.
2. Click <Notif className="icon"/> **Email Notifications**. In the example above, Vale should report that "Admonition" was defined, but never used. I feel like this should be possible with the extends: conditional
message: "'%s' has no definition"
level: error
scope: raw
ignorecase: false
first: 'import (.*?) from'
second: '\<\0 className' # what to use here? Can I use back references? |
Beta Was this translation helpful? Give feedback.
Answered by
jdkato
Mar 2, 2024
Replies: 1 comment 1 reply
-
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+)' |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
wilhelmer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While this feels like something that shouldn't be done using Vale (it's more appropriate for an MDX syntax linter), it is possible: