mdx-js / eslint-mdx

ESLint Parser/Plugin for MDX
https://npmjs.org/eslint-plugin-mdx
MIT License
264 stars 30 forks source link

fix: allow comments to contain `--` #348

Closed jablko closed 2 years ago

jablko commented 2 years ago

This change allows comments to contain --, which currently they can't, e.g.

<!-- eslint-disable-next-line no-console -- Here's a description about why this configuration is necessary. -->
  1:1  error  Block is redundant  no-lone-blocks

I suspect this is already fixed in #284, by upgrading to micromark. This PR adds a test and patches the comment regexp in the meantime.

remark-parse (where this regexp originally came from) went directly from our current regexp to micromark, which doesn't use an equivalent.

I used the following to automatically construct this corrected, "strings that don't contain -->" regexp, substituting aab for --> because it only allows alphanumerics, etc.: http://www.formauri.es/personal/pgimeno/misc/non-match-regex/?word=aab

codesandbox-ci[bot] commented 2 years ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

codecov-commenter commented 2 years ago

Codecov Report

Merging #348 (bdf53c1) into master (29ba0c5) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #348   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines          507       507           
  Branches       109       109           
=========================================
  Hits           507       507           
Impacted Files Coverage Δ
packages/eslint-mdx/src/regexp.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2a5792f...bdf53c1. Read the comment docs.

JounQin commented 2 years ago

cc @wooorm

wooorm commented 2 years ago