Skip to content

Commit

Permalink
remove eslint transformer for OMBInfo (#966)
Browse files Browse the repository at this point in the history
* remove eslint transformer

* remove test

* bump eslint-plugin version
  • Loading branch information
it-harrison authored Sep 26, 2023
1 parent a43b02c commit 9578cd6
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 78 deletions.
39 changes: 0 additions & 39 deletions packages/eslint-plugin/lib/rules/prefer-web-component-library.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,42 +203,6 @@ const paginationTransformer = (context, node) => {
});
};

const ombInfoTransformer = (context, node) => {
const openingTagNode = node.openingElement.name;
const closingTagNode = node.closingElement?.name;
const resBurdenNode = getPropNode(node, 'resBurden');
const ombNumberNode = getPropNode(node, 'ombNumber');
const expDateNode = getPropNode(node, 'expDate');

context.report({
node,
message: MESSAGE,
data: {
reactComponent: openingTagNode.name,
webComponent: 'va-omb-info',
},
suggest: [
{
desc: 'Migrate component',
fix: fixer => {
return [
// Rename component tags
fixer.replaceText(openingTagNode, 'va-omb-info'),
closingTagNode && fixer.replaceText(closingTagNode, 'va-omb-info'),

// Rename props if they exist
resBurdenNode &&
fixer.replaceText(resBurdenNode.name, 'res-burden'),
ombNumberNode &&
fixer.replaceText(ombNumberNode.name, 'omb-number'),
expDateNode && fixer.replaceText(expDateNode.name, 'exp-date'),
].filter(i => !!i);
},
},
],
});
};

/**
* Stores the result of a check that determines if a component is part of
* the Design System component-library.
Expand Down Expand Up @@ -324,9 +288,6 @@ module.exports = {
case 'Modal':
modalTransformer(context, node);
break;
case 'OMBInfo':
ombInfoTransformer(context, node);
break;
case 'Pagination':
paginationTransformer(context, node);
break;
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@department-of-veterans-affairs/eslint-plugin",
"version": "1.11.0",
"version": "1.12.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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,43 +197,5 @@ ruleTester.run('prefer-web-component-library', rule, {
},
],
},
{
code: mockFile(
'OMBInfo',
'const component = () => (<OMBInfo resBurden={10} ombNumber="12345" expDate="01/01/01" />)',
),
errors: [
{
suggestions: [
{
desc: 'Migrate component',
output: mockFile(
'OMBInfo',
'const component = () => (<va-omb-info res-burden={10} omb-number="12345" exp-date="01/01/01" />)',
),
},
],
},
],
},
{
code: mockFile(
'OMBInfo',
'const component = () => (<OMBInfo resBurden={10} ombNumber="12345" expDate="01/01/01">Some content here</OMBInfo>)',
),
errors: [
{
suggestions: [
{
desc: 'Migrate component',
output: mockFile(
'OMBInfo',
'const component = () => (<va-omb-info res-burden={10} omb-number="12345" exp-date="01/01/01">Some content here</va-omb-info>)',
),
},
],
},
],
},
],
});

0 comments on commit 9578cd6

Please sign in to comment.