diff --git a/__tests__/__util__/parserOptionsMapper.js b/__tests__/__util__/parserOptionsMapper.js index 0e9e990..57cc723 100644 --- a/__tests__/__util__/parserOptionsMapper.js +++ b/__tests__/__util__/parserOptionsMapper.js @@ -9,12 +9,14 @@ export default function parserOptionsMapper({ code, errors, options = [], + output = null, parserOptions = {}, }) { return { code, errors, options, + output, parserOptions: { ...defaultParserOptions, ...parserOptions, diff --git a/__tests__/src/rules/has-valid-accessibility-descriptors-test.js b/__tests__/src/rules/has-valid-accessibility-descriptors-test.js index da7c3dc..39f06cf 100644 --- a/__tests__/src/rules/has-valid-accessibility-descriptors-test.js +++ b/__tests__/src/rules/has-valid-accessibility-descriptors-test.js @@ -74,10 +74,14 @@ ruleTester.run('has-valid-accessibility-descriptors', rule, { Back `, errors: [expectedError], + output: ` + Back + `, }, { code: ``, errors: [expectedError], + output: ``, }, ].map(parserOptionsMapper), }); diff --git a/src/rules/has-valid-accessibility-descriptors.js b/src/rules/has-valid-accessibility-descriptors.js index 88ec52f..b0794c5 100644 --- a/src/rules/has-valid-accessibility-descriptors.js +++ b/src/rules/has-valid-accessibility-descriptors.js @@ -23,6 +23,7 @@ module.exports = { meta: { docs: {}, schema: [schema], + fixable: 'code', }, create: (context: ESLintContext) => ({ @@ -38,6 +39,13 @@ module.exports = { context.report({ node, message: errorMessage, + fix: (fixer) => { + return fixer.insertTextAfterRange( + // $FlowFixMe + node.name.range, + ' accessible={false}' + ); + }, }); } }