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
jsx-no-target-blank to check for forms with target="_blank" #1617
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.
Yes, let’s please put this behind an option, such that “a” and “form” can be separately controlled, but “a” defaults to being checked and “form” does not. That way, it’ll be semver-minor instead of semver-major.
Added option |
@jaaberg what about a schema like this: {
"forms": <boolean>, // default false
"links": <boolean>, // default true
} That way it's an easy change to flip the default from false to true in the next semver-major, and the schema is also extensible if we want to add other categories in the future? |
49895aa
to
712bb6a
Compare
@ljharb Thanks for feedback :) Updated the PR. |
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.
LGTM, thanks!
lib/rules/jsx-no-target-blank.js
Outdated
}, context.options[0]); | ||
|
||
if ( | ||
(config.links ? node.parent.name.name !== 'a' : true) && |
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.
!config.links || node.parent.name.name !== 'a'
?
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.
Yeah I was thinking about it, do you think it is more readable?
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.
hm, i'm not really sure. i'm not a fan of ternaries that select booleans, but as-is might be more readable in this case.
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.
LGTM. Great test coverage on this MR.
Rebased, and added a global |
@jaaberg i think this can land if it's rebased on top of the newly added |
4832801
to
893fee3
Compare
Codecov Report
@@ Coverage Diff @@
## master #1617 +/- ##
==========================================
- Coverage 97.49% 97.37% -0.13%
==========================================
Files 111 111
Lines 7396 7423 +27
Branches 2700 2714 +14
==========================================
+ Hits 7211 7228 +17
- Misses 185 195 +10
Continue to review full report at Codecov.
|
7f9cf10
to
2705431
Compare
2705431
to
49e4bb6
Compare
This should fix #1143.
I am not sure if this should be an option or not (as suggested in the issue)(?).