Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove eslint transformer for OMBInfo #966

Merged
merged 3 commits into from
Sep 26, 2023
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
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>)',
),
},
],
},
],
},
],
});
Loading