Skip to content
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

feat: added attr-no-unnecessary-whitespace rule #220

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use for loop instead of str.repeat
  • Loading branch information
jakewtaylor committed Oct 20, 2017
commit ef1c688d085ad052e8fec5c49741bea48923e4e3
6 changes: 5 additions & 1 deletion lib/htmlhint.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ var HTMLHint = (function (undefined) {
var newlines = match.match(/\r?\n|\r/g);
var newlineCount = newlines ? newlines.length : 0;

return '\n'.repeat(newlineCount);
var ret = '';
for (var i = 0; i < newlineCount; i++) {
ret += '\n';
}
return ret;
});

if(ruleset === undefined || Object.keys(ruleset).length ===0){
Expand Down
6 changes: 5 additions & 1 deletion src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ var HTMLHint = (function (undefined) {
var newlines = match.match(/\r?\n|\r/g);
var newlineCount = newlines ? newlines.length : 0;

return '\n'.repeat(newlineCount);
var ret = '';
for (var i = 0; i < newlineCount; i++) {
ret += '\n';
}
return ret;
});

if(ruleset === undefined || Object.keys(ruleset).length ===0){
Expand Down