diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 72a4a49e1817b6..dcd205497bffa0 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -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)). diff --git a/packages/eslint-plugin/rules/__tests__/i18n-no-flanking-whitespace.js b/packages/eslint-plugin/rules/__tests__/i18n-no-flanking-whitespace.js index 509383899a94e6..39bd2d274ab0ab 100644 --- a/packages/eslint-plugin/rules/__tests__/i18n-no-flanking-whitespace.js +++ b/packages/eslint-plugin/rules/__tests__/i18n-no-flanking-whitespace.js @@ -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' } ], }, diff --git a/packages/eslint-plugin/rules/i18n-no-flanking-whitespace.js b/packages/eslint-plugin/rules/i18n-no-flanking-whitespace.js index 33661e4321497d..060f2505dcf865 100644 --- a/packages/eslint-plugin/rules/i18n-no-flanking-whitespace.js +++ b/packages/eslint-plugin/rules/i18n-no-flanking-whitespace.js @@ -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', @@ -35,7 +20,6 @@ module.exports = { noFlankingWhitespace: 'Translations should not contain flanking whitespace{{problem}}', }, - fixable: 'code', }, create( context ) { return { @@ -78,7 +62,6 @@ module.exports = { data: { problem: problemString, }, - fix: makeFixerFunction( arg ), } ); } },