Closed jvdl closed 1 year ago
Thanks for reproduction, I'll check soon.
@jvdl Please help to test:
# yarn 1
yarn add https://pkg.csb.dev/mdx-js/eslint-mdx/commit/c2bb0d9d/eslint-mdx https://pkg.csb.dev/mdx-js/eslint-mdx/commit/c2bb0d9d/eslint-plugin-mdx
# yarn 2, 3
yarn add eslint-mdx@https://pkg.csb.dev/mdx-js/eslint-mdx/commit/c2bb0d9d/eslint-mdx/_pkg.tgz eslint-plugin-mdx@https://pkg.csb.dev/mdx-js/eslint-mdx/commit/c2bb0d9d/eslint-plugin-mdx/_pkg.tgz
# npm
npm i https://pkg.csb.dev/mdx-js/eslint-mdx/commit/c2bb0d9d/eslint-mdx https://pkg.csb.dev/mdx-js/eslint-mdx/commit/c2bb0d9d/eslint-plugin-mdx
Nice one @JounQin that seems to work perfectly!
I have observed this same issue for empty string props. e.g.
<MyComponent myProp="" />
results in
0:0 error Parsing error: Expected value to be truthy
from mdx eslint.
Initial checklist
Affected packages and versions
2.0.4
Link to runnable example
https://github.com/jvdl/eslint-plugin-mdx-boolean-attributes
Steps to reproduce
I was able to keep the reproduction very minimal and it only requires
eslint
andeslint-plugin-mdx
together with some ESLint config and an MDX file to lint.The ESLint configuration I used was
Beyond this the only other required items are:
<button disabled>Hi</button>
.eslint-plugin-mdx
plugin installed.Parsing error: Expected value to be truthy
There's a minimal repro available, and I've also added a failing test in my fork of this repo.
Expected behavior
The file is linted correctly.
Boolean attributes are truthy by virtue of their presence, rather than their explicitly assigned value.
Actual behavior
The linter throws an error when attempting to parse the file.
Runtime
Node v16
Package manager
npm v8
OS
macOS
Build and bundle tools
Other (please specify in steps to reproduce)