From 407daf0ae5040418dd3bb3a97a51ea41ca9e65a4 Mon Sep 17 00:00:00 2001 From: harshil1793 Date: Tue, 7 Nov 2023 16:21:27 -0500 Subject: [PATCH] remove breadcrumb eslint transformer --- .../lib/rules/prefer-web-component-library.js | 32 ------------- packages/eslint-plugin/package.json | 2 +- .../lib/rules/prefer-web-component-library.js | 47 ------------------- 3 files changed, 1 insertion(+), 80 deletions(-) diff --git a/packages/eslint-plugin/lib/rules/prefer-web-component-library.js b/packages/eslint-plugin/lib/rules/prefer-web-component-library.js index 6744dcec92..0a96b86183 100644 --- a/packages/eslint-plugin/lib/rules/prefer-web-component-library.js +++ b/packages/eslint-plugin/lib/rules/prefer-web-component-library.js @@ -42,35 +42,6 @@ const textInputTransformer = (context, node) => { }); }; -const breadcrumbsTransformer = (context, node) => { - const componentName = node.openingElement.name; - const closingTag = node.closingElement.name; - const selectedFacilityNode = getPropNode(node, 'selectedFacility'); - - context.report({ - node, - message: MESSAGE, - data: { - reactComponent: componentName.name, - webComponent: 'va-breadcrumbs', - }, - suggest: [ - { - desc: 'Migrate component', - fix: fixer => { - // Replace opening and close tags - // and remove `selectedFacilityNode` prop if present - return [ - fixer.replaceText(componentName, 'va-breadcrumbs'), - fixer.replaceText(closingTag, 'va-breadcrumbs'), - selectedFacilityNode && fixer.remove(selectedFacilityNode), - ].filter(i => !!i); - }, - }, - ], - }); -}; - const modalTransformer = (context, node) => { const openingTagNode = node.openingElement.name; const closingTagNode = node.closingElement?.name; @@ -282,9 +253,6 @@ module.exports = { if (!isLibraryImport(context, componentName)) return; switch (componentName) { - case 'Breadcrumbs': - breadcrumbsTransformer(context, node); - break; case 'Modal': modalTransformer(context, node); break; diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index bafae52041..42226a8826 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@department-of-veterans-affairs/eslint-plugin", - "version": "1.13.0", + "version": "1.14.0", "description": "ESLint plugin for va.gov projects", "homepage": "https://github.com/department-of-veterans-affairs/veteran-facing-services-tools/tree/master/packages/eslint-plugin#readme", "bugs": { diff --git a/packages/eslint-plugin/tests/lib/rules/prefer-web-component-library.js b/packages/eslint-plugin/tests/lib/rules/prefer-web-component-library.js index 16eef838f3..032b7e27b8 100644 --- a/packages/eslint-plugin/tests/lib/rules/prefer-web-component-library.js +++ b/packages/eslint-plugin/tests/lib/rules/prefer-web-component-library.js @@ -35,54 +35,7 @@ const mockFileComponentLibraryNamedImport = (name, snippet) => { ruleTester.run('prefer-web-component-library', rule, { // This rule should not trigger on application components, only React components // from the `component-library` - valid: [ - { - code: ` - import Breadcrumbs from '../../components/Breadcrumbs'; - const breadcrumbs = () => (Home) - `, - }, - ], invalid: [ - { - code: mockFile( - 'Breadcrumbs', - 'const breadcrumb = () => (Home)', - ), - errors: [ - { - suggestions: [ - { - desc: 'Migrate component', - output: mockFile( - 'Breadcrumbs', - 'const breadcrumb = () => (Home)', - ), - }, - ], - }, - ], - }, - { - code: mockFile( - 'Breadcrumbs', - 'const breadcrumb = () => (Home)', - ), - errors: [ - { - suggestions: [ - { - desc: 'Migrate component', - // There is an extra space which would get removed on an autosave format - output: mockFile( - 'Breadcrumbs', - 'const breadcrumb = () => (Home)', - ), - }, - ], - }, - ], - }, { code: mockFile( 'Modal',