-
Hello, I would like to use html-validate custom rule (https://html-validate.org/dev/writing-rules.html), but i don't know how to call it on my plugins options. I'm using Nuxt 2.15.3. My plugin options are :
My custom rule is created on my project root, but on build i have an error 'Definition for rule was not found'. It seems looking for an html-validate rule and not my custom rule : Didn't see anything about custom rule on the plugin documentation, if you have any clue it will be greatly appreciated Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
To add custom rules you must create a plugin with the rule definitions. Something similar to /* CustomRule is a class inheriting from Rule, as per documentation */
const CustomRule = require("./rules/my-rule.js");
/* plugin which adds the "my-prefix/custom-rule" definition */
module.exports = {
rules: {
"my-prefix/custom-rule": AnotherRule,
},
}; The plugin would be added like this: extends: [
'html-validate:recommended',
],
+ plugins: [
+ "my-plugin" // npm package or local path
+ ],
rules: {
- "custom-rule": "error",
+ "my-prefix/custom-rule": "error",
"no-raw-characters": "warn", |
Beta Was this translation helpful? Give feedback.
To add custom rules you must create a plugin with the rule definitions.
Something similar to
The plugin would be added like this: