-
Notifications
You must be signed in to change notification settings - Fork 63
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
Bug: (Exception occurs in markdown/no-missing-label-refs when links from the second onwards have undefined labels) #289
Comments
I am not sure if it's related but a similar error happens when using this plugin alongside other plugins like This works perfectly import markdown from '@eslint/markdown'
export default [
...markdown.configs.recommended,
] but this throws an error message import jsEslint from '@eslint/js'
import markdown from '@eslint/markdown'
export default [
...markdown.configs.recommended,
jsEslint.configs.recommended,
]
|
@Ymmy833y thanks for the report and all the details. I can reproduce this. |
@salazarr-js it isn't related. import jsEslint from '@eslint/js'
import markdown from '@eslint/markdown'
export default [
...markdown.configs.recommended,
{
...jsEslint.configs.recommended,
files: ["**/*.js", "**/*.mjs", "**/*.cjs"]
}
] |
I'm working on this. |
@mdjermanovic thanks for that tip, it helped me a lot and made me understand a little more how This is the eslint-plugin-vue recommended config setup import js from '@eslint/js'
import ts from 'typescript-eslint'
import vue from 'eslint-plugin-vue'
export default ts.config(
js.configs.recommended,
...ts.configs.recommended,
...vue.configs['flat/recommended'],
{
files: ['*.vue', '**/*.vue'],
languageOptions: {
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
}
) but to be able to use import md from '@eslint/markdown'
import js from '@eslint/js'
import ts from 'typescript-eslint'
import vue from 'eslint-plugin-vue'
export default ts.config(
{ ignores: ['**/.vitepress'] },
{
...md.configs.recommended[0],
language: 'markdown/gfm'
},
{
files: ['**/*.ts'],
extends: [
js.configs.recommended,
...ts.configs.recommended,
],
},
{
files: ['*.vue', '**/*.vue'],
extends: [
...vue.configs['flat/recommended'],
],
},
{
files: ['*.vue', '**/*.vue'],
languageOptions: {
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
},
) |
Those plugins provide parsers that produce ASTs compatible with the AST specification expected by the core JS rules (ESTree) and/or processors that extract JS (or JS-like) code from the files. So, in these cases, core JS rules get a JS-like source code and a JS-like AST to work with. In most cases, that works perfectly fine. Markdown source code is very different from JS source code, and their ASTs are very different, so core JS rules cannot work with it. When you add |
* fix: no-missing-label-refs should not crash on undefined labels Fixes #289 * fix locations * add a note to function `findOffsets` * add a comment for the loop * add a comment for the regex
@mdjermanovic that was a masterclass! Thanks for taking the time to explain it and share it with us 🙋🏽♂️ |
Environment
ESLint version: 9.12.0
@eslint/markdown version: 6.2.0
Node version: 20.9.0
npm version: 10.8.3
Operating System: Windows 11
Which language are you using?
commonmark
What did you do?
Configuration
@eslint/markdown
plugin and themarkdown/no-missing-label-refs
rule in your ESLint configuration.What did you expect to happen?
What actually happened?
ESLint throws the following exception and stops execution:
Link to Minimal Reproducible Example
https://stackblitz.com/edit/stackblitz-starters-bhmkmm?file=package.json
Participation
Additional comments
Failing Test Case
The following test case results in the exception being thrown:
Other Cases Where the Error Occurs
Cases Where No Error Occurs
The text was updated successfully, but these errors were encountered: