-
-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Description
When I try to use https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility in the config together with eslint-plugin-jsonc something doesn't work as expected. eslint-plugin-vuejs-accessibility utilizes vue-eslint-parser (its peer dependency). Thats why when JSON files are linted it fails with an exception
Oops! Something went wrong! :(
ESLint: 7.18.0
TypeError: Error while loading rule 'vuejs-accessibility/interactive-supports-focus': context.parserServices.defineTemplateBodyVisitor is not a function
The ESLint config is like this (simplified example):
{
"plugins": [
"jsonc",
"vue",
"vuejs-accessibility"
],
"parser": "vue-eslint-parser",
"overrides": [
{
"files": ["*.json", "*.jsonc", "*.json5", "*.json6"],
"parser":"jsonc-eslint-parser",
"rules": {
"jsonc/auto": "error"
}
}
],
"rules": {
"jsonc/indent": "error",
"vuejs-accessibility/accessible-emoji": "error",
// many rules
}
}And of course ESLint fails as we have overridden the parser for JSON files
I tried also another approach as Vue Plugin suggest - use "parserOptions.parser"
{
"plugins": [
"jsonc",
"vue",
"vuejs-accessibility"
],
"parser": "vue-eslint-parser",
"overrides": [
{
"files": ["*.json", "*.jsonc", "*.json5", "*.json6"],
"parserOprions": {
"parser":"jsonc-eslint-parser",
},
"rules": {
"jsonc/auto": "error"
}
}
],
"rules": {
"jsonc/indent": "error",
"vuejs-accessibility/accessible-emoji": "error",
// many rules
}
}Now plugins work. Many core rules are also linted. But jsonc rules are not checked any more. For example "jsonc/indent" errors are not reported.
Expected
One of both
vuejs-accessibility/*rules should not throw when the parser is notvue-eslint-parserand just ignore- All
jsonc/*rules are applied when configured with{ "parser": "vue-eslint-parser", "parserOprions": { "parser":"jsonc-eslint-parser" } }
Metadata
Metadata
Assignees
Labels
No labels