Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions packages/eslint-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Bug Fixes

- Remove `fixable` option from `i18n-no-flanking-whitespace` rule [#70279](https://github.com/WordPress/gutenberg/pull/70279).

### Enhancements

- Update `use-recommended-components` rule to mark `Autocomplete`, `Field`, and `Fieldset` from `@wordpress/ui` as recommended ([#80636](https://github.com/WordPress/gutenberg/pull/80636)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,34 @@ ruleTester.run( 'i18n-no-flanking-whitespace', rule, {
invalid: [
{
code: '__( "Double quoted string with a trailing newline\\n" );',
output: `__( 'Double quoted string with a trailing newline' );`,
errors: [ { messageId: 'noFlankingWhitespace' } ],
},
{
code: `__( ' Leading whitespace.' );`,
output: `__( 'Leading whitespace.' );`,
errors: [ { messageId: 'noFlankingWhitespace' } ],
},
{
code: `__( 'Trailing whitespace. ' );`,
output: `__( 'Trailing whitespace.' );`,
errors: [ { messageId: 'noFlankingWhitespace' } ],
},
{
code: `__( ' Flanking whitespace. ' );`,
output: `__( 'Flanking whitespace.' );`,
errors: [ { messageId: 'noFlankingWhitespace' } ],
},
{
code: '__( "\tLeading tab." );',
output: `__( 'Leading tab.' );`,
errors: [ { messageId: 'noFlankingWhitespace' } ],
},
{
code: '__( "\u0009Leading unicode tab." );',
output: `__( 'Leading unicode tab.' );`,
errors: [ { messageId: 'noFlankingWhitespace' } ],
},
{
code: `__( "Trailing tab.\t" );`,
output: `__( 'Trailing tab.' );`,
errors: [ { messageId: 'noFlankingWhitespace' } ],
},
{
code: `__( "\tFlanking tab.\t" );`,
output: `__( 'Flanking tab.' );`,
errors: [ { messageId: 'noFlankingWhitespace' } ],
},

Expand Down
17 changes: 0 additions & 17 deletions packages/eslint-plugin/rules/i18n-no-flanking-whitespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,6 @@ const PROBLEMS_BY_CHAR_CODE = {
32: 'whitespace',
};

function makeFixerFunction( arg ) {
return ( fixer ) => {
switch ( arg.type ) {
case 'Literal':
return [ fixer.replaceText( arg, `'${ arg.value.trim() }'` ) ];

case 'BinaryExpression':
return [
...makeFixerFunction( arg.left )( fixer ),
...makeFixerFunction( arg.right )( fixer ),
];
}
};
}

module.exports = {
meta: {
type: 'problem',
Expand All @@ -35,7 +20,6 @@ module.exports = {
noFlankingWhitespace:
'Translations should not contain flanking whitespace{{problem}}',
},
fixable: 'code',
},
create( context ) {
return {
Expand Down Expand Up @@ -78,7 +62,6 @@ module.exports = {
data: {
problem: problemString,
},
fix: makeFixerFunction( arg ),
} );
}
},
Expand Down
Loading