Skip to content
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

fix: allow comments to contain -- #348

Merged
merged 2 commits into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/eslint-mdx/src/regexp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const openTag = '<[A-Za-z]*[A-Za-z0-9\\.\\-]*' + attribute + '*\\s*>'
export const closeTag = '<\\s*\\/[A-Za-z]*[A-Za-z0-9\\.\\-]*\\s*>'
export const selfClosingTag =
'<[A-Za-z]*[A-Za-z0-9\\.\\-]*' + attribute + '*\\s*\\/?>'
export const comment = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->'
export const comment = '<!--(?:[^-]|-(?:[^-]|-+[^->]))*-*-->'
export const commentOpen = '(<!---*)'
export const commentClose = '(-*-->)'
export const commentContent = `${commentOpen}([\\s\\S]*?)${commentClose}`
Expand Down
13 changes: 13 additions & 0 deletions test/__snapshots__/fixtures.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,19 @@ Array [
]
`;

exports[`fixtures should match all snapshots: comments.mdx 1`] = `
Array [
Object {
"column": 2,
"line": 1,
"message": "Unused eslint-disable directive (no problems were reported from 'no-console').",
"nodeType": null,
"ruleId": null,
"severity": 2,
},
]
`;

exports[`fixtures should match all snapshots: details.mdx 1`] = `
Array [
Object {
Expand Down
1 change: 1 addition & 0 deletions test/fixtures.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const getCli = (lintCodeBlocks = false) =>
]
: [],
},
reportUnusedDisableDirectives: 'error',
})

describe('fixtures', () => {
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/comments.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- eslint-disable-next-line no-console -- Here's a description about why this configuration is necessary. -->
JounQin marked this conversation as resolved.
Show resolved Hide resolved