Created
March 2, 2017 16:46
-
-
Save andycochrane/aba92dc70bb2493059a74af85298624c to your computer and use it in GitHub Desktop.
Atom auto rel="noopener"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## | |
| # Are you looking for a front-end developer? I’m looking for a new role! | |
| # | |
| # andycdev@gmail.com | |
| # andycochrane.co.uk | |
| ## | |
| '*.html': | |
| 'Target Blank (with rel="noopener")': | |
| 'prefix': 'blank' | |
| 'body': 'target="_blank" rel="noopener"' |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey there @mendaomn,
You could probably create a custom linter based on the base linter which enforces this particular practice. However, I don’t think it is necessary or even appropriate for a linter to enforce this specific attribute as linters are more concerned with analysing code for general style consistency and potential errors.
I’ve created a variation on this snippet for you which will get you most of the way to autocompleting
rel="noopener". To use this snippet you would use autocomplete to input yourtarget="_blank"attribute and then use your snippets:expand key binding to appendrel="noopener". Your key binding for snippets:expand will likely be the same as for autocomplete-plus:confirm so would just require an extra press. For example, I would begin typingtargetthen hit tab 3 times and I will have a fully completed snippet like so:target="_blank" rel="noopener"Here is the variation on the snippet (warning: it isn’t pretty)
So, unfortunately, there is no enforcement happening here and you still have to remember the extra key press to add the
rel="noopener"attribute, but we don’t have to remember the prefix name for the entire snippet.Hope that helps.
Cheers,
Andy