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
Relax JSX pragma regexp #2643
Relax JSX pragma regexp #2643
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some test cases to cover this change?
|
@ljharb I've added the tests |
|
||
const assert = require('assert'); | ||
const SourceCode = require('eslint').SourceCode; | ||
const espree = require('espree'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any way to do this with eslint itself, rather than adding a dev dep on espree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not as far as I could tell, unfortunately. I tried using eslint first, but eslint does not expose the API to generate the AST object needed to create the SourceCode object.
d2ce572
to
ef9a512
Compare
Fixes #2642.
This PR relaxes the JSX pragma detection slightly.
Previously, only pragmas at the beginning of docstring comments were recognised. But pragmas can occur anywhere in any block comment (not just docstring comments). This PR fixes the regexp that recognises pragmas.