File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,30 +40,9 @@ module.exports = {
4040 const attrStart = accessKeyAttr . range [ 0 ] ;
4141 const attrEnd = accessKeyAttr . range [ 1 ] ;
4242
43- // Check if there's whitespace before the attribute that should be removed
43+ // Check if there's a space before the attribute that should be removed
4444 const sourceText = sourceCode . getText ( ) ;
45- let removeStart = attrStart ;
46-
47- // Look for preceding whitespace
48- while ( removeStart > 0 && / \s / . test ( sourceText [ removeStart - 1 ] ) ) {
49- removeStart -- ;
50- // Stop if we hit a non-whitespace character that's not right before the attribute
51- if ( sourceText [ removeStart ] === '\n' || sourceText [ removeStart ] === '\r' ) {
52- // Don't remove newlines, just spaces/tabs on the same line
53- const beforeNewline = removeStart ;
54- while ( removeStart > 0 && / [ \t ] / . test ( sourceText [ removeStart - 1 ] ) ) {
55- removeStart -- ;
56- }
57- if ( sourceText [ removeStart ] === '\n' || sourceText [ removeStart ] === '\r' ) {
58- // If there's a newline, keep one space before
59- removeStart = beforeNewline ;
60- }
61- break ;
62- }
63- }
64-
65- // For simple case, just remove preceding space if it exists
66- removeStart = attrStart > 0 && sourceText [ attrStart - 1 ] === ' ' ? attrStart - 1 : attrStart ;
45+ const removeStart = attrStart > 0 && sourceText [ attrStart - 1 ] === ' ' ? attrStart - 1 : attrStart ;
6746
6847 return fixer . removeRange ( [ removeStart , attrEnd ] ) ;
6948 } ,
You can’t perform that action at this time.
0 commit comments