diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 03b4e4845..61852fa08 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -27,7 +27,7 @@ jobs:
fi
- uses: actions/setup-node@v1
with:
- node-version: '18'
+ node-version: '22'
- name: Enable Corepack
shell: bash
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 03d4a3f4e..dab1398a0 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -17,7 +17,7 @@ jobs:
fi
- uses: actions/setup-node@v1
with:
- node-version: '18'
+ node-version: '22'
- run: corepack enable
- run: corepack prepare yarn@4.5.1 --activate
- uses: actions/cache@v4
@@ -49,7 +49,7 @@ jobs:
fi
- uses: actions/setup-node@v1
with:
- node-version: '18'
+ node-version: '22'
- run: corepack enable
- run: corepack prepare yarn@4.5.1 --activate
- uses: actions/cache@v4
@@ -81,7 +81,7 @@ jobs:
fi
- uses: actions/setup-node@v1
with:
- node-version: '18'
+ node-version: '22'
- run: corepack enable
- run: corepack prepare yarn@4.5.1 --activate
- uses: actions/cache@v4
diff --git a/packages/class-name-updater/package.json b/packages/class-name-updater/package.json
index c571c16ed..2fb815850 100644
--- a/packages/class-name-updater/package.json
+++ b/packages/class-name-updater/package.json
@@ -23,7 +23,7 @@
"colors": "^1.4.0",
"commander": "^5.1.0",
"diff": "^5.1.0",
- "glob": "^10.2.6"
+ "glob": "^14.0.3"
},
"devDependencies": {
"@types/diff": "^5.0.9",
diff --git a/packages/css-vars-updater/package.json b/packages/css-vars-updater/package.json
index c88583da6..223c7e5dd 100644
--- a/packages/css-vars-updater/package.json
+++ b/packages/css-vars-updater/package.json
@@ -20,7 +20,7 @@
"colors": "^1.4.0",
"commander": "^5.1.0",
"diff": "^5.1.0",
- "glob": "^10.2.6",
+ "glob": "^14.0.3",
"inquirer": "^12.3.2"
},
"devDependencies": {
diff --git a/packages/eslint-plugin-pf-codemods/lib/helpers.js b/packages/eslint-plugin-pf-codemods/lib/helpers.js
index 8bba2ca44..c8c61b9a4 100644
--- a/packages/eslint-plugin-pf-codemods/lib/helpers.js
+++ b/packages/eslint-plugin-pf-codemods/lib/helpers.js
@@ -7,7 +7,7 @@ function moveSpecifiers(
messageAfterSpecifierPathChange
) {
return function (context) {
- const src = context.getSourceCode();
+ const src = context.sourceCode;
const { imports: fromPackageImports, exports: fromPackageExports } =
getFromPackage(context, fromPackage, specifiersToMove);
@@ -308,7 +308,7 @@ function pfPackageMatches(packageName, nodeSrc) {
* @returns {Object} an object containing an array of imports and array of named exports
*/
function getFromPackage(context, packageName, specifierNames = []) {
- const astBody = context.getSourceCode().ast.body;
+ const astBody = context.sourceCode.ast.body;
const getSpecifiers = (nodeType) =>
astBody
.filter((node) => node?.type === nodeType)
@@ -531,7 +531,7 @@ function renameComponents(
// if no data-codemods && closing tag, rename
const newName = componentMap[nodeName];
const updateTagName = (node) =>
- context.getSourceCode().getText(node).replace(nodeName, newName);
+ context.sourceCode.getText(node).replace(nodeName, newName);
const addDataAttr = (jsxStr) =>
`${jsxStr.slice(0, -1)} data-codemods="true">`;
const newOpeningParentTag = newName.includes("Toolbar")
@@ -645,7 +645,7 @@ function addCallbackParam(
} else if (propProperties.type === "Identifier") {
const matchingVariable = findVariableDeclaration(
propProperties.name,
- context.getSourceCode().getScope(node)
+ context.sourceCode.getScope(node)
);
const matchingDefinition = matchingVariable?.defs.find(
(def) => def.name?.name === propProperties.name
@@ -686,7 +686,7 @@ function addCallbackParam(
if (isStateSetter(callee)) {
propProperties.isStateSetter = true;
propProperties.stateType =
- matchingDefinition?.node.init.typeParameters?.params[0].typeName?.name;
+ matchingDefinition?.node.init.typeArguments?.params[0].typeName?.name;
}
}
} else if (propProperties.type === "MemberExpression") {
@@ -810,14 +810,14 @@ function addCallbackParam(
const newParamsText = `${newParam}, ${params
.filter((p) => p.name !== newParam)
- .map((p) => context.getSourceCode().getText(p))
+ .map((p) => context.sourceCode.getText(p))
.join(", ")}`;
fixes.push(
fixer.replaceText(
propProperties.nodeToReplace,
`(${newParamsText}) => ${context
- .getSourceCode()
+ .sourceCode
.getText(propProperties.nodeToReplace)}(${params
.map((p) => p.name)
.join(", ")})`
@@ -828,11 +828,11 @@ function addCallbackParam(
const firstParam = params[0];
const replacementParams = `${newParam}, ${context
- .getSourceCode()
+ .sourceCode
.getText(firstParam)}`;
const hasParenthesis =
- context.getTokenBefore(firstParam).value === "(";
+ context.sourceCode.getTokenBefore(firstParam).value === "(";
return fixer.replaceText(
firstParam,
@@ -846,7 +846,7 @@ function addCallbackParam(
currentUseOfNewParam
) => {
const tokenBeforeCurrentUse =
- context.getTokenBefore(currentUseOfNewParam);
+ context.sourceCode.getTokenBefore(currentUseOfNewParam);
const targetRange = [
tokenBeforeCurrentUse.range[0],
currentUseOfNewParam.range[1],
@@ -910,7 +910,7 @@ function getAllJSXElements(context) {
}
};
- traverse(context.getSourceCode().ast);
+ traverse(context.sourceCode.ast);
return jsxElements;
}
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/alert-new-action.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/alert-new-action.js
index 751ae69f0..c11e49dab 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/alert-new-action.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/alert-new-action.js
@@ -14,7 +14,7 @@ module.exports = {
if (imports.map(imp => imp.local.name).includes(node.name.name)) {
const attribute = node.attributes.find(node => node.name?.name === 'action');
if (attribute) {
- const attributeValue = context.getSourceCode().getText(attribute.value);
+ const attributeValue = context.sourceCode.getText(attribute.value);
const isLink = attributeValue.includes('Link');
context.report({
node,
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/background-image-src-enum.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/background-image-src-enum.js
index 144c8cb3a..6ffd14dcf 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/background-image-src-enum.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/background-image-src-enum.js
@@ -23,7 +23,7 @@ module.exports = {
const fixes = [
fixer.remove(node)
];
- const nextToken = context.getSourceCode().getTokenAfter(node);
+ const nextToken = context.sourceCode.getTokenAfter(node);
// Remove trailing ,
if (nextToken && nextToken.value === ',') {
fixes.push(fixer.remove(nextToken));
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/chart-remove-allowZoom.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/chart-remove-allowZoom.js
index 85654847f..3fd1df7f6 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/chart-remove-allowZoom.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/chart-remove-allowZoom.js
@@ -11,7 +11,7 @@ module.exports = {
);
if (victoryCoreImports.length === 0) {
const lastImportNode = context
- .getSourceCode()
+ .sourceCode
.ast.body.filter((node) => node.type === "ImportDeclaration")
.pop();
const importStatement = `import { VictoryZoomContainer } from 'victory-zoom-container';`;
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/chipgroup-remove-chipgrouptoolbaritem.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/chipgroup-remove-chipgrouptoolbaritem.js
index 4d6497ae6..f1b06bab0 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/chipgroup-remove-chipgrouptoolbaritem.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/chipgroup-remove-chipgrouptoolbaritem.js
@@ -26,7 +26,7 @@ module.exports = {
};
if (hasSingleChipGroupParent) {
const childText = node.children
- .map(child => context.getSourceCode().getText(child))
+ .map(child => context.sourceCode.getText(child))
.join('');
const attributes = node.openingElement.attributes
.map(attr => `${attr.name.name}=${attr.value.raw}`)
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/datatoolbar-rename-toolbar.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/datatoolbar-rename-toolbar.js
index cce139e0c..a0adba46b 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/datatoolbar-rename-toolbar.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/datatoolbar-rename-toolbar.js
@@ -51,10 +51,10 @@ module.exports = {
const needsDataAttr = ['Toolbar', 'ToolbarGroup', 'ToolbarItem'].includes(toolbarName);
const addDataAttr = jsxStr => `${jsxStr.slice(0, -1)} data-codemods="true">`;
const updateTagName = node => context
- .getSourceCode()
+ .sourceCode
.getText(node)
.replace('DataToolbar', 'Toolbar');
- const isOpeningTag = context.getSourceCode().getTokenBefore(node).value !== '/';
+ const isOpeningTag = context.sourceCode.getTokenBefore(node).value !== '/';
const newOpeningParentTag = needsDataAttr ? addDataAttr(updateTagName(node.parent)) : updateTagName(node.parent);
const newClosingTag = updateTagName(node);
context.report({
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/dropdown-rename-icon.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/dropdown-rename-icon.js
index 608f09623..5bcb124a9 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/dropdown-rename-icon.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/dropdown-rename-icon.js
@@ -21,7 +21,7 @@ module.exports = {
child.openingElement.name.name === dropdownItemIconImport.local.name
);
const childText = dropdownIcons.length === 1 && dropdownIcons[0].children
- .map(child => context.getSourceCode().getText(child))
+ .map(child => context.sourceCode.getText(child))
.join('')
.trim();
const variant = node.openingElement.attributes.find(attr => attr.name && attr.name.name === 'variant');
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/form-fix-isValid.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/form-fix-isValid.js
index 356cbb9f6..0d0ab0513 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/form-fix-isValid.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/form-fix-isValid.js
@@ -30,7 +30,7 @@ module.exports = {
let replacementValue = '"default"';
if (attribute.value && attribute.value.type === 'JSXExpressionContainer') { // isValid={cond}
- const boolCondition = context.getSourceCode().getText(attribute.value.expression);
+ const boolCondition = context.sourceCode.getText(attribute.value.expression);
if (boolCondition === 'false') {
replacementValue = '"error"'
}
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/nav-list-variant.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/nav-list-variant.js
index 1cff2565b..81abadf08 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/nav-list-variant.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/nav-list-variant.js
@@ -61,7 +61,7 @@ module.exports = {
const variantVal = variantAttr.value.expression && variantAttr.value.expression.object.name === 'NavListVariants'
? `variant="${variantAttr.value.expression.property.name}"`
- : context.getSourceCode().getText(variantAttr);
+ : context.sourceCode.getText(variantAttr);
context.report({
node,
messageId: "removeNavListVariant",
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/no-unused-imports.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/no-unused-imports.js
index 6f9766518..6a353633a 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/no-unused-imports.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/no-unused-imports.js
@@ -2,9 +2,9 @@
module.exports = {
meta: { fixable: 'code' },
create: function(context) {
- const allTokens = context.getSourceCode().ast.body
+ const allTokens = context.sourceCode.ast.body
.filter(node => node.type !== 'ImportDeclaration')
- .map(node => context.getSourceCode().getTokens(node).map(token => token.value))
+ .map(node => context.sourceCode.getTokens(node).map(token => token.value))
.reduce((acc, val) => acc.concat(val), []);
return {
@@ -20,7 +20,7 @@ module.exports = {
message: `unused patternfly import ${spec.local.name}`,
fix(fixer) {
const fixes = [fixer.remove(spec)];
- const prevToken = context.getSourceCode().getTokenBefore(spec);
+ const prevToken = context.sourceCode.getTokenBefore(spec);
if (prevToken && prevToken.value === ',') {
fixes.push(fixer.remove(prevToken));
}
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/page-header-move-avatar.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/page-header-move-avatar.js
index 900806bfe..afce5a111 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/page-header-move-avatar.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/page-header-move-avatar.js
@@ -38,7 +38,7 @@ module.exports = {
fix(fixer) {
if (!headerToolsAttr) {
// comment out
- return fixer.replaceText(avatarAttr, `/*TODO: move to PageHeaderTools - ${context.getSourceCode().getText(avatarAttr)}*/`)
+ return fixer.replaceText(avatarAttr, `/*TODO: move to PageHeaderTools - ${context.sourceCode.getText(avatarAttr)}*/`)
} else {
// move into headerTools if possible
if (
@@ -47,7 +47,7 @@ module.exports = {
headerToolsAttr.value.expression.openingElement.name.name === 'PageHeaderTools' &&
headerToolsAttr.value.expression.closingElement
) {
- const intermediateValue = context.getSourceCode().getText(avatarAttr.value);
+ const intermediateValue = context.sourceCode.getText(avatarAttr.value);
if (avatarAttr.value.expression && avatarAttr.value.expression.type === 'JSXElement') {
avatarValue = `${intermediateValue.substring(1, intermediateValue.length - 1)}`;
} else {
@@ -62,7 +62,7 @@ module.exports = {
]
} else {
// well we tried... just comment it out then
- return fixer.replaceText(avatarAttr, `/*TODO: move to PageHeaderTools - ${context.getSourceCode().getText(avatarAttr)}*/`)
+ return fixer.replaceText(avatarAttr, `/*TODO: move to PageHeaderTools - ${context.sourceCode.getText(avatarAttr)}*/`)
}
}
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/pagination-removed-variant.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/pagination-removed-variant.js
index 1415cfab2..a5ebd6302 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/pagination-removed-variant.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/pagination-removed-variant.js
@@ -14,7 +14,7 @@ module.exports = {
if (imports.map(imp => imp.local.name).includes(node.name.name)) {
const attribute = node.attributes.find(node => node.name && node.name.name === 'variant');
if (attribute) {
- const attributeValue = context.getSourceCode().getText(attribute.value);
+ const attributeValue = context.sourceCode.getText(attribute.value);
if (/left|right/.test(attributeValue))
context.report({
node,
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/progress-remove-info-variant.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/progress-remove-info-variant.js
index 01c12c677..0c6024746 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/progress-remove-info-variant.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/progress-remove-info-variant.js
@@ -12,7 +12,7 @@ module.exports = {
if (progressImports.map(imp => imp.local.name).includes(node.name.name)) {
const progressAttribute = node.attributes.find(node => node.name && node.name.name === 'variant');
if (progressAttribute) {
- const progressValueString = context.getSourceCode().getText(progressAttribute.value);
+ const progressValueString = context.sourceCode.getText(progressAttribute.value);
if (progressValueString.includes('info')) {
context.report({
node,
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/react-icons-remove-icon.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/react-icons-remove-icon.js
index 1bb18d47d..252a7090d 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/react-icons-remove-icon.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/react-icons-remove-icon.js
@@ -11,7 +11,7 @@ module.exports = {
const importStatement = `import { fontAwesomeLogoFull } from '@fortawesome/free-regular-svg-icons';`
if (imports.length) {
if (fortAwesomeImports.length === 0) {
- const lastImportNode = context.getSourceCode().ast.body
+ const lastImportNode = context.sourceCode.ast.body
.filter(node => node.type === 'ImportDeclaration')
.pop();
context.report({
@@ -40,7 +40,7 @@ module.exports = {
ImportSpecifier(node) {
if (imports.map(imp => imp.local.name).includes(node.local.name)) {
- const sourceCode = context.getSourceCode();
+ const sourceCode = context.sourceCode;
const previousToken = sourceCode.getTokenBefore(node);
const previousTokenText = sourceCode.getText(previousToken);
const lastNodeToken = sourceCode.getLastToken(node);
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/tab-title-text.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/tab-title-text.js
index a74f22c24..3abac68f7 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/tab-title-text.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/tab-title-text.js
@@ -16,7 +16,7 @@ module.exports = {
const attribute = node.attributes.find(node => node.name && node.name.name === 'title');
if (attribute) {
const { value } = attribute;
- const valueText = context.getSourceCode().getText(value);
+ const valueText = context.sourceCode.getText(value);
if (valueText.indexOf('TabTitleText') !== -1 || valueText.indexOf('TabTitleIcon') !== -1) {
return;
}
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/table-removed-transforms.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/table-removed-transforms.js
index 7ced84800..bf9a00b6e 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/table-removed-transforms.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/table-removed-transforms.js
@@ -25,7 +25,7 @@ module.exports = {
const isCellHeightAutoNode = node.callee.name && node.callee.name === 'cellHeightAuto';
if (isCellHeightAutoNode && cellHeightAutoImport.length) {
- const sourceCode = context.getSourceCode();
+ const sourceCode = context.sourceCode;
const previousToken = sourceCode.getTokenBefore(node);
const previousTokenText = sourceCode.getText(previousToken);
const lastNodeToken = sourceCode.getLastToken(node);
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/title-size.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/title-size.js
index dccd0bad4..94cd5f896 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/title-size.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/title-size.js
@@ -17,7 +17,7 @@ module.exports = {
if (titleImports.map(imp => imp.local.name).includes(node.name.name)) {
const sizeAttribute = node.attributes.find(n => n.name && n.name.name === 'size');;
if (sizeAttribute && !validSizes.includes(sizeAttribute.value.value)) {
- const sizeValueString = context.getSourceCode().getText(sizeAttribute.value);
+ const sizeValueString = context.sourceCode.getText(sizeAttribute.value);
const valueGuess = validSizes.find(val => sizeValueString.includes(val)) || 'md';
context.report({
node,
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v4/wizard-rename-hasBodyPadding.js b/packages/eslint-plugin-pf-codemods/lib/rules/v4/wizard-rename-hasBodyPadding.js
index 36c37832a..20a18c5e6 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v4/wizard-rename-hasBodyPadding.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v4/wizard-rename-hasBodyPadding.js
@@ -6,7 +6,7 @@ module.exports = {
create: function(context) {
const imports = getFromPackage(context, '@patternfly/react-core')
.imports.filter(specifier => ['Wizard', 'WizardBody', 'WizardToggle'].includes(specifier.imported.name));
- const sourceCode = context.getSourceCode();
+ const sourceCode = context.sourceCode;
return imports.length == 0 ? {} : {
JSXOpeningElement(node) {
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/accordion-rename-displaySize-large.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/accordion-rename-displaySize-large.js
index d36cb5bc8..3626b60dd 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/accordion-rename-displaySize-large.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/accordion-rename-displaySize-large.js
@@ -13,7 +13,7 @@ module.exports = {
if (accordionImports.map(imp => imp.local.name).includes(node.name.name)) {
const sizeAttribute = node.attributes.find(a => a.name?.name === 'displaySize');;
if (sizeAttribute && sizeAttribute.value.value === "large") {
- const sizeValueString = context.getSourceCode().getText(sizeAttribute.value);
+ const sizeValueString = context.sourceCode.getText(sizeAttribute.value);
const valueGuess = 'lg';
context.report({
node,
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/backgroundImage-update-props.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/backgroundImage-update-props.js
index 88fe4f28e..d85d239bc 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/backgroundImage-update-props.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/backgroundImage-update-props.js
@@ -31,7 +31,7 @@ module.exports = {
(attribute) => attribute.name?.name === "src"
);
const getIdentifierType = (identifier) => {
- const currentScope = context.getScope();
+ const currentScope = context.sourceCode.getScope(node);
const matchingVariable = currentScope.variables.find(
(variable) => variable.name === identifier
);
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/backgroundImageSrcMap-remove-interface.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/backgroundImageSrcMap-remove-interface.js
index 5a7cfb6b6..8b07c443e 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/backgroundImageSrcMap-remove-interface.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/backgroundImageSrcMap-remove-interface.js
@@ -18,7 +18,7 @@ module.exports = {
const importExportMessage =
"The BackgroundImageSrcMap interface has been removed.";
const removeSpecifier = (fixer, context, node, specifier) => {
- const tokenAfter = context.getSourceCode().getTokenAfter(specifier);
+ const tokenAfter = context.sourceCode.getTokenAfter(specifier);
const { range } = specifier;
return node.specifiers.length > 1
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/cardHeader-update-api.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/cardHeader-update-api.js
index c04a264f4..0c18eb47c 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/cardHeader-update-api.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/cardHeader-update-api.js
@@ -37,7 +37,7 @@ module.exports = {
};
const getNodeContent = (node) => {
return node.children
- ?.map((child) => context.getSourceCode().getText(child))
+ ?.map((child) => context.sourceCode.getText(child))
.join("");
};
const createReplacementContent = (content, conditionOrLogicExpression) => {
@@ -47,7 +47,7 @@ module.exports = {
return isCardHeaderMainContent ? content : `actions={${content}}`;
}
- const sourceCode = context.getSourceCode();
+ const sourceCode = context.sourceCode;
if (conditionOrLogicExpression.type === "LogicalExpression") {
const logicalExpressionContent = sourceCode.getText(
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/charts-remove-ChartThemeVariant.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/charts-remove-ChartThemeVariant.js
index b4c39e329..bb99e17ff 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/charts-remove-ChartThemeVariant.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/charts-remove-ChartThemeVariant.js
@@ -31,10 +31,10 @@ module.exports = {
const { range } = chartThemeVariantImport[0];
const prevToken = context
- .getSourceCode()
+ .sourceCode
.getTokenBefore(chartThemeVariantImport[0]);
const nextToken = context
- .getSourceCode()
+ .sourceCode
.getTokenAfter(chartThemeVariantImport[0]);
const rangeStart =
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/charts-remove-darkThemeObjects.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/charts-remove-darkThemeObjects.js
index fc3aec758..65ac6ee8c 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/charts-remove-darkThemeObjects.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/charts-remove-darkThemeObjects.js
@@ -33,10 +33,10 @@ module.exports = {
const { range } = darkThemeImport;
const prevToken = context
- .getSourceCode()
+ .sourceCode
.getTokenBefore(darkThemeImport);
const nextToken = context
- .getSourceCode()
+ .sourceCode
.getTokenAfter(darkThemeImport);
const rangeStart =
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/charts-remove-themeVariant.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/charts-remove-themeVariant.js
index 4b317b14f..f7242166a 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/charts-remove-themeVariant.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/charts-remove-themeVariant.js
@@ -25,7 +25,7 @@ module.exports = {
"The themeVariant prop has been removed for all react-charts components.",
fix(fixer) {
const prevToken = context
- .getSourceCode()
+ .sourceCode
.getTokenBefore(themeVariantProp);
return fixer.replaceTextRange(
[prevToken.range[1], themeVariantProp.range[1]],
@@ -54,7 +54,7 @@ module.exports = {
fix(fixer) {
const { range } = node.arguments[1];
const prevToken = context
- .getSourceCode()
+ .sourceCode
.getTokenBefore(node.arguments[1]);
return fixer.replaceTextRange([prevToken.range[0], range[1]], "");
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/charts-resizeObserver-import.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/charts-resizeObserver-import.js
index df0f6ddba..6e2143f8c 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/charts-resizeObserver-import.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/charts-resizeObserver-import.js
@@ -29,7 +29,7 @@ module.exports = {
if (node.specifiers.length > 1) {
const { range } = chartResizeImport[0];
const nextToken = context
- .getSourceCode()
+ .sourceCode
.getTokenAfter(chartResizeImport[0]);
const rangeEnd =
nextToken && nextToken.value === ","
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/chip-update-badgeAPI.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/chip-update-badgeAPI.js
index e83b6764c..9da9924c3 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/chip-update-badgeAPI.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/chip-update-badgeAPI.js
@@ -38,7 +38,7 @@ module.exports = {
return [
fixer.insertTextAfter(
chipAncestor.openingElement.name,
- ` badge={${context.getSourceCode().getText(node)}}`
+ ` badge={${context.sourceCode.getText(node)}}`
),
fixer.remove(node),
];
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/datalist-remove-selectableRow.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/datalist-remove-selectableRow.js
index 31aa08567..e582f06c2 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/datalist-remove-selectableRow.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/datalist-remove-selectableRow.js
@@ -15,7 +15,7 @@ module.exports = {
let rangeStartsToReplaceConst = [];
- const sourceCode = context.getSourceCode();
+ const sourceCode = context.sourceCode;
const getObjectProp = (expr, propName) =>
expr.properties.find(
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/deprecatedSelect-warn-markupUpdated.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/deprecatedSelect-warn-markupUpdated.js
index 0dd2f9d79..601084904 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/deprecatedSelect-warn-markupUpdated.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/deprecatedSelect-warn-markupUpdated.js
@@ -27,7 +27,7 @@ module.exports = {
let variantValue;
if (variantProp?.value?.expression?.type === "Identifier") {
- const scope = context.getSourceCode().getScope(node);
+ const scope = context.sourceCode.getScope(node);
const findVariableDeclaration = (name, scope) => {
while (scope !== null) {
const variable = scope.variables.find((v) => v.name === name);
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/emptyState-warn-change-structure.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/emptyState-warn-change-structure.js
index 2d5abf22a..4456c6b58 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/emptyState-warn-change-structure.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/emptyState-warn-change-structure.js
@@ -147,7 +147,7 @@ module.exports = {
}
const titleChildren = title.children
- .map((child) => context.getSourceCode().getText(child).trim())
+ .map((child) => context.sourceCode.getText(child).trim())
.join("");
return `{<>${titleChildren}>}`;
@@ -155,13 +155,13 @@ module.exports = {
const getHeaderText = () => {
const icon = emptyStateIcon
- ? `icon={${context.getSourceCode().getText(emptyStateIcon)}} `
+ ? `icon={${context.sourceCode.getText(emptyStateIcon)}} `
: "";
const titleText = title ? `titleText=${getTitleText()} ` : "";
const headingLevel = headingLevelAttribute
- ? `${context.getSourceCode().getText(headingLevelAttribute)} `
+ ? `${context.sourceCode.getText(headingLevelAttribute)} `
: "";
return ``;
@@ -177,7 +177,7 @@ module.exports = {
return [];
}
const token = context
- .getSourceCode()
+ .sourceCode
.getTokenAfter(emptyStateIcon);
return token.type === "JSXText" && token.value.trim() === ""
@@ -186,10 +186,10 @@ module.exports = {
};
const getImportEndRange = (imp) => {
- const nextComma = context.getSourceCode().getTokenAfter(imp);
+ const nextComma = context.sourceCode.getTokenAfter(imp);
- return context.getSourceCode().getText(nextComma) === ","
- ? context.getSourceCode().getTokenAfter(nextComma).range[0]
+ return context.sourceCode.getText(nextComma) === ","
+ ? context.sourceCode.getTokenAfter(nextComma).range[0]
: imp.range[1];
};
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/expandable-section-rename-displaySize-large.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/expandable-section-rename-displaySize-large.js
index c06e9a16f..0f354051b 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/expandable-section-rename-displaySize-large.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/expandable-section-rename-displaySize-large.js
@@ -13,7 +13,7 @@ module.exports = {
if (expandableSectionImports.map(imp => imp.local.name).includes(node.name.name)) {
const sizeAttribute = node.attributes.find(n => n.name?.name === 'displaySize');;
if (sizeAttribute && sizeAttribute.value.value === "large") {
- const sizeValueString = context.getSourceCode().getText(sizeAttribute.value);
+ const sizeValueString = context.sourceCode.getText(sizeAttribute.value);
const valueGuess = 'lg';
context.report({
node,
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/inputGroup-update-api.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/inputGroup-update-api.js
index 12f37fd7b..0c41589a9 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/inputGroup-update-api.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/inputGroup-update-api.js
@@ -93,7 +93,7 @@ module.exports = {
node,
message: `Any non-InputGroupText child passed to ${parentName} must now be wrapped within an InputGroupItem. The InputGroupItem may need the "isFill", "isPlain", and/or "isBox" props adjusted.`,
fix(fixer) {
- const sourceCode = context.getSourceCode();
+ const sourceCode = context.sourceCode;
const newChild = sourceCode.getText(child);
return fixer.replaceText(
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/loginPage-update-props.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/loginPage-update-props.js
index 02ecad40f..158a0116b 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/loginPage-update-props.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/loginPage-update-props.js
@@ -31,7 +31,7 @@ module.exports = {
(attribute) => attribute.name?.name === "backgroundImgSrc"
);
const getIdentifierType = (identifier) => {
- const currentScope = context.getScope();
+ const currentScope = context.sourceCode.getScope(node);
const matchingVariable = currentScope.variables.find(
(variable) => variable.name === identifier
);
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/no-unused-imports-v5.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/no-unused-imports-v5.js
index 289015580..959998574 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/no-unused-imports-v5.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/no-unused-imports-v5.js
@@ -2,7 +2,7 @@
module.exports = {
meta: { fixable: "code" },
create: function (context) {
- const sourceCode = context.getSourceCode();
+ const sourceCode = context.sourceCode;
const allTokens = [
...new Set(
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/notificationBadge-remove-isRead.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/notificationBadge-remove-isRead.js
index 34145d374..07445ccfe 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/notificationBadge-remove-isRead.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/notificationBadge-remove-isRead.js
@@ -15,7 +15,7 @@ const { getFromPackage } = require('../../helpers');
return;
}
const attrValType = isReadAttr.value?.expression?.type;
- let attrValStr = !attrValType ? '' : context.getSourceCode().getText(isReadAttr.value.expression);
+ let attrValStr = !attrValType ? '' : context.sourceCode.getText(isReadAttr.value.expression);
let newVal = "";
if (attrValType === undefined || (attrValType === "Literal" && attrValStr === "true")) {
newVal = '"read"';
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/pageSidebar-update-api.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/pageSidebar-update-api.js
index 78a2b8c3d..9b8ab0d09 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/pageSidebar-update-api.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/pageSidebar-update-api.js
@@ -50,13 +50,13 @@ module.exports = {
);
const otherPropValues = otherProps
? otherProps
- .map((prop) => context.getSourceCode().getText(prop))
+ .map((prop) => context.sourceCode.getText(prop))
.join(" ")
: "";
const getSidebarContent = () => {
const navPropValue = context
- .getSourceCode()
+ .sourceCode
.getText(navProp.value);
if (
navProp.value.type === "Literal" ||
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/pagination-rename-props.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/pagination-rename-props.js
index aeb71c041..3545981fd 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/pagination-rename-props.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/pagination-rename-props.js
@@ -86,7 +86,7 @@ module.exports = {
if (prop?.shorthand) {
const variable = findVariableDeclaration(
propName,
- context.getSourceCode().getScope(expr)
+ context.sourceCode.getScope(expr)
);
variable &&
@@ -102,7 +102,7 @@ module.exports = {
if (expr?.type === "Identifier") {
const variable = findVariableDeclaration(
expr.name,
- context.getSourceCode().getScope(node)
+ context.sourceCode.getScope(node)
);
const variableValue = variable.defs[0].node.init;
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/popover-remove-props.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/popover-remove-props.js
index cd01e8009..827533ad4 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/popover-remove-props.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/popover-remove-props.js
@@ -37,7 +37,7 @@ module.exports = {
type: shouldCloseAttr.value?.expression?.type,
name: shouldCloseAttr.value?.expression?.name,
};
- const currentScope = context.getScope();
+ const currentScope = context.sourceCode.getScope(node);
const matchingVariable = currentScope.variables.find(
(variable) => variable.name === propProperties.name
);
@@ -70,7 +70,7 @@ module.exports = {
type: attr.value?.expression?.type,
name: attr.value?.expression?.name,
};
- const currentScope = context.getScope();
+ const currentScope = context.sourceCode.getScope(node);
const matchingVariable = currentScope.variables.find(
(variable) => variable.name === propProperties.name
);
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/resizeObserver-function-param.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/resizeObserver-function-param.js
index e2c7244eb..d717f1223 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/resizeObserver-function-param.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/resizeObserver-function-param.js
@@ -23,7 +23,7 @@ module.exports = {
{
desc: "Omit the third argument or pass in a value of false when the callback passed in is debounced. This is the new default functionality.",
fix: function (fixer) {
- const lastToken = context.getLastToken(node);
+ const lastToken = context.sourceCode.getLastToken(node);
const fixes = [
fixer.insertTextBefore(lastToken, ", false"),
];
@@ -33,7 +33,7 @@ module.exports = {
{
desc: "Pass in a value of true if the callback passed in is not debounced. This maintains the previous functionality.",
fix: function (fixer) {
- const lastToken = context.getLastToken(node);
+ const lastToken = context.sourceCode.getLastToken(node);
const fixes = [
fixer.insertTextBefore(lastToken, ", true"),
];
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/table-rename-TableComposable.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/table-rename-TableComposable.js
index ce7133f3d..7f06f401e 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/table-rename-TableComposable.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/table-rename-TableComposable.js
@@ -33,7 +33,7 @@ module.exports = {
importedNode?.local?.name !== importedNode?.imported?.name;
if (importedNode?.imported?.name === "TableComposable") {
const updateTagName = (node) => {
- const tagName = context.getSourceCode().getText(node);
+ const tagName = context.sourceCode.getText(node);
if (isAliased) {
return tagName;
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/tableActionsColumn-removed-tooltipProp.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/tableActionsColumn-removed-tooltipProp.js
index b78365069..95418159d 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/tableActionsColumn-removed-tooltipProp.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/tableActionsColumn-removed-tooltipProp.js
@@ -37,7 +37,7 @@ module.exports = {
let itemsPropValue;
if (itemsProp.value.expression?.type === "Identifier") {
- const currentScope = context.getSourceCode().getScope(node);
+ const currentScope = context.sourceCode.getScope(node);
const itemsPropDeclaration = findVariableDeclaration(
itemsProp.value.expression.name,
currentScope
@@ -69,7 +69,7 @@ module.exports = {
}
if (type === "JSXElement") {
- return context.getSourceCode().getText(tooltipProp.value);
+ return context.sourceCode.getText(tooltipProp.value);
}
};
@@ -102,7 +102,7 @@ module.exports = {
);
const tooltipPropertyHasComma =
- context.getSourceCode().getTokenAfter(tooltipProperty)
+ context.sourceCode.getTokenAfter(tooltipProperty)
.value === ",";
const { range } = tooltipProperty;
fixes.push(
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/tabs-rename-hasBorderBottom.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/tabs-rename-hasBorderBottom.js
index 9fcadc556..1540c1201 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/tabs-rename-hasBorderBottom.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/tabs-rename-hasBorderBottom.js
@@ -6,7 +6,7 @@ module.exports = {
create: function(context) {
const imports = getFromPackage(context, '@patternfly/react-core')
.imports.filter(specifier => specifier.imported.name === 'Tabs');
- const sourceCode = context.getSourceCode();
+ const sourceCode = context.sourceCode;
return imports.length == 0 ? {} : {
JSXOpeningElement(node) {
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/td-TdSelectType-TdActionsType-rename-disable.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/td-TdSelectType-TdActionsType-rename-disable.js
index ca5bf784f..5fad7ee1b 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/td-TdSelectType-TdActionsType-rename-disable.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/td-TdSelectType-TdActionsType-rename-disable.js
@@ -53,7 +53,7 @@ module.exports = {
if (disableProp?.shorthand) {
const variable = findVariableDeclaration(
"disable",
- context.getSourceCode().getScope(expr)
+ context.sourceCode.getScope(expr)
);
variable && toReplace.push(variable.defs[0].node.id);
@@ -72,7 +72,7 @@ module.exports = {
if (expr.type === "Identifier") {
const variable = findVariableDeclaration(
expr.name,
- context.getSourceCode().getScope(node)
+ context.sourceCode.getScope(node)
);
const variableValue = variable.defs[0].node.init;
diff --git a/packages/eslint-plugin-pf-codemods/lib/rules/v5/various-rename-default.js b/packages/eslint-plugin-pf-codemods/lib/rules/v5/various-rename-default.js
index dbbb9b153..6825e1da0 100644
--- a/packages/eslint-plugin-pf-codemods/lib/rules/v5/various-rename-default.js
+++ b/packages/eslint-plugin-pf-codemods/lib/rules/v5/various-rename-default.js
@@ -53,7 +53,7 @@ module.exports = {
? node.property
: findVariableDeclaration(
node.property.name,
- context.getSourceCode().getScope(node)
+ context.sourceCode.getScope(node)
)?.defs[0].node.init;
if (
nodeToReplace &&
@@ -116,7 +116,7 @@ module.exports = {
if (expr.type === "Identifier") {
nodeToReplace = findVariableDeclaration(
expr.name,
- context.getSourceCode().getScope(expr)
+ context.sourceCode.getScope(expr)
)?.defs[0].node.init;
}
}
diff --git a/packages/eslint-plugin-pf-codemods/package.json b/packages/eslint-plugin-pf-codemods/package.json
index 3d188dfbf..f8aa1c634 100644
--- a/packages/eslint-plugin-pf-codemods/package.json
+++ b/packages/eslint-plugin-pf-codemods/package.json
@@ -14,15 +14,15 @@
"build": "yarn build:esm && yarn build:cjs",
"build:esm": "tsc --build --verbose ./tsconfig.json",
"build:cjs": "tsc --build --verbose ./tsconfig.cjs.json",
- "test": "eslint . --ext .ts",
+ "test": "eslint .",
"clean": "rimraf ./dist"
},
"dependencies": {
"@patternfly/shared-codemod-helpers": "workspace:^"
},
"peerDependencies": {
- "@typescript-eslint/parser": ">=5.58.0",
- "eslint": ">=0.8.0",
+ "@typescript-eslint/parser": ">=8.0.0",
+ "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
"typescript": ">=3.8.3"
},
"devDependencies": {
diff --git a/packages/eslint-plugin-pf-codemods/src/configs.ts b/packages/eslint-plugin-pf-codemods/src/configs.ts
index cf06e6147..c669d8796 100644
--- a/packages/eslint-plugin-pf-codemods/src/configs.ts
+++ b/packages/eslint-plugin-pf-codemods/src/configs.ts
@@ -1,4 +1,5 @@
-import { mappedRules } from "./ruleCuration";
+import { mappedRules, rules } from "./ruleCuration";
+import * as parser from "@typescript-eslint/parser";
const sourceTypeModule: "script" | "module" = "module";
@@ -21,5 +22,28 @@ export const configs = {
},
rules: mappedRules,
},
+ "flat/recommended": {
+ name: "pf-codemods/flat/recommended",
+ files: ["**/*.{js,jsx,ts,tsx}"],
+ plugins: {
+ "@patternfly/pf-codemods": {
+ rules,
+ },
+ },
+ languageOptions: {
+ parser,
+ ecmaVersion: "latest",
+ sourceType: sourceTypeModule,
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
+ },
+ linterOptions: {
+ noInlineConfig: true,
+ reportUnusedDisableDirectives: "off",
+ },
+ rules: mappedRules,
+ },
};
-
diff --git a/packages/eslint-plugin-pf-codemods/src/module-declarations.d.ts b/packages/eslint-plugin-pf-codemods/src/module-declarations.d.ts
new file mode 100644
index 000000000..ef9bad931
--- /dev/null
+++ b/packages/eslint-plugin-pf-codemods/src/module-declarations.d.ts
@@ -0,0 +1,5 @@
+// @typescript-eslint/parser has no top-level "types"/"main" entry, so it
+// cannot be resolved by TypeScript's "node" module resolution. It is only
+// used as an opaque parser object in flat configs, so an any-typed ambient
+// module declaration is sufficient.
+declare module "@typescript-eslint/parser";
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/helpers/JSXAttributes.ts b/packages/eslint-plugin-pf-codemods/src/rules/helpers/JSXAttributes.ts
index e891fe394..997bac2aa 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/helpers/JSXAttributes.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/helpers/JSXAttributes.ts
@@ -81,7 +81,7 @@ export function getAttributeValue(
}
if (node.expression.type === "Identifier") {
- const variableScope = context.getSourceCode().getScope(node);
+ const variableScope = context.sourceCode.getScope(node);
return getVariableValue(node.expression.name, variableScope, context);
}
if (node.expression.type === "MemberExpression") {
@@ -162,7 +162,7 @@ export function getVariableValue(
if (variableInit.type === "Identifier") {
return getVariableValue(
variableInit.name,
- context.getSourceCode().getScope(variableInit),
+ context.sourceCode.getScope(variableInit),
context
);
}
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/helpers/fixers.ts b/packages/eslint-plugin-pf-codemods/src/rules/helpers/fixers.ts
index edd1cd5a9..7c3ea0cfe 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/helpers/fixers.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/helpers/fixers.ts
@@ -29,7 +29,7 @@ export function removeSpecifierFromDeclaration(
}
const startRange = specifierToRemove.range[0];
- const endRange = getEndRange(context.getSourceCode(), specifierToRemove);
+ const endRange = getEndRange(context.sourceCode, specifierToRemove);
if (!startRange || !endRange) {
return [];
}
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/helpers/getEnumPropertyName.ts b/packages/eslint-plugin-pf-codemods/src/rules/helpers/getEnumPropertyName.ts
index 0e9392956..ffffc28e0 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/helpers/getEnumPropertyName.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/helpers/getEnumPropertyName.ts
@@ -10,7 +10,7 @@ export function getEnumPropertyName(
if (enumNode.property.type === "Identifier") {
// E.g. const key = "key"; someEnum[key]
if (enumNode.computed) {
- const scope = context.getSourceCode().getScope(enumNode);
+ const scope = context.sourceCode.getScope(enumNode);
const propertyName = enumNode.property.name;
return getVariableValue(propertyName, scope, context).value?.toString();
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/helpers/getFromPackage.ts b/packages/eslint-plugin-pf-codemods/src/rules/helpers/getFromPackage.ts
index c310fa2ac..d90507139 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/helpers/getFromPackage.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/helpers/getFromPackage.ts
@@ -60,7 +60,7 @@ export function getFromPackage(
packageName: string,
specifierNames?: string[]
) {
- const astBody = context.getSourceCode().ast.body;
+ const astBody = context.sourceCode.ast.body;
const imports = getSpecifiers(
astBody,
@@ -92,7 +92,7 @@ export function getDefaultImportsFromPackage(
packageName: string,
componentName: string = ""
): ImportDefaultSpecifierWithParent[] {
- const astBody = context.getSourceCode().ast.body;
+ const astBody = context.sourceCode.ast.body;
const importDeclarations = astBody.filter(
(node) => node?.type === "ImportDeclaration"
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/helpers/getNodeForAttributeFixer.ts b/packages/eslint-plugin-pf-codemods/src/rules/helpers/getNodeForAttributeFixer.ts
index 0113d1436..f7159065a 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/helpers/getNodeForAttributeFixer.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/helpers/getNodeForAttributeFixer.ts
@@ -35,7 +35,7 @@ function getJSXExpressionContainerValue(
case "MemberExpression":
return attribute.value.expression;
case "Identifier":
- const scope = context.getSourceCode().getScope(attribute);
+ const scope = context.sourceCode.getScope(attribute);
const variableDeclaration = getVariableDeclaration(
attribute.value.expression.name,
scope
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/helpers/getText.ts b/packages/eslint-plugin-pf-codemods/src/rules/helpers/getText.ts
index 14f96b2e1..bcab3d2ec 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/helpers/getText.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/helpers/getText.ts
@@ -16,7 +16,7 @@ export function getAttributeText(
return "";
}
- return context.getSourceCode().getText(attribute);
+ return context.sourceCode.getText(attribute);
}
export function getAttributeValueText(
@@ -27,11 +27,11 @@ export function getAttributeValueText(
return "";
}
- return context.getSourceCode().getText(attribute.value);
+ return context.sourceCode.getText(attribute.value);
}
export function getNodesText(context: Rule.RuleContext, nodes: Node[]) {
- return nodes.map((node) => context.getSourceCode().getText(node)).join("");
+ return nodes.map((node) => context.sourceCode.getText(node)).join("");
}
export function getChildrenAsAttributeValueText(
@@ -60,7 +60,7 @@ export function getChildrenAsAttributeValueText(
if (nonEmptyChildrenNodes.length === 1) {
const singleChild = nonEmptyChildrenNodes[0];
const singleChildText = context
- .getSourceCode()
+ .sourceCode
.getText(
singleChild as JSXExpressionContainer | JSXElement | JSXFragment
);
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/helpers/helpers.js b/packages/eslint-plugin-pf-codemods/src/rules/helpers/helpers.js
index 23f2cf85e..cf71bef35 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/helpers/helpers.js
+++ b/packages/eslint-plugin-pf-codemods/src/rules/helpers/helpers.js
@@ -12,7 +12,7 @@ export function moveSpecifiers(
messageAfterSpecifierPathChange
) {
return function (context) {
- const src = context.getSourceCode();
+ const src = context.sourceCode;
const { imports: fromPackageImports, exports: fromPackageExports } =
getFromPackage(context, fromPackage, specifiersToMove);
@@ -386,7 +386,7 @@ export function renameComponents(
// if no data-codemods && closing tag, rename
const newName = componentMap[nodeName];
const updateTagName = (node) =>
- context.getSourceCode().getText(node).replace(nodeName, newName);
+ context.sourceCode.getText(node).replace(nodeName, newName);
const addDataAttr = (jsxStr) =>
`${jsxStr.slice(0, -1)} data-codemods="true">`;
const newOpeningParentTag = newName.includes('Toolbar')
@@ -500,7 +500,7 @@ export function addCallbackParam(
} else if (propProperties.type === 'Identifier') {
const matchingVariable = getVariableDeclaration(
propProperties.name,
- context.getSourceCode().getScope(node)
+ context.sourceCode.getScope(node)
);
const matchingDefinition = matchingVariable?.defs.find(
(def) => def.name?.name === propProperties.name
@@ -541,7 +541,7 @@ export function addCallbackParam(
if (isStateSetter(callee)) {
propProperties.isStateSetter = true;
propProperties.stateType =
- matchingDefinition?.node.init.typeParameters?.params[0].typeName?.name;
+ matchingDefinition?.node.init.typeArguments?.params[0].typeName?.name;
}
}
} else if (propProperties.type === 'MemberExpression') {
@@ -665,14 +665,14 @@ export function addCallbackParam(
const newParamsText = `${newParam}, ${params
.filter((p) => p.name !== newParam)
- .map((p) => context.getSourceCode().getText(p))
+ .map((p) => context.sourceCode.getText(p))
.join(', ')}`;
fixes.push(
fixer.replaceText(
propProperties.nodeToReplace,
`(${newParamsText}) => ${context
- .getSourceCode()
+ .sourceCode
.getText(propProperties.nodeToReplace)}(${params
.map((p) => p.name)
.join(', ')})`
@@ -683,11 +683,11 @@ export function addCallbackParam(
const firstParam = params[0];
const replacementParams = `${newParam}, ${context
- .getSourceCode()
+ .sourceCode
.getText(firstParam)}`;
const hasParenthesis =
- context.getTokenBefore(firstParam).value === '(';
+ context.sourceCode.getTokenBefore(firstParam).value === '(';
return fixer.replaceText(
firstParam,
@@ -701,7 +701,7 @@ export function addCallbackParam(
currentUseOfNewParam
) => {
const tokenBeforeCurrentUse =
- context.getTokenBefore(currentUseOfNewParam);
+ context.sourceCode.getTokenBefore(currentUseOfNewParam);
const targetRange = [
tokenBeforeCurrentUse.range[0],
currentUseOfNewParam.range[1],
@@ -765,7 +765,7 @@ export function getAllJSXElements(context) {
}
};
- traverse(context.getSourceCode().ast);
+ traverse(context.sourceCode.ast);
return jsxElements;
}
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/helpers/importAndExport.ts b/packages/eslint-plugin-pf-codemods/src/rules/helpers/importAndExport.ts
index 2533b0f64..0d927b690 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/helpers/importAndExport.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/helpers/importAndExport.ts
@@ -23,7 +23,7 @@ export function getAllImportDeclarations(
context: Rule.RuleContext,
packageName?: string
) {
- const astBody = context.getSourceCode().ast.body;
+ const astBody = context.sourceCode.ast.body;
const importDeclarationsFromPackage = filterByDeclarationType(
astBody,
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/helpers/makeJSXElementSelfClosing.ts b/packages/eslint-plugin-pf-codemods/src/rules/helpers/makeJSXElementSelfClosing.ts
index 44944780f..ae094253c 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/helpers/makeJSXElementSelfClosing.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/helpers/makeJSXElementSelfClosing.ts
@@ -21,7 +21,7 @@ export function makeJSXElementSelfClosing(
if (removeChildren || emptyChildren) {
const closingSymbol = context
- .getSourceCode()
+ .sourceCode
.getLastToken(node.openingElement)!;
fixes.push(
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/helpers/propertyNameMatches.ts b/packages/eslint-plugin-pf-codemods/src/rules/helpers/propertyNameMatches.ts
index 521a565fd..049e4a49a 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/helpers/propertyNameMatches.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/helpers/propertyNameMatches.ts
@@ -13,7 +13,7 @@ export function propertyNameMatches(
if (key.type === "Identifier") {
// E.g. const key = "key"; {[key]: value}; someObject[key]
if (computed) {
- const scope = context.getSourceCode().getScope(key);
+ const scope = context.sourceCode.getScope(key);
const propertyName = key.name;
const propertyVariableValue = getVariableValue(
propertyName,
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/helpers/removeEmptyLineAfter.ts b/packages/eslint-plugin-pf-codemods/src/rules/helpers/removeEmptyLineAfter.ts
index 31f7a1de9..41d5bea25 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/helpers/removeEmptyLineAfter.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/helpers/removeEmptyLineAfter.ts
@@ -9,7 +9,7 @@ export const removeEmptyLineAfter = (
if (!node) {
return [];
}
- const token = context.getSourceCode().getTokenAfter(node);
+ const token = context.sourceCode.getTokenAfter(node);
return token && token.type === "JSXText" && token.value.trim() === ""
? [fixer.remove(token)]
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/helpers/testHelpers.ts b/packages/eslint-plugin-pf-codemods/src/rules/helpers/testHelpers.ts
index 600cde24b..b394232d4 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/helpers/testHelpers.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/helpers/testHelpers.ts
@@ -4,7 +4,6 @@ export type ValidTests = Array;
export type InvalidTests = RuleTester.InvalidTestCase[];
type TestErrors = {
message: string;
- type: string;
}[];
export function createValidTest(code: string) {
@@ -19,7 +18,9 @@ export function createInvalidTest(
) {
return {
code,
- output,
+ // RuleTester (eslint v10) requires `null`, rather than a string equal
+ // to `code`, to assert that a rule applies no fix
+ output: output === code ? null : output,
errors,
};
}
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/ruletester.ts b/packages/eslint-plugin-pf-codemods/src/rules/ruletester.ts
index 8708d0b43..2b8435802 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/ruletester.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/ruletester.ts
@@ -1,12 +1,15 @@
const { RuleTester } = require('eslint');
+const parser = require('@typescript-eslint/parser');
module.exports = new RuleTester({
- parser: require.resolve('@typescript-eslint/parser'),
- parserOptions: {
+ languageOptions: {
+ parser,
+ ecmaVersion: 'latest',
sourceType: 'module',
- ecmaVersion: 2015,
- ecmaFeatures: {
- jsx: true
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true
+ }
}
}
});
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/accordionContentRemoveIsHiddenProp/accordionContent-remove-isHidden-prop.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/accordionContentRemoveIsHiddenProp/accordionContent-remove-isHidden-prop.test.ts
index 6a3b44bb7..1f5ed3fdc 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/accordionContentRemoveIsHiddenProp/accordionContent-remove-isHidden-prop.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/accordionContentRemoveIsHiddenProp/accordionContent-remove-isHidden-prop.test.ts
@@ -17,7 +17,6 @@ ruleTester.run("accordionContent-remove-isHidden-prop", rule, {
errors: [
{
message: `The \`isHidden\` prop has been removed from AccordionContent, as its visibility will now be set automatically based on the \`isExpanded\` prop on AccordionItem.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/accordionItemWarnUpdateMarkup/accordionItem-warn-update-markup.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/accordionItemWarnUpdateMarkup/accordionItem-warn-update-markup.test.ts
index c03a17337..2a941b04e 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/accordionItemWarnUpdateMarkup/accordionItem-warn-update-markup.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/accordionItemWarnUpdateMarkup/accordionItem-warn-update-markup.test.ts
@@ -10,11 +10,10 @@ ruleTester.run("accordionItem-warn-update-markup", rule, {
invalid: [
{
code: `import { AccordionItem } from '@patternfly/react-core'; `,
- output: `import { AccordionItem } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `The markup for AccordionItem has been updated, and it now renders a \`div\` element as a wrapper.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/accordionToggleMoveIsExpandedProp/accordionToggle-move-isExpanded-prop.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/accordionToggleMoveIsExpandedProp/accordionToggle-move-isExpanded-prop.test.ts
index 56ed29525..86ee2d84e 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/accordionToggleMoveIsExpandedProp/accordionToggle-move-isExpanded-prop.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/accordionToggleMoveIsExpandedProp/accordionToggle-move-isExpanded-prop.test.ts
@@ -17,7 +17,6 @@ ruleTester.run("accordionToggle-move-isExpanded-prop", rule, {
errors: [
{
message: `The \`isExpanded\` prop for AccordionToggle has been moved to AccordionItem.`,
- type: "JSXOpeningElement",
},
],
},
@@ -27,7 +26,6 @@ ruleTester.run("accordionToggle-move-isExpanded-prop", rule, {
errors: [
{
message: `The \`isExpanded\` prop for AccordionToggle has been moved to AccordionItem.`,
- type: "JSXOpeningElement",
},
],
},
@@ -38,7 +36,6 @@ ruleTester.run("accordionToggle-move-isExpanded-prop", rule, {
errors: [
{
message: `The \`isExpanded\` prop for AccordionToggle has been moved to AccordionItem.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/accordionToggleMoveIsExpandedProp/accordionToggle-move-isExpanded-prop.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/accordionToggleMoveIsExpandedProp/accordionToggle-move-isExpanded-prop.ts
index 69bee7da1..0a9ccc931 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/accordionToggleMoveIsExpandedProp/accordionToggle-move-isExpanded-prop.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/accordionToggleMoveIsExpandedProp/accordionToggle-move-isExpanded-prop.ts
@@ -44,7 +44,7 @@ module.exports = {
current.openingElement.name.name === "AccordionItem"
);
const attributeValue = context
- .getSourceCode()
+ .sourceCode
.getText(attribute);
return accordionItemAncestor &&
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/avatarReplaceBorderForIsBordered/avatar-replace-border-for-isBordered.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/avatarReplaceBorderForIsBordered/avatar-replace-border-for-isBordered.test.ts
index 03d6af082..c73ac8131 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/avatarReplaceBorderForIsBordered/avatar-replace-border-for-isBordered.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/avatarReplaceBorderForIsBordered/avatar-replace-border-for-isBordered.test.ts
@@ -17,7 +17,6 @@ ruleTester.run('avatar-replace-border-for-isBordered', rule, {
errors: [
{
message: `border prop has been removed from Avatar since theming is not longer handled React-side. We recommend using the isBordered prop instead to add a border to Avatar.`,
- type: 'JSXOpeningElement',
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/bannerReplaceVariantProp/banner-replace-variantProp.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/bannerReplaceVariantProp/banner-replace-variantProp.test.ts
index 9a72a0ec4..440a8b8b0 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/bannerReplaceVariantProp/banner-replace-variantProp.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/bannerReplaceVariantProp/banner-replace-variantProp.test.ts
@@ -24,7 +24,6 @@ ruleTester.run("banner-replace-variantProp", rule, {
errors: [
{
message: createErrorMessage(true),
- type: "JSXOpeningElement",
},
],
},
@@ -34,7 +33,6 @@ ruleTester.run("banner-replace-variantProp", rule, {
errors: [
{
message: createErrorMessage(),
- type: "JSXOpeningElement",
},
],
},
@@ -44,7 +42,6 @@ ruleTester.run("banner-replace-variantProp", rule, {
errors: [
{
message: createErrorMessage(true),
- type: "JSXOpeningElement",
},
],
},
@@ -54,7 +51,6 @@ ruleTester.run("banner-replace-variantProp", rule, {
errors: [
{
message: createErrorMessage(true),
- type: "JSXOpeningElement",
},
],
},
@@ -64,7 +60,6 @@ ruleTester.run("banner-replace-variantProp", rule, {
errors: [
{
message: createErrorMessage(true),
- type: "JSXOpeningElement",
},
],
},
@@ -74,7 +69,6 @@ ruleTester.run("banner-replace-variantProp", rule, {
errors: [
{
message: createErrorMessage(true),
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/buttonMoveIconsIconProp/button-moveIcons-icon-prop.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/buttonMoveIconsIconProp/button-moveIcons-icon-prop.test.ts
index b7aa8e51f..a935220ac 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/buttonMoveIconsIconProp/button-moveIcons-icon-prop.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/buttonMoveIconsIconProp/button-moveIcons-icon-prop.test.ts
@@ -21,7 +21,6 @@ ruleTester.run("button-moveIcons-icon-prop", rule, {
errors: [
{
message: `Icons must now be passed to the \`icon\` prop of Button instead of as children. If you are passing anything other than an icon as children, ignore this rule when running fixes.`,
- type: "JSXElement",
},
],
},
@@ -31,7 +30,6 @@ ruleTester.run("button-moveIcons-icon-prop", rule, {
errors: [
{
message: `Icons must now be passed to the \`icon\` prop of Button instead of as children. If you are passing anything other than an icon as children, ignore this rule when running fixes.`,
- type: "JSXElement",
},
],
},
@@ -41,7 +39,6 @@ ruleTester.run("button-moveIcons-icon-prop", rule, {
errors: [
{
message: `Icons must now be passed to the \`icon\` prop of Button instead of as children. If you are passing anything other than an icon as children, ignore this rule when running fixes.`,
- type: "JSXElement",
},
],
},
@@ -51,7 +48,6 @@ ruleTester.run("button-moveIcons-icon-prop", rule, {
errors: [
{
message: `Icons must now be passed to the \`icon\` prop of Button instead of as children. If you are passing anything other than an icon as children, ignore this rule when running fixes.`,
- type: "JSXElement",
},
],
},
@@ -61,7 +57,6 @@ ruleTester.run("button-moveIcons-icon-prop", rule, {
errors: [
{
message: `Icons must now be passed to the \`icon\` prop of Button instead of as children. If you are passing anything other than an icon as children, ignore this rule when running fixes.`,
- type: "JSXElement",
},
],
},
@@ -71,7 +66,6 @@ ruleTester.run("button-moveIcons-icon-prop", rule, {
errors: [
{
message: `Icons must now be passed to the \`icon\` prop of Button instead of as children. If you are passing anything other than an icon as children, ignore this rule when running fixes.`,
- type: "JSXElement",
},
],
},
@@ -81,7 +75,6 @@ ruleTester.run("button-moveIcons-icon-prop", rule, {
errors: [
{
message: `Icons must now be passed to the \`icon\` prop of Button instead of as children. If you are passing anything other than an icon as children, ignore this rule when running fixes.`,
- type: "JSXElement",
},
],
},
@@ -92,7 +85,6 @@ ruleTester.run("button-moveIcons-icon-prop", rule, {
errors: [
{
message: `Icons must now be passed to the \`icon\` prop of Button instead of as children. If you are passing anything other than an icon as children, ignore this rule when running fixes.`,
- type: "JSXElement",
},
],
},
@@ -103,7 +95,6 @@ ruleTester.run("button-moveIcons-icon-prop", rule, {
errors: [
{
message: `Icons must now be passed to the \`icon\` prop of Button instead of as children. If you are passing anything other than an icon as children, ignore this rule when running fixes.`,
- type: "JSXElement",
},
],
},
@@ -114,7 +105,6 @@ ruleTester.run("button-moveIcons-icon-prop", rule, {
errors: [
{
message: `Icons must now be passed to the \`icon\` prop of Button instead of as children. If you are passing anything other than an icon as children, ignore this rule when running fixes.`,
- type: "JSXElement",
},
],
},
@@ -125,7 +115,6 @@ ruleTester.run("button-moveIcons-icon-prop", rule, {
errors: [
{
message: `Icons must now be passed to the \`icon\` prop of Button instead of as children. If you are passing anything other than an icon as children, ignore this rule when running fixes.`,
- type: "JSXElement",
},
],
},
@@ -136,7 +125,6 @@ ruleTester.run("button-moveIcons-icon-prop", rule, {
errors: [
{
message: `Icons must now be passed to the \`icon\` prop of Button instead of as children. If you are passing anything other than an icon as children, ignore this rule when running fixes.`,
- type: "JSXElement",
},
],
},
@@ -147,7 +135,6 @@ ruleTester.run("button-moveIcons-icon-prop", rule, {
errors: [
{
message: `Icons must now be passed to the \`icon\` prop of Button instead of as children. If you are passing anything other than an icon as children, ignore this rule when running fixes.`,
- type: "JSXElement",
},
],
},
@@ -158,7 +145,6 @@ ruleTester.run("button-moveIcons-icon-prop", rule, {
errors: [
{
message: `Icons must now be passed to the \`icon\` prop of Button instead of as children. If you are passing anything other than an icon as children, ignore this rule when running fixes.`,
- type: "JSXElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/buttonMoveIconsIconProp/button-moveIcons-icon-prop.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/buttonMoveIconsIconProp/button-moveIcons-icon-prop.ts
index 1e3cb877b..f2ba2a861 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/buttonMoveIconsIconProp/button-moveIcons-icon-prop.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/buttonMoveIconsIconProp/button-moveIcons-icon-prop.ts
@@ -17,7 +17,7 @@ import {
module.exports = {
meta: { fixable: "code" },
create: function (context: Rule.RuleContext) {
- const source = context.getSourceCode();
+ const source = context.sourceCode;
const { imports } = getFromPackage(context, "@patternfly/react-core");
const buttonImport = imports.find(
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/buttonRenameIsActive/button-rename-isActive.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/buttonRenameIsActive/button-rename-isActive.test.ts
index a38fb28f9..3b0eefd62 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/buttonRenameIsActive/button-rename-isActive.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/buttonRenameIsActive/button-rename-isActive.test.ts
@@ -17,7 +17,6 @@ ruleTester.run("button-rename-isActive", rule, {
errors: [
{
message: `isActive prop for Button has been renamed to isClicked`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/buttonSupportFavoriteVariant/button-support-favorite-variant.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/buttonSupportFavoriteVariant/button-support-favorite-variant.test.ts
index cc542abf3..668cd81ea 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/buttonSupportFavoriteVariant/button-support-favorite-variant.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/buttonSupportFavoriteVariant/button-support-favorite-variant.test.ts
@@ -49,7 +49,6 @@ ruleTester.run("button-support-favorite-variant", rule, {
errors: [
{
message: "It looks like you are trying to create a custom favorites button. Use `isFavorite` and `isFavorited` button properties instead to apply the correct styling.",
- type: "JSXElement",
},
],
},
@@ -59,7 +58,6 @@ ruleTester.run("button-support-favorite-variant", rule, {
errors: [
{
message: "It looks like you are trying to create a custom favorites button. Use `isFavorite` and `isFavorited` button properties instead to apply the correct styling.",
- type: "JSXElement",
},
],
},
@@ -69,7 +67,6 @@ ruleTester.run("button-support-favorite-variant", rule, {
errors: [
{
message: "It looks like you are trying to create a custom favorites button. Use `isFavorite` and `isFavorited` button properties instead to apply the correct styling.",
- type: "JSXElement",
},
],
},
@@ -79,7 +76,6 @@ ruleTester.run("button-support-favorite-variant", rule, {
errors: [
{
message: "It looks like you are trying to create a custom favorites button. Use `isFavorite` and `isFavorited` button properties instead to apply the correct styling.",
- type: "JSXElement",
},
],
},
@@ -89,7 +85,6 @@ ruleTester.run("button-support-favorite-variant", rule, {
errors: [
{
message: "It looks like you are trying to create a custom favorites button. Use `isFavorite` and `isFavorited` button properties instead to apply the correct styling.",
- type: "JSXElement",
},
],
},
@@ -99,7 +94,6 @@ ruleTester.run("button-support-favorite-variant", rule, {
errors: [
{
message: "It looks like you are trying to create a custom favorites button. Use `isFavorite` and `isFavorited` button properties instead to apply the correct styling.",
- type: "JSXElement",
},
],
},
@@ -109,7 +103,6 @@ ruleTester.run("button-support-favorite-variant", rule, {
errors: [
{
message: "It looks like you are trying to create a custom favorites button. Use `isFavorite` and `isFavorited` button properties instead to apply the correct styling.",
- type: "JSXElement",
},
],
},
@@ -119,7 +112,6 @@ ruleTester.run("button-support-favorite-variant", rule, {
errors: [
{
message: "It looks like you are trying to create a custom favorites button. Use `isFavorite` and `isFavorited` button properties instead to apply the correct styling.",
- type: "JSXElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/cardUpdatedClickableMarkup/card-updated-clickable-markup.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/cardUpdatedClickableMarkup/card-updated-clickable-markup.test.ts
index 10f32858a..e6bde2609 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/cardUpdatedClickableMarkup/card-updated-clickable-markup.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/cardUpdatedClickableMarkup/card-updated-clickable-markup.test.ts
@@ -27,11 +27,10 @@ ruleTester.run("card-updated-clickable-markup", rule, {
// No invalid properties
{
code: `import { Card, CardHeader } from '@patternfly/react-core'; `,
- output: `import { Card, CardHeader } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: baseMessage,
- type: "JSXElement",
},
],
},
@@ -42,7 +41,6 @@ ruleTester.run("card-updated-clickable-markup", rule, {
errors: [
{
message: baseMessage + propertyMessage,
- type: "JSXElement",
},
],
},
@@ -53,7 +51,6 @@ ruleTester.run("card-updated-clickable-markup", rule, {
errors: [
{
message: baseMessage + propertyMessage,
- type: "JSXElement",
},
],
},
@@ -64,7 +61,6 @@ ruleTester.run("card-updated-clickable-markup", rule, {
errors: [
{
message: baseMessage + propertyMessage,
- type: "JSXElement",
},
],
},
@@ -75,7 +71,6 @@ ruleTester.run("card-updated-clickable-markup", rule, {
errors: [
{
message: baseMessage + propertyMessage,
- type: "JSXElement",
},
],
},
@@ -86,49 +81,44 @@ ruleTester.run("card-updated-clickable-markup", rule, {
errors: [
{
message: baseMessage + propertyMessage,
- type: "JSXElement",
},
],
},
// Aliased
{
code: `import { Card as CustomCard, CardHeader as CustomCardHeader } from '@patternfly/react-core'; `,
- output: `import { Card as CustomCard, CardHeader as CustomCardHeader } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: baseMessage,
- type: "JSXElement",
},
],
},
// Dist Imports
{
code: `import { Card, CardHeader } from '@patternfly/react-core/dist/esm/components/Card/index.js'; `,
- output: `import { Card, CardHeader } from '@patternfly/react-core/dist/esm/components/Card/index.js'; `,
+ output: null,
errors: [
{
message: baseMessage,
- type: "JSXElement",
},
],
},
{
code: `import { Card, CardHeader } from '@patternfly/react-core/dist/js/components/Card/index.js'; `,
- output: `import { Card, CardHeader } from '@patternfly/react-core/dist/js/components/Card/index.js'; `,
+ output: null,
errors: [
{
message: baseMessage,
- type: "JSXElement",
},
],
},
{
code: `import { Card, CardHeader } from '@patternfly/react-core/dist/dynamic/components/Card/index.js'; `,
- output: `import { Card, CardHeader } from '@patternfly/react-core/dist/dynamic/components/Card/index.js'; `,
+ output: null,
errors: [
{
message: baseMessage,
- type: "JSXElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/cardUpdatedClickableMarkup/card-updated-clickable-markup.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/cardUpdatedClickableMarkup/card-updated-clickable-markup.ts
index bdf49e919..8c8502398 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/cardUpdatedClickableMarkup/card-updated-clickable-markup.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/cardUpdatedClickableMarkup/card-updated-clickable-markup.ts
@@ -101,7 +101,7 @@ module.exports = {
);
const replacementProperties = propertiesToKeep
.map((property) =>
- context.getSourceCode().getText(property)
+ context.sourceCode.getText(property)
)
.join(", ");
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/chartsImportMoved/chartsImport-moved.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/chartsImportMoved/chartsImport-moved.test.ts
index c20019fe0..a976254a7 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/chartsImportMoved/chartsImport-moved.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/chartsImportMoved/chartsImport-moved.test.ts
@@ -67,28 +67,28 @@ specifiersToMove.forEach((specifier) => {
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-charts';`,
`import {\n\t${specifier}\n} from '@patternfly/react-charts/victory';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} as CustomSpecifier } from '@patternfly/react-charts';`,
`import {\n\t${specifier} as CustomSpecifier\n} from '@patternfly/react-charts/victory';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-charts/dist/esm/components/index.js';`,
`import {\n\t${specifier}\n} from '@patternfly/react-charts/dist/esm/victory/components/index.js';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-charts/dist/js/components/index.js';`,
`import {\n\t${specifier}\n} from '@patternfly/react-charts/dist/js/victory/components/index.js';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
});
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/checkboxRadioReplaceIsLabelBeforeButton/checkbox-radio-replace-isLabelBeforeButton.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/checkboxRadioReplaceIsLabelBeforeButton/checkbox-radio-replace-isLabelBeforeButton.test.ts
index 468ea5dd3..d2dd64bd3 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/checkboxRadioReplaceIsLabelBeforeButton/checkbox-radio-replace-isLabelBeforeButton.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/checkboxRadioReplaceIsLabelBeforeButton/checkbox-radio-replace-isLabelBeforeButton.test.ts
@@ -22,7 +22,6 @@ ruleTester.run("checkbox-radio-replace-isLabelBeforeButton", rule, {
errors: [
{
message: `isLabelBeforeButton prop for ${component} has been replaced with labelPosition="start"`,
- type: "JSXOpeningElement",
},
],
})),
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/chipDeprecated/chip-deprecated.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/chipDeprecated/chip-deprecated.test.ts
index 605426cee..abb20dc51 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/chipDeprecated/chip-deprecated.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/chipDeprecated/chip-deprecated.test.ts
@@ -14,7 +14,6 @@ ruleTester.run('chip-deprecated', rule, {
errors: [
{
message: `Chip has been deprecated. Running the fix flag will update your imports to our deprecated package, but we suggest using Label instead.`,
- type: 'ImportDeclaration',
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/chipReplaceWithLabel/chip-replace-with-label.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/chipReplaceWithLabel/chip-replace-with-label.test.ts
index 9812b6785..438eec823 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/chipReplaceWithLabel/chip-replace-with-label.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/chipReplaceWithLabel/chip-replace-with-label.test.ts
@@ -3,7 +3,6 @@ import * as rule from './chip-replace-with-label';
const chipImportError = {
message: `Chip has been deprecated. Running the fix flag will replace Chip and ChipGroup components with Label and LabelGroup components respectively.`,
- type: 'ImportDeclaration',
};
ruleTester.run('chip-replace-with-label', rule, {
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/chipReplaceWithLabel/chip-replace-with-label.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/chipReplaceWithLabel/chip-replace-with-label.ts
index 2ba584ff7..f226488d4 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/chipReplaceWithLabel/chip-replace-with-label.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/chipReplaceWithLabel/chip-replace-with-label.ts
@@ -46,7 +46,7 @@ const moveBadgeAttributeToBody = (
const textToInsert = badgeAttribute?.value
? ` ${context
- .getSourceCode()
+ .sourceCode
.getText(parseBadgeAttributeValue(badgeAttribute.value))}`
: "";
@@ -144,7 +144,7 @@ module.exports = {
if (specifier) {
fixes.push(fixer.remove(specifier));
const tokenAfter = context
- .getSourceCode()
+ .sourceCode
.getTokenAfter(specifier);
if (tokenAfter?.value === ",") {
fixes.push(fixer.remove(tokenAfter));
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/colorPropsReplacedColors/colorProps-replaced-colors.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/colorPropsReplacedColors/colorProps-replaced-colors.test.ts
index 13fce2dd9..24a2c0755 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/colorPropsReplacedColors/colorProps-replaced-colors.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/colorPropsReplacedColors/colorProps-replaced-colors.test.ts
@@ -19,7 +19,6 @@ components.forEach((component) => {
)
);
- const type = "JSXOpeningElement";
invalidTests.push(
createInvalidTest(
`import { ${component} } from '@patternfly/react-core'; <${component} color="gold" />`,
@@ -27,7 +26,6 @@ components.forEach((component) => {
[
{
message: `The \`color\` prop on ${component} has been updated to replace "gold" with "yellow".`,
- type,
},
]
)
@@ -39,7 +37,6 @@ components.forEach((component) => {
[
{
message: `The \`color\` prop on ${component} has been updated to replace "cyan" with "teal".`,
- type,
},
]
)
@@ -51,7 +48,6 @@ components.forEach((component) => {
[
{
message: `The \`color\` prop on ${component} has been updated to replace "gold" with "yellow".`,
- type,
},
]
)
@@ -63,7 +59,6 @@ components.forEach((component) => {
[
{
message: `The \`color\` prop on CustomThing has been updated to replace "gold" with "yellow".`,
- type,
},
]
)
@@ -75,7 +70,6 @@ components.forEach((component) => {
[
{
message: `The \`color\` prop on ${component} has been updated to replace "cyan" with "teal".`,
- type,
},
]
)
@@ -87,7 +81,6 @@ components.forEach((component) => {
[
{
message: `The \`color\` prop on ${component} has been updated to replace "cyan" with "teal".`,
- type,
},
]
)
@@ -99,7 +92,6 @@ components.forEach((component) => {
[
{
message: `The \`color\` prop on ${component} has been updated to replace "cyan" with "teal".`,
- type,
},
]
)
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroups-logSnippetRenameLeftBorderVariant/componentGroups-logSnippet-rename-leftBorderVariant.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroups-logSnippetRenameLeftBorderVariant/componentGroups-logSnippet-rename-leftBorderVariant.test.ts
index 17f6f4138..bfb42bbec 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroups-logSnippetRenameLeftBorderVariant/componentGroups-logSnippet-rename-leftBorderVariant.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroups-logSnippetRenameLeftBorderVariant/componentGroups-logSnippet-rename-leftBorderVariant.test.ts
@@ -3,12 +3,10 @@ import * as rule from "./componentGroups-logSnippet-rename-leftBorderVariant";
const propError = {
message: `We've renamed leftBorderVariant prop to variant on LogSnippet component group.`,
- type: "JSXOpeningElement",
};
const enumError = {
message: `We've replaced LogSnippetBorderVariant enum with PatternFly's AlertVariant enum.`,
- type: "MemberExpression",
};
ruleTester.run("componentGroups-logSnippet-rename-leftBorderVariant", rule, {
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsContentHeaderRenameToPageHeader/component-groups-contentHeader-rename-to-pageHeader.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsContentHeaderRenameToPageHeader/component-groups-contentHeader-rename-to-pageHeader.test.ts
index bc251cfc9..a4b68b0c3 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsContentHeaderRenameToPageHeader/component-groups-contentHeader-rename-to-pageHeader.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsContentHeaderRenameToPageHeader/component-groups-contentHeader-rename-to-pageHeader.test.ts
@@ -4,7 +4,6 @@ import * as rule from "./component-groups-contentHeader-rename-to-pageHeader";
const errors = [
{
message: `ContentHeader has been renamed to PageHeader.`,
- type: "JSXOpeningElement",
},
];
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsErrorStateRenameProps/componentGroups-errorState-rename-props.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsErrorStateRenameProps/componentGroups-errorState-rename-props.test.ts
index ee0e013b5..e52a13e2e 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsErrorStateRenameProps/componentGroups-errorState-rename-props.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsErrorStateRenameProps/componentGroups-errorState-rename-props.test.ts
@@ -38,7 +38,6 @@ ruleTester.run("componentGroups-errorState-rename-props", rule, {
/>`,
errors: Object.entries(renameMap).map(([oldName, newName]) => ({
message: `The ${oldName} prop for ErrorState has been renamed to ${newName}.`,
- type: "JSXOpeningElement",
})),
},
{
@@ -49,7 +48,6 @@ ruleTester.run("componentGroups-errorState-rename-props", rule, {
errors: [
{
message: `The errorTitle prop for ErrorState has been renamed to titleText.`,
- type: "JSXOpeningElement",
},
],
},
@@ -61,7 +59,6 @@ ruleTester.run("componentGroups-errorState-rename-props", rule, {
errors: [
{
message: `The errorTitle prop for ErrorState has been renamed to titleText.`,
- type: "JSXOpeningElement",
},
],
},
@@ -73,7 +70,6 @@ ruleTester.run("componentGroups-errorState-rename-props", rule, {
errors: [
{
message: `The errorTitle prop for ErrorState has been renamed to titleText.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsInvalidObjectPropsRenameToMissingPageProps/component-groups-invalidObjectProps-rename-to-missingPageProps.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsInvalidObjectPropsRenameToMissingPageProps/component-groups-invalidObjectProps-rename-to-missingPageProps.test.ts
index 82306ac39..3165d8f1a 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsInvalidObjectPropsRenameToMissingPageProps/component-groups-invalidObjectProps-rename-to-missingPageProps.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsInvalidObjectPropsRenameToMissingPageProps/component-groups-invalidObjectProps-rename-to-missingPageProps.test.ts
@@ -35,19 +35,15 @@ ruleTester.run(
errors: [
{
message,
- type: "Identifier",
},
{
message,
- type: "Identifier",
},
{
message,
- type: "Identifier",
},
{
message,
- type: "Identifier",
},
],
},
@@ -60,7 +56,6 @@ ruleTester.run(
errors: [
{
message,
- type: "Identifier",
},
],
},
@@ -71,11 +66,9 @@ ruleTester.run(
errors: [
{
message: componentMessage,
- type: "ImportDeclaration",
},
{
message,
- type: "Identifier",
},
],
},
@@ -85,11 +78,9 @@ ruleTester.run(
errors: [
{
message: componentMessage,
- type: "ImportDeclaration",
},
{
message,
- type: "Identifier",
},
],
},
@@ -99,11 +90,9 @@ ruleTester.run(
errors: [
{
message: componentMessage,
- type: "ImportDeclaration",
},
{
message,
- type: "Identifier",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsInvalidObjectRenameProps/component-groups-invalidObject-rename-props.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsInvalidObjectRenameProps/component-groups-invalidObject-rename-props.test.ts
index 7697a4891..52cb29e02 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsInvalidObjectRenameProps/component-groups-invalidObject-rename-props.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsInvalidObjectRenameProps/component-groups-invalidObject-rename-props.test.ts
@@ -9,7 +9,6 @@ const renameMap = {
const getErrors = (component: string) =>
Object.entries(renameMap).map(([oldName, newName]) => ({
message: `The ${oldName} prop for ${component} has been renamed to ${newName}.`,
- type: "JSXOpeningElement",
}));
const components = ["InvalidObject", "MissingPage"];
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsInvalidObjectRenameToMissingPage/component-groups-invalidObject-rename-to-missingPage.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsInvalidObjectRenameToMissingPage/component-groups-invalidObject-rename-to-missingPage.test.ts
index c3179d6fc..c31422ef9 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsInvalidObjectRenameToMissingPage/component-groups-invalidObject-rename-to-missingPage.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsInvalidObjectRenameToMissingPage/component-groups-invalidObject-rename-to-missingPage.test.ts
@@ -4,7 +4,6 @@ import * as rule from "./component-groups-invalidObject-rename-to-missingPage";
const errors = [
{
message: `InvalidObject has been renamed to MissingPage.`,
- type: "JSXOpeningElement",
},
];
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsMultiContentCardRemoveProps/component-groups-multi-content-card-remove-props.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsMultiContentCardRemoveProps/component-groups-multi-content-card-remove-props.test.ts
index 46872cc95..8a3abf98a 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsMultiContentCardRemoveProps/component-groups-multi-content-card-remove-props.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsMultiContentCardRemoveProps/component-groups-multi-content-card-remove-props.test.ts
@@ -3,7 +3,6 @@ import * as rule from "./component-groups-multi-content-card-remove-props";
const errors = ["leftBorderVariant", "withHeaderBorder"].map((prop) => ({
message: `The ${prop} prop for MultiContentCard has been removed.`,
- type: "JSXOpeningElement",
}));
ruleTester.run("component-groups-multi-content-card-remove-props", rule, {
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsNotAuthorizedRenameProps/component-groups-notAuthorized-rename-props.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsNotAuthorizedRenameProps/component-groups-notAuthorized-rename-props.test.ts
index 121eaf076..eeb8cb098 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsNotAuthorizedRenameProps/component-groups-notAuthorized-rename-props.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsNotAuthorizedRenameProps/component-groups-notAuthorized-rename-props.test.ts
@@ -9,7 +9,6 @@ const renameMap = {
const getErrors = (component: string) =>
Object.entries(renameMap).map(([oldName, newName]) => ({
message: `The ${oldName} prop for ${component} has been renamed to ${newName}.`,
- type: "JSXOpeningElement",
}));
const components = ["NotAuthorized", "UnauthorizedAccess"];
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsNotAuthorizedRenameToUnauthorizedAccess/component-groups-notAuthorized-rename-to-unauthorizedAccess.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsNotAuthorizedRenameToUnauthorizedAccess/component-groups-notAuthorized-rename-to-unauthorizedAccess.test.ts
index 4d7de0056..24893b607 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsNotAuthorizedRenameToUnauthorizedAccess/component-groups-notAuthorized-rename-to-unauthorizedAccess.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsNotAuthorizedRenameToUnauthorizedAccess/component-groups-notAuthorized-rename-to-unauthorizedAccess.test.ts
@@ -4,7 +4,6 @@ import * as rule from "./component-groups-notAuthorized-rename-to-unauthorizedAc
const errors = [
{
message: `NotAuthorized has been renamed to UnauthorizedAccess.`,
- type: "JSXOpeningElement",
},
];
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsUnavailableContentBodyTextPropsUpdate/component-groups-unavailableContent-bodyText-props-update.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsUnavailableContentBodyTextPropsUpdate/component-groups-unavailableContent-bodyText-props-update.test.ts
index 67751f029..f82c62965 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsUnavailableContentBodyTextPropsUpdate/component-groups-unavailableContent-bodyText-props-update.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsUnavailableContentBodyTextPropsUpdate/component-groups-unavailableContent-bodyText-props-update.test.ts
@@ -40,7 +40,6 @@ ruleTester.run("componentGroupsUnavailableContentBodyTextPropsUpdate", rule, {
errors: [
{
message: renameMessage,
- type: "JSXOpeningElement",
},
],
},
@@ -53,7 +52,6 @@ ruleTester.run("componentGroupsUnavailableContentBodyTextPropsUpdate", rule, {
errors: [
{
message: renameMessage,
- type: "JSXOpeningElement",
},
],
},
@@ -66,7 +64,6 @@ ruleTester.run("componentGroupsUnavailableContentBodyTextPropsUpdate", rule, {
errors: [
{
message: renameMessage,
- type: "JSXOpeningElement",
},
],
},
@@ -79,7 +76,6 @@ ruleTester.run("componentGroupsUnavailableContentBodyTextPropsUpdate", rule, {
errors: [
{
message: statusPageMessage,
- type: "JSXOpeningElement",
},
],
},
@@ -94,7 +90,6 @@ ruleTester.run("componentGroupsUnavailableContentBodyTextPropsUpdate", rule, {
errors: [
{
message: statusPageMessage,
- type: "JSXOpeningElement",
},
],
},
@@ -115,11 +110,9 @@ ruleTester.run("componentGroupsUnavailableContentBodyTextPropsUpdate", rule, {
errors: [
{
message: statusPageMessage,
- type: "JSXOpeningElement",
},
{
message: renameMessage,
- type: "JSXOpeningElement",
},
],
},
@@ -132,7 +125,6 @@ ruleTester.run("componentGroupsUnavailableContentBodyTextPropsUpdate", rule, {
errors: [
{
message: statusPageMessage,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsUnavailableContentRenameProps/component-groups-unavailable-content-rename-props.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsUnavailableContentRenameProps/component-groups-unavailable-content-rename-props.test.ts
index 94926dec1..1c589ef24 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsUnavailableContentRenameProps/component-groups-unavailable-content-rename-props.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/componentGroupsUnavailableContentRenameProps/component-groups-unavailable-content-rename-props.test.ts
@@ -5,7 +5,6 @@ const errors = [
{
message:
"The unavailableTitleText prop for UnavailableContent has been renamed to titleText.",
- type: "JSXOpeningElement",
},
];
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/dataCodemodsCleanup/data-codemods-cleanup.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/dataCodemodsCleanup/data-codemods-cleanup.test.ts
index 703a163c7..bed337112 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/dataCodemodsCleanup/data-codemods-cleanup.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/dataCodemodsCleanup/data-codemods-cleanup.test.ts
@@ -19,7 +19,6 @@ ruleTester.run("data-codemods-cleanup", rule, {
errors: [
{
message,
- type: "ImportSpecifier",
},
],
},
@@ -30,7 +29,6 @@ ruleTester.run("data-codemods-cleanup", rule, {
errors: [
{
message,
- type: "ImportSpecifier",
},
],
},
@@ -40,7 +38,6 @@ ruleTester.run("data-codemods-cleanup", rule, {
errors: [
{
message,
- type: "JSXOpeningElement",
},
],
},
@@ -50,7 +47,6 @@ ruleTester.run("data-codemods-cleanup", rule, {
errors: [
{
message,
- type: "JSXOpeningElement",
},
],
},
@@ -61,7 +57,6 @@ ruleTester.run("data-codemods-cleanup", rule, {
errors: [
{
message,
- type: "JSXOpeningElement",
},
],
},
@@ -71,7 +66,6 @@ ruleTester.run("data-codemods-cleanup", rule, {
errors: [
{
message,
- type: "JSXOpeningElement",
},
],
},
@@ -82,7 +76,6 @@ ruleTester.run("data-codemods-cleanup", rule, {
errors: [
{
message,
- type: "JSXOpeningElement",
},
],
},
@@ -93,7 +86,6 @@ ruleTester.run("data-codemods-cleanup", rule, {
errors: [
{
message,
- type: "ImportSpecifier",
},
],
},
@@ -104,7 +96,6 @@ ruleTester.run("data-codemods-cleanup", rule, {
errors: [
{
message,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/dataCodemodsCleanup/data-codemods-cleanup.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/dataCodemodsCleanup/data-codemods-cleanup.ts
index c89e36844..f4f9cb27e 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/dataCodemodsCleanup/data-codemods-cleanup.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/dataCodemodsCleanup/data-codemods-cleanup.ts
@@ -54,7 +54,7 @@ module.exports = {
},
ImportSpecifier(node: ImportSpecifier) {
if (imports.some((specifier) => specifier === node)) {
- const comments = context.getSourceCode().getCommentsAfter(node);
+ const comments = context.sourceCode.getCommentsAfter(node);
const dataCodemodsComment = comments.find((comment) =>
comment.value.includes("data-codemods")
);
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListAction-remove-isPlainButtonAction-prop.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListAction-remove-isPlainButtonAction-prop.test.ts
index 94434b8b0..1f28ebb3d 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListAction-remove-isPlainButtonAction-prop.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/dataListActionRemoveIsPlainButtonActionProp/dataListAction-remove-isPlainButtonAction-prop.test.ts
@@ -17,7 +17,6 @@ ruleTester.run("dataListAction-remove-isPlainButtonAction-prop", rule, {
errors: [
{
message: `The \`isPlainButtonAction\` prop has been removed from DataListAction as a wrapper is no longer needed.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/dragDropDeprecated/dragDrop-deprecated.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/dragDropDeprecated/dragDrop-deprecated.test.ts
index 8094fd647..a2bf19678 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/dragDropDeprecated/dragDrop-deprecated.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/dragDropDeprecated/dragDrop-deprecated.test.ts
@@ -39,7 +39,6 @@ ruleTester.run('dragDrop-deprecated', rule, {
errors: [
{
message: `DragDrop, Droppable, and Draggable have been deprecated. Running the fix flag will update your imports to our deprecated package, but we suggest using our new drag and drop implementation (DragDropSort component), that lives in '@patternfly/react-drag-drop' package.`,
- type: 'ImportDeclaration',
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerContentReplaceNoBackgroundColorVariant/drawerContent-replace-noBackground-colorVariant.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerContentReplaceNoBackgroundColorVariant/drawerContent-replace-noBackground-colorVariant.test.ts
index d69cd8776..ae0985a05 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerContentReplaceNoBackgroundColorVariant/drawerContent-replace-noBackground-colorVariant.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerContentReplaceNoBackgroundColorVariant/drawerContent-replace-noBackground-colorVariant.test.ts
@@ -29,7 +29,6 @@ ruleTester.run("drawerContent-replace-noBackground-colorVariant", rule, {
errors: [
{
message: `The "no-background" value of the \`colorVariant\` prop on DrawerContent has been removed.`,
- type: "JSXOpeningElement",
},
],
},
@@ -39,7 +38,6 @@ ruleTester.run("drawerContent-replace-noBackground-colorVariant", rule, {
errors: [
{
message: `The "no-background" value of the \`colorVariant\` prop on DrawerContent has been removed.`,
- type: "JSXOpeningElement",
},
],
},
@@ -49,7 +47,6 @@ ruleTester.run("drawerContent-replace-noBackground-colorVariant", rule, {
errors: [
{
message: `The "no-background" value of the \`colorVariant\` prop on DrawerContent has been removed.`,
- type: "JSXOpeningElement",
},
],
},
@@ -59,7 +56,6 @@ ruleTester.run("drawerContent-replace-noBackground-colorVariant", rule, {
errors: [
{
message: `The DrawerContentColorVariant enum should be used instead of the DrawerColorVariant enum when passed to the DrawerContent component. This fix will replace the colorVariant prop value with a string.`,
- type: "JSXOpeningElement",
},
],
},
@@ -69,7 +65,6 @@ ruleTester.run("drawerContent-replace-noBackground-colorVariant", rule, {
errors: [
{
message: `The "no-background" value of the \`colorVariant\` prop on DrawerContent has been removed.`,
- type: "JSXOpeningElement",
},
],
},
@@ -79,7 +74,6 @@ ruleTester.run("drawerContent-replace-noBackground-colorVariant", rule, {
errors: [
{
message: `The DrawerContentColorVariant enum should be used instead of the DrawerColorVariant enum when passed to the DrawerContent component. This fix will replace the colorVariant prop value with a string.`,
- type: "JSXOpeningElement",
},
],
},
@@ -89,7 +83,6 @@ ruleTester.run("drawerContent-replace-noBackground-colorVariant", rule, {
errors: [
{
message: `The "no-background" value of the \`colorVariant\` prop on DrawerContent has been removed.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerContentReplaceNoBackgroundColorVariant/drawerContent-replace-noBackground-colorVariant.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerContentReplaceNoBackgroundColorVariant/drawerContent-replace-noBackground-colorVariant.ts
index 9b830c274..87bfb3b91 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerContentReplaceNoBackgroundColorVariant/drawerContent-replace-noBackground-colorVariant.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerContentReplaceNoBackgroundColorVariant/drawerContent-replace-noBackground-colorVariant.ts
@@ -54,7 +54,7 @@ module.exports = {
drawerColorVariantEnumImport &&
colorVariantValueEnum &&
colorVariantValueEnum.object &&
- context.getSourceCode().getText(colorVariantValueEnum.object) ===
+ context.sourceCode.getText(colorVariantValueEnum.object) ===
drawerColorVariantEnumImport.local.name;
const isNoBackgroundEnum =
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerHeadRemoveHasNoPaddingProp/drawerHead-remove-hasNoPadding-prop.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerHeadRemoveHasNoPaddingProp/drawerHead-remove-hasNoPadding-prop.test.ts
index ae44da474..5d58de3ee 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerHeadRemoveHasNoPaddingProp/drawerHead-remove-hasNoPadding-prop.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerHeadRemoveHasNoPaddingProp/drawerHead-remove-hasNoPadding-prop.test.ts
@@ -17,7 +17,6 @@ ruleTester.run("drawerHead-remove-hasNoPadding-prop", rule, {
errors: [
{
message: `The \`hasNoPadding\` prop has been removed from DrawerHead.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerHeadWarnUpdatedMarkup/drawerHead-warn-updated-markup.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerHeadWarnUpdatedMarkup/drawerHead-warn-updated-markup.test.ts
index 7e9196ef9..ff73ce651 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerHeadWarnUpdatedMarkup/drawerHead-warn-updated-markup.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerHeadWarnUpdatedMarkup/drawerHead-warn-updated-markup.test.ts
@@ -10,11 +10,10 @@ ruleTester.run("drawerHead-warn-updated-markup", rule, {
invalid: [
{
code: `import { DrawerHead } from '@patternfly/react-core'; `,
- output: `import { DrawerHead } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `DrawerPanelBody is no longer rendered internally to DrawerHead. We recommend using these components independent of one another and to not pass DrawerPanelBody to DrawerHead.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerReplaceColorVariantLight200/drawer-replace-colorVariant-light200.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerReplaceColorVariantLight200/drawer-replace-colorVariant-light200.test.ts
index 13d937ecd..398d3ccd3 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerReplaceColorVariantLight200/drawer-replace-colorVariant-light200.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/drawerReplaceColorVariantLight200/drawer-replace-colorVariant-light200.test.ts
@@ -10,7 +10,7 @@ const validTests: { code: string }[] = [];
const invalidTests: {
code: string;
output: string;
- errors: { message: string; type: string }[];
+ errors: { message: string }[];
}[] = [];
affectedDrawerComponents.forEach((component) => {
validTests.push({
@@ -32,7 +32,6 @@ affectedDrawerComponents.forEach((component) => {
errors: [
{
message: `The "light-200" value for the \`colorVariant\` prop has been replaced with the "secondary" value for ${component}.`,
- type: "JSXOpeningElement",
},
],
});
@@ -40,9 +39,6 @@ affectedDrawerComponents.forEach((component) => {
ruleTester.run("drawer-replace-colorVariant-light200", rule, {
valid: [
- {
- code: ``,
- },
{
code: `import { DrawerColorVariant } from '@patternfly/react-core'; `,
},
@@ -56,7 +52,6 @@ ruleTester.run("drawer-replace-colorVariant-light200", rule, {
{
message:
"The `light200` property for the DrawerColorVariant enum has been replaced with the `secondary` property.",
- type: "MemberExpression",
},
],
},
@@ -68,7 +63,6 @@ ruleTester.run("drawer-replace-colorVariant-light200", rule, {
{
message:
"The `light200` property for the DrawerColorVariant enum has been replaced with the `secondary` property.",
- type: "MemberExpression",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/dualListSelectorDeprecated/dualListSelector-deprecated.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/dualListSelectorDeprecated/dualListSelector-deprecated.test.ts
index 36a97f56d..77dbdbfc8 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/dualListSelectorDeprecated/dualListSelector-deprecated.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/dualListSelectorDeprecated/dualListSelector-deprecated.test.ts
@@ -49,63 +49,63 @@ specifiersToMove.forEach((specifier) => {
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core';`,
`import {\n\t${specifier}\n} from '@patternfly/react-core/deprecated';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} as CustomSpecifier } from '@patternfly/react-core';`,
`import {\n\t${specifier} as CustomSpecifier\n} from '@patternfly/react-core/deprecated';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core/dist/esm/components/Modal/index.js';`,
`import {\n\t${specifier}\n} from '@patternfly/react-core/dist/esm/deprecated/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core/dist/js/components/Modal/index.js';`,
`import {\n\t${specifier}\n} from '@patternfly/react-core/dist/js/deprecated/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core/dist/dynamic/components/Modal/index.js';`,
`import {\n\t${specifier}\n} from '@patternfly/react-core/dist/dynamic/deprecated/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`export { ${specifier} } from '@patternfly/react-core';`,
`export {\n\t${specifier}\n} from '@patternfly/react-core/deprecated';`,
- [{ message: errorMessage, type: "ExportNamedDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`export { ${specifier} } from '@patternfly/react-core/dist/esm/components/Modal/index.js';`,
`export {\n\t${specifier}\n} from '@patternfly/react-core/dist/esm/deprecated/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ExportNamedDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`export { ${specifier} } from '@patternfly/react-core/dist/js/components/Modal/index.js';`,
`export {\n\t${specifier}\n} from '@patternfly/react-core/dist/js/deprecated/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ExportNamedDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`export { ${specifier} } from '@patternfly/react-core/dist/dynamic/components/Modal/index.js';`,
`export {\n\t${specifier}\n} from '@patternfly/react-core/dist/dynamic/deprecated/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ExportNamedDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
@@ -113,7 +113,7 @@ specifiersToMove.forEach((specifier) => {
`import { ${specifier}, Button } from '@patternfly/react-core';`,
`import {\n\tButton\n} from '@patternfly/react-core';
import {\n\t${specifier}\n} from '@patternfly/react-core/deprecated';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
});
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/dualListSelectorNextPromoted/dualListSelectorNext-promoted.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/dualListSelectorNextPromoted/dualListSelectorNext-promoted.test.ts
index 824bf32f5..7a7c105df 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/dualListSelectorNextPromoted/dualListSelectorNext-promoted.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/dualListSelectorNextPromoted/dualListSelectorNext-promoted.test.ts
@@ -44,70 +44,70 @@ specifiersToMove.forEach((specifier) => {
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core/next';`,
`import {\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} as CustomSpecifier } from '@patternfly/react-core/next';`,
`import {\n\t${specifier} as CustomSpecifier /* data-codemods */\n} from '@patternfly/react-core';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core/dist/esm/next/components/Modal/index.js';`,
`import {\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core/dist/esm/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core/dist/js/next/components/Modal/index.js';`,
`import {\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core/dist/js/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core/dist/dynamic/next/components/Modal/index.js';`,
`import {\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core/dist/dynamic/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`export { ${specifier} } from '@patternfly/react-core/next';`,
`export {\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core';`,
- [{ message: errorMessage, type: "ExportNamedDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`export { ${specifier} } from '@patternfly/react-core/dist/esm/next/components/Modal/index.js';`,
`export {\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core/dist/esm/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ExportNamedDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`export { ${specifier} } from '@patternfly/react-core/dist/js/next/components/Modal/index.js';`,
`export {\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core/dist/js/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ExportNamedDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`export { ${specifier} } from '@patternfly/react-core/dist/dynamic/next/components/Modal/index.js';`,
`export {\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core/dist/dynamic/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ExportNamedDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core/next';\nimport { Button } from '@patternfly/react-core';`,
`\nimport {\n\tButton,\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
});
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateHeaderMoveIntoEmptyState/emptyStateHeader-move-into-emptyState.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateHeaderMoveIntoEmptyState/emptyStateHeader-move-into-emptyState.test.ts
index 5f18c4910..7d69e7125 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateHeaderMoveIntoEmptyState/emptyStateHeader-move-into-emptyState.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateHeaderMoveIntoEmptyState/emptyStateHeader-move-into-emptyState.test.ts
@@ -57,7 +57,6 @@ ruleTester.run("emptyStateHeader-move-into-emptyState", rule, {
errors: [
{
message: `EmptyStateHeader has been moved inside of the EmptyState component and is now only customizable using props. Additionally, the EmptyStateIcon component now wraps content passed to the icon prop automatically.`,
- type: "JSXElement",
},
],
},
@@ -87,7 +86,6 @@ ruleTester.run("emptyStateHeader-move-into-emptyState", rule, {
errors: [
{
message: `EmptyStateHeader has been moved inside of the EmptyState component and is now only customizable using props.`,
- type: "JSXElement",
},
],
},
@@ -117,7 +115,6 @@ ruleTester.run("emptyStateHeader-move-into-emptyState", rule, {
errors: [
{
message: `EmptyStateHeader has been moved inside of the EmptyState component and is now only customizable using props.`,
- type: "JSXElement",
},
],
},
@@ -147,7 +144,6 @@ ruleTester.run("emptyStateHeader-move-into-emptyState", rule, {
errors: [
{
message: `EmptyStateHeader has been moved inside of the EmptyState component and is now only customizable using props.`,
- type: "JSXElement",
},
],
},
@@ -179,7 +175,6 @@ ruleTester.run("emptyStateHeader-move-into-emptyState", rule, {
errors: [
{
message: `EmptyStateHeader has been moved inside of the EmptyState component and is now only customizable using props.`,
- type: "JSXElement",
},
],
},
@@ -215,7 +210,6 @@ ruleTester.run("emptyStateHeader-move-into-emptyState", rule, {
errors: [
{
message: `EmptyStateHeader has been moved inside of the EmptyState component and is now only customizable using props.`,
- type: "JSXElement",
},
],
},
@@ -253,7 +247,6 @@ ruleTester.run("emptyStateHeader-move-into-emptyState", rule, {
errors: [
{
message: `EmptyStateHeader has been moved inside of the EmptyState component and is now only customizable using props.`,
- type: "JSXElement",
},
],
},
@@ -263,28 +256,17 @@ ruleTester.run("emptyStateHeader-move-into-emptyState", rule, {
EmptyState,
EmptyStateHeader,
} from "@patternfly/react-core";
-
- export const EmptyStateHeaderMoveIntoEmptyStateInput = () => (
-
- Foo
-
- );
- `,
- output: `import {
- EmptyState,
- EmptyStateHeader,
- } from "@patternfly/react-core";
-
+
export const EmptyStateHeaderMoveIntoEmptyStateInput = () => (
Foo
);
`,
+ output: null,
errors: [
{
message: `EmptyStateHeader has been moved inside of the EmptyState component and is now only customizable using props. Because the children for EmptyStateHeader are now inaccessible you must remove either the children or the titleText prop, then you can rerun this codemod.`,
- type: "JSXElement",
},
],
},
@@ -318,11 +300,9 @@ ruleTester.run("emptyStateHeader-move-into-emptyState", rule, {
errors: [
{
message: `The color prop on EmptyStateIcon has been removed. We suggest using the new status prop on EmptyState to apply colors to the icon.`,
- type: "JSXElement",
},
{
message: `EmptyStateHeader has been moved inside of the EmptyState component and is now only customizable using props. Additionally, the EmptyStateIcon component now wraps content passed to the icon prop automatically.`,
- type: "JSXElement",
},
],
},
@@ -352,7 +332,6 @@ ruleTester.run("emptyStateHeader-move-into-emptyState", rule, {
errors: [
{
message: `EmptyStateHeader has been moved inside of the EmptyState component and is now only customizable using props.`,
- type: "JSXElement",
},
],
},
@@ -389,7 +368,6 @@ ruleTester.run("emptyStateHeader-move-into-emptyState", rule, {
errors: [
{
message: `EmptyStateHeader has been moved inside of the EmptyState component and is now only customizable using props. Additionally, the EmptyStateIcon component now wraps content passed to the icon prop automatically.`,
- type: "JSXElement",
},
],
},
@@ -426,7 +404,6 @@ ruleTester.run("emptyStateHeader-move-into-emptyState", rule, {
errors: [
{
message: `EmptyStateHeader has been moved inside of the EmptyState component and is now only customizable using props. Additionally, the EmptyStateIcon component now wraps content passed to the icon prop automatically.`,
- type: "JSXElement",
},
],
},
@@ -468,7 +445,6 @@ ruleTester.run("emptyStateHeader-move-into-emptyState", rule, {
errors: [
{
message: `EmptyStateHeader has been moved inside of the EmptyState component and is now only customizable using props.`,
- type: "JSXElement",
},
],
},
@@ -515,11 +491,9 @@ ruleTester.run("emptyStateHeader-move-into-emptyState", rule, {
errors: [
{
message: `The color prop on EmptyStateIcon has been removed. We suggest using the new status prop on EmptyState to apply colors to the icon.`,
- type: "JSXElement",
},
{
message: `EmptyStateHeader has been moved inside of the EmptyState component and is now only customizable using props. Additionally, the EmptyStateIcon component now wraps content passed to the icon prop automatically.`,
- type: "JSXElement",
},
],
},
@@ -562,11 +536,9 @@ ruleTester.run("emptyStateHeader-move-into-emptyState", rule, {
errors: [
{
message: `The color prop on EmptyStateIcon has been removed. We suggest using the new status prop on EmptyState to apply colors to the icon.`,
- type: "JSXElement",
},
{
message: `EmptyStateHeader has been moved inside of the EmptyState component and is now only customizable using props. Additionally, the EmptyStateIcon component now wraps content passed to the icon prop automatically.`,
- type: "JSXElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateHeaderMoveIntoEmptyState/emptyStateHeader-move-into-emptyState.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateHeaderMoveIntoEmptyState/emptyStateHeader-move-into-emptyState.ts
index de091b73f..b53b467a8 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateHeaderMoveIntoEmptyState/emptyStateHeader-move-into-emptyState.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateHeaderMoveIntoEmptyState/emptyStateHeader-move-into-emptyState.ts
@@ -85,7 +85,7 @@ const getIconPropText = (
) => {
if (emptyStateIconComponentIconAttribute) {
return context
- .getSourceCode()
+ .sourceCode
.getText(emptyStateIconComponentIconAttribute);
}
@@ -127,7 +127,7 @@ const getIcon = (
module.exports = {
meta: { fixable: "code" },
create: function (context: Rule.RuleContext) {
- const source = context.getSourceCode();
+ const source = context.sourceCode;
const pkg = "@patternfly/react-core";
const { imports } = getFromPackage(context, pkg);
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateNonExportedComponents/emptyState-nonExported-components.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateNonExportedComponents/emptyState-nonExported-components.test.ts
index e7c114f94..efc00695d 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateNonExportedComponents/emptyState-nonExported-components.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateNonExportedComponents/emptyState-nonExported-components.test.ts
@@ -13,21 +13,19 @@ ruleTester.run("emptyState-nonExported-components", rule, {
invalid: [
{
code: `import { EmptyStateHeader } from '@patternfly/react-core';`,
- output: `import { EmptyStateHeader } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `EmptyStateHeader is no longer exported by PatternFly. This rule will not fix any imports, as our cleanup rule handles removal of unused imports.`,
- type: "ImportSpecifier",
},
],
},
{
code: `import { EmptyStateHeader as CustomHeader } from '@patternfly/react-core';`,
- output: `import { EmptyStateHeader as CustomHeader } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `EmptyStateHeader is no longer exported by PatternFly. This rule will not fix any imports, as our cleanup rule handles removal of unused imports.`,
- type: "ImportSpecifier",
},
],
},
@@ -37,7 +35,6 @@ ruleTester.run("emptyState-nonExported-components", rule, {
errors: [
{
message: `EmptyStateHeader is no longer exported by PatternFly.`,
- type: "ExportNamedDeclaration",
},
],
},
@@ -47,7 +44,6 @@ ruleTester.run("emptyState-nonExported-components", rule, {
errors: [
{
message: `EmptyStateHeader is no longer exported by PatternFly.`,
- type: "ExportNamedDeclaration",
},
],
},
@@ -57,7 +53,6 @@ ruleTester.run("emptyState-nonExported-components", rule, {
errors: [
{
message: `EmptyStateHeader and EmptyStateIcon are no longer exported by PatternFly.`,
- type: "ExportNamedDeclaration",
},
],
},
@@ -67,11 +62,9 @@ ruleTester.run("emptyState-nonExported-components", rule, {
errors: [
{
message: `EmptyStateHeader is no longer exported by PatternFly.`,
- type: "ExportNamedDeclaration",
},
{
message: `EmptyStateIcon is no longer exported by PatternFly.`,
- type: "ExportNamedDeclaration",
},
],
},
@@ -81,11 +74,9 @@ ruleTester.run("emptyState-nonExported-components", rule, {
errors: [
{
message: `EmptyStateHeader is no longer exported by PatternFly. This rule will not fix any imports, as our cleanup rule handles removal of unused imports.`,
- type: "ImportSpecifier",
},
{
message: `EmptyStateHeader is no longer exported by PatternFly.`,
- type: "ExportNamedDeclaration",
},
],
},
@@ -95,11 +86,9 @@ ruleTester.run("emptyState-nonExported-components", rule, {
errors: [
{
message: `EmptyStateHeader is no longer exported by PatternFly. This rule will not fix any imports, as our cleanup rule handles removal of unused imports.`,
- type: "ImportSpecifier",
},
{
message: `CustomHeader is no longer exported by PatternFly.`,
- type: "ExportNamedDeclaration",
},
],
},
@@ -109,11 +98,9 @@ ruleTester.run("emptyState-nonExported-components", rule, {
errors: [
{
message: `EmptyStateHeader is no longer exported by PatternFly. This rule will not fix any imports, as our cleanup rule handles removal of unused imports.`,
- type: "ImportSpecifier",
},
{
message: `EmptyStateHeader is no longer exported by PatternFly.`,
- type: "ExportNamedDeclaration",
},
],
},
@@ -123,11 +110,9 @@ ruleTester.run("emptyState-nonExported-components", rule, {
errors: [
{
message: `EmptyStateHeader is no longer exported by PatternFly. This rule will not fix any imports, as our cleanup rule handles removal of unused imports.`,
- type: "ImportSpecifier",
},
{
message: `EmptyStateHeader is no longer exported by PatternFly.`,
- type: "ExportDefaultDeclaration",
},
],
},
@@ -137,36 +122,19 @@ ruleTester.run("emptyState-nonExported-components", rule, {
errors: [
{
message: `EmptyStateHeader is no longer exported by PatternFly. This rule will not fix any imports, as our cleanup rule handles removal of unused imports.`,
- type: "ImportSpecifier",
},
{
message: `CustomHeader is no longer exported by PatternFly.`,
- type: "ExportDefaultDeclaration",
},
],
},
// We want to ensure the rule only gets thrown for the applicable components
{
code: `import { EmptyStateHeader, SomeOtherThing } from '@patternfly/react-core';`,
- output: `import { EmptyStateHeader, SomeOtherThing } from '@patternfly/react-core';`,
- errors: [
- {
- message: `EmptyStateHeader is no longer exported by PatternFly. This rule will not fix any imports, as our cleanup rule handles removal of unused imports.`,
- type: "ImportSpecifier",
- },
- ],
- },
- {
- code: `import { EmptyStateHeader } from '@patternfly/react-core';export default EmptyStateHeader;`,
- output: `import { EmptyStateHeader } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `EmptyStateHeader is no longer exported by PatternFly. This rule will not fix any imports, as our cleanup rule handles removal of unused imports.`,
- type: "ImportSpecifier",
- },
- {
- message: `EmptyStateHeader is no longer exported by PatternFly.`,
- type: "ExportDefaultDeclaration",
},
],
},
@@ -176,11 +144,9 @@ ruleTester.run("emptyState-nonExported-components", rule, {
errors: [
{
message: `EmptyStateHeader is no longer exported by PatternFly. This rule will not fix any imports, as our cleanup rule handles removal of unused imports.`,
- type: "ImportSpecifier",
},
{
message: `EmptyStateHeader is no longer exported by PatternFly.`,
- type: "ExportNamedDeclaration",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateNonExportedComponents/emptyState-nonExported-components.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateNonExportedComponents/emptyState-nonExported-components.ts
index a49ee15d9..c49cb6f0f 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateNonExportedComponents/emptyState-nonExported-components.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/emptyStateNonExportedComponents/emptyState-nonExported-components.ts
@@ -75,11 +75,11 @@ module.exports = {
exportsToRemove.forEach((exportToRemove) => {
const { range } = exportToRemove;
const tokenBefore = context
- .getSourceCode()
+ .sourceCode
.getTokenBefore(exportToRemove);
const isCommaBefore = tokenBefore?.value === ",";
const tokenAfter = context
- .getSourceCode()
+ .sourceCode
.getTokenAfter(exportToRemove);
const isCommaAfter = tokenAfter?.value === ",";
const rangeStartValue = isCommaBefore
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/enableAnimations/enable-animations.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/enableAnimations/enable-animations.test.ts
index 43a465ed6..06f80f774 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/enableAnimations/enable-animations.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/enableAnimations/enable-animations.test.ts
@@ -21,11 +21,10 @@ const invalid = [
// --- Without includeTable (default) ---
{
code: "import { Table } from '@patternfly/react-table'; ",
- output: "import { Table } from '@patternfly/react-table'; ",
+ output: null,
errors: [
{
message: "Consider adding hasAnimations prop to enable component animations.",
- type: "JSXOpeningElement"
}
]
},
@@ -36,7 +35,6 @@ const invalid = [
errors: [
{
message: "Consider adding hasAnimations prop to enable component animations.",
- type: "JSXOpeningElement"
}
],
options: [{ includeTable: true }]
@@ -48,7 +46,6 @@ const invalid = [
errors: [
{
message: "Consider adding hasAnimations prop to enable component animations.",
- type: "JSXOpeningElement"
}
]
},
@@ -58,7 +55,6 @@ const invalid = [
errors: [
{
message: "Consider adding hasAnimations prop to enable component animations.",
- type: "JSXOpeningElement"
}
]
},
@@ -68,7 +64,6 @@ const invalid = [
errors: [
{
message: "Consider adding hasAnimations prop to enable component animations.",
- type: "JSXOpeningElement"
}
]
},
@@ -78,7 +73,6 @@ const invalid = [
errors: [
{
message: "Consider adding hasAnimations prop to enable component animations.",
- type: "JSXOpeningElement"
}
]
},
@@ -88,7 +82,6 @@ const invalid = [
errors: [
{
message: "Consider adding hasAnimations prop to enable component animations.",
- type: "JSXOpeningElement"
}
]
},
@@ -98,7 +91,6 @@ const invalid = [
errors: [
{
message: "Consider adding hasAnimations prop to enable component animations.",
- type: "JSXOpeningElement"
}
]
},
@@ -110,11 +102,9 @@ const invalid = [
errors: [
{
message: "Consider adding hasAnimations prop to enable component animations.",
- type: "JSXOpeningElement"
},
{
message: "Consider adding hasAnimations prop to enable component animations.",
- type: "JSXOpeningElement"
}
]
},
@@ -124,7 +114,6 @@ const invalid = [
errors: [
{
message: "Consider adding hasAnimations prop to enable component animations.",
- type: "JSXOpeningElement"
}
]
}
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/enableAnimations/enable-animations.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/enableAnimations/enable-animations.ts
index b473702a8..88cc9e18c 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/enableAnimations/enable-animations.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/enableAnimations/enable-animations.ts
@@ -5,7 +5,18 @@ import { getAttribute, getAttributeValue } from "../../helpers/JSXAttributes";
// Rule to add hasAnimations prop to components that support animations
module.exports = {
- meta: { fixable: "code" },
+ meta: {
+ fixable: "code",
+ schema: [
+ {
+ type: "object",
+ properties: {
+ includeTable: { type: "boolean" },
+ },
+ additionalProperties: false,
+ },
+ ],
+ },
create: function (context: Rule.RuleContext) {
// Get options from context (set by CLI)
const includeTable =
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/expandableSectionRemoveIsActiveProp/expandableSection-remove-isActive-prop.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/expandableSectionRemoveIsActiveProp/expandableSection-remove-isActive-prop.test.ts
index 4b46541ae..db2f1411b 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/expandableSectionRemoveIsActiveProp/expandableSection-remove-isActive-prop.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/expandableSectionRemoveIsActiveProp/expandableSection-remove-isActive-prop.test.ts
@@ -18,7 +18,6 @@ ruleTester.run("expandableSection-remove-isActive-prop", rule, {
errors: [
{
message: `The \`isActive\` prop has been removed from ExpandableSection.`,
- type: "JSXOpeningElement",
},
],
},
@@ -29,7 +28,6 @@ ruleTester.run("expandableSection-remove-isActive-prop", rule, {
errors: [
{
message: `The \`isActive\` prop has been removed from ExpandableSection.`,
- type: "JSXOpeningElement",
},
],
},
@@ -40,7 +38,6 @@ ruleTester.run("expandableSection-remove-isActive-prop", rule, {
errors: [
{
message: `The \`isActive\` prop has been removed from ExpandableSection.`,
- type: "JSXOpeningElement",
},
],
},
@@ -51,7 +48,6 @@ ruleTester.run("expandableSection-remove-isActive-prop", rule, {
errors: [
{
message: `The \`isActive\` prop has been removed from ExpandableSection.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/formFiledGroupHeaderTitleTextObjectRenamed/formFiledGroupHeaderTitleTextObject-renamed.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/formFiledGroupHeaderTitleTextObjectRenamed/formFiledGroupHeaderTitleTextObject-renamed.test.ts
index 6af1c9e33..c17a92609 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/formFiledGroupHeaderTitleTextObjectRenamed/formFiledGroupHeaderTitleTextObject-renamed.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/formFiledGroupHeaderTitleTextObjectRenamed/formFiledGroupHeaderTitleTextObject-renamed.test.ts
@@ -20,11 +20,9 @@ ruleTester.run("formFiledGroupHeaderTitleTextObject-renamed", rule, {
errors: [
{
message: errorMessage,
- type: "Identifier",
},
{
message: errorMessage,
- type: "Identifier",
},
],
},
@@ -34,11 +32,9 @@ ruleTester.run("formFiledGroupHeaderTitleTextObject-renamed", rule, {
errors: [
{
message: errorMessage,
- type: "Identifier",
},
{
message: errorMessage,
- type: "Identifier",
},
],
},
@@ -48,11 +44,9 @@ ruleTester.run("formFiledGroupHeaderTitleTextObject-renamed", rule, {
errors: [
{
message: errorMessage,
- type: "Identifier",
},
{
message: errorMessage,
- type: "Identifier",
},
],
},
@@ -62,7 +56,6 @@ ruleTester.run("formFiledGroupHeaderTitleTextObject-renamed", rule, {
errors: [
{
message: errorMessage,
- type: "Identifier",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/formGroupRenameLabelIcon/formGroup-rename-labelIcon.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/formGroupRenameLabelIcon/formGroup-rename-labelIcon.test.ts
index a9d58a721..a3f486800 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/formGroupRenameLabelIcon/formGroup-rename-labelIcon.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/formGroupRenameLabelIcon/formGroup-rename-labelIcon.test.ts
@@ -17,7 +17,6 @@ ruleTester.run("formGroup-rename-labelIcon", rule, {
errors: [
{
message: `The \`labelIcon\` prop for FormGroup has been renamed to \`labelHelp\`. We recommend using FormGroupLabelHelp element for the labelHelp prop. The markup has also changed, we now wrap the labelHelp element in \`\`, so there is no need to add \`className="pf-v6-c-form__group-label-help"\` to the labelHelp element.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/helperTextItemRemoveProps/helperTextItem-remove-props.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/helperTextItemRemoveProps/helperTextItem-remove-props.test.ts
index 4de792759..f6ce066d8 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/helperTextItemRemoveProps/helperTextItem-remove-props.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/helperTextItemRemoveProps/helperTextItem-remove-props.test.ts
@@ -17,7 +17,6 @@ ruleTester.run("helperTextItem-remove-props", rule, {
errors: [
{
message: `The \`hasIcon\` prop has been removed from HelperTextItem. An icon will now render automatically when the \`variant\` prop has a value other than "default" or when the \`icon\` prop is passed in.`,
- type: "JSXOpeningElement",
},
],
},
@@ -27,7 +26,6 @@ ruleTester.run("helperTextItem-remove-props", rule, {
errors: [
{
message: `The \`isDynamic\` prop has been removed from HelperTextItem.`,
- type: "JSXOpeningElement",
},
],
},
@@ -38,11 +36,9 @@ ruleTester.run("helperTextItem-remove-props", rule, {
errors: [
{
message: `The \`hasIcon\` prop has been removed from HelperTextItem. An icon will now render automatically when the \`variant\` prop has a value other than "default" or when the \`icon\` prop is passed in.`,
- type: "JSXOpeningElement",
},
{
message: `The \`isDynamic\` prop has been removed from HelperTextItem.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/helperTextItemWarnScreenReaderTextUpdate/helperTextItem-warn-screenReaderText-update.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/helperTextItemWarnScreenReaderTextUpdate/helperTextItem-warn-screenReaderText-update.test.ts
index c0fd2802c..bb743a2cc 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/helperTextItemWarnScreenReaderTextUpdate/helperTextItem-warn-screenReaderText-update.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/helperTextItemWarnScreenReaderTextUpdate/helperTextItem-warn-screenReaderText-update.test.ts
@@ -10,11 +10,10 @@ ruleTester.run("helperTextItem-warn-screenReaderText-update", rule, {
invalid: [
{
code: `import { HelperTextItem } from '@patternfly/react-core'; `,
- output: `import { HelperTextItem } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `The \`screenReaderText\` prop on HelperTextItem has been updated, and will now render only when the \`variant\` prop has a value other than "default". Previously the prop was rendered only when the \`isDynamic\` prop was true.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/jumpLinksItemHrefRequired/jumpLinksItem-href-required.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/jumpLinksItemHrefRequired/jumpLinksItem-href-required.test.ts
index 3fa1456d4..7dd257b1a 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/jumpLinksItemHrefRequired/jumpLinksItem-href-required.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/jumpLinksItemHrefRequired/jumpLinksItem-href-required.test.ts
@@ -13,21 +13,19 @@ ruleTester.run("jumpLinksItem-href-required", rule, {
invalid: [
{
code: `import { JumpLinksItem } from '@patternfly/react-core'; `,
- output: `import { JumpLinksItem } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `The \`href\` prop on JumpLinksItem is now required.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { JumpLinksItem } from '@patternfly/react-core'; `,
- output: `import { JumpLinksItem } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `The \`href\` prop on JumpLinksItem is now required.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/jumpLinksItemWarnMarkupChange/jumpLinksItem-warn-markup-change.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/jumpLinksItemWarnMarkupChange/jumpLinksItem-warn-markup-change.test.ts
index d47341246..f46706a47 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/jumpLinksItemWarnMarkupChange/jumpLinksItem-warn-markup-change.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/jumpLinksItemWarnMarkupChange/jumpLinksItem-warn-markup-change.test.ts
@@ -10,11 +10,10 @@ ruleTester.run("jumpLinksItem-warn-markup-change", rule, {
invalid: [
{
code: `import { JumpLinksItem } from '@patternfly/react-core';`,
- output: `import { JumpLinksItem } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The markup for JumpLinksItem has changed, as it now uses our Button component internally. Additionally, the \`onClick\` prop type has been updated to just \`React.MouseEvent\` (previously \`React.MouseEvent\`).`,
- type: "ImportDeclaration",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/kebabToggleReplaceWithMenuToggle/kebabToggle-replace-with-menuToggle.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/kebabToggleReplaceWithMenuToggle/kebabToggle-replace-with-menuToggle.test.ts
index 71381d358..5e54bcf07 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/kebabToggleReplaceWithMenuToggle/kebabToggle-replace-with-menuToggle.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/kebabToggleReplaceWithMenuToggle/kebabToggle-replace-with-menuToggle.test.ts
@@ -34,7 +34,6 @@ ruleTester.run("kebabToggle-replace-with-menuToggle", rule, {
errors: [
{
message,
- type: "ImportDeclaration",
},
],
},
@@ -44,7 +43,6 @@ ruleTester.run("kebabToggle-replace-with-menuToggle", rule, {
errors: [
{
message,
- type: "ImportDeclaration",
},
],
},
@@ -54,7 +52,6 @@ ruleTester.run("kebabToggle-replace-with-menuToggle", rule, {
errors: [
{
message,
- type: "ImportDeclaration",
},
],
},
@@ -64,7 +61,6 @@ ruleTester.run("kebabToggle-replace-with-menuToggle", rule, {
errors: [
{
message,
- type: "ImportDeclaration",
},
],
},
@@ -74,11 +70,9 @@ ruleTester.run("kebabToggle-replace-with-menuToggle", rule, {
errors: [
{
message,
- type: "ImportDeclaration",
},
{
message,
- type: "JSXElement",
},
],
},
@@ -88,11 +82,9 @@ ruleTester.run("kebabToggle-replace-with-menuToggle", rule, {
errors: [
{
message,
- type: "ImportDeclaration",
},
{
message,
- type: "JSXElement",
},
],
},
@@ -102,11 +94,9 @@ ruleTester.run("kebabToggle-replace-with-menuToggle", rule, {
errors: [
{
message,
- type: "ImportDeclaration",
},
{
message,
- type: "JSXElement",
},
],
},
@@ -118,11 +108,9 @@ ruleTester.run("kebabToggle-replace-with-menuToggle", rule, {
errors: [
{
message,
- type: "ImportDeclaration",
},
{
message,
- type: "JSXElement",
},
],
},
@@ -132,11 +120,9 @@ ruleTester.run("kebabToggle-replace-with-menuToggle", rule, {
errors: [
{
message,
- type: "ImportDeclaration",
},
{
message,
- type: "Identifier",
},
],
},
@@ -146,7 +132,6 @@ ruleTester.run("kebabToggle-replace-with-menuToggle", rule, {
errors: [
{
message,
- type: "ImportDeclaration",
},
],
},
@@ -156,7 +141,6 @@ ruleTester.run("kebabToggle-replace-with-menuToggle", rule, {
errors: [
{
message,
- type: "ImportDeclaration",
},
],
},
@@ -166,7 +150,6 @@ ruleTester.run("kebabToggle-replace-with-menuToggle", rule, {
errors: [
{
message,
- type: "ImportDeclaration",
},
],
},
@@ -176,11 +159,9 @@ ruleTester.run("kebabToggle-replace-with-menuToggle", rule, {
errors: [
{
message,
- type: "ImportDeclaration",
},
{
message,
- type: "JSXElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/labelRemoveIsOverflowLabel/label-remove-isOverflowLabel.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/labelRemoveIsOverflowLabel/label-remove-isOverflowLabel.test.ts
index 7976c4093..bf8323aab 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/labelRemoveIsOverflowLabel/label-remove-isOverflowLabel.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/labelRemoveIsOverflowLabel/label-remove-isOverflowLabel.test.ts
@@ -18,7 +18,6 @@ ruleTester.run("label-remove-isOverflowLabel", rule, {
{
message:
'The `isOverflowLabel` prop for Label has been replaced with `variant="overflow"`.',
- type: "JSXOpeningElement",
},
],
},
@@ -29,7 +28,6 @@ ruleTester.run("label-remove-isOverflowLabel", rule, {
{
message:
'The `isOverflowLabel` prop for Label has been replaced with `variant="overflow"`. Running the fix for this rule will replace an existing `variant` prop (which had no effect if `isOverflowLabel` was used).',
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/logViewerMovedStyles/logViewer-moved-styles.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/logViewerMovedStyles/logViewer-moved-styles.test.ts
index 89807025d..eec414abf 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/logViewerMovedStyles/logViewer-moved-styles.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/logViewerMovedStyles/logViewer-moved-styles.test.ts
@@ -13,11 +13,10 @@ ruleTester.run("logViewer-moved-styles", rule, {
invalid: [
{
code: `import { LogViewer } from '@patternfly/react-log-viewer';`,
- output: `import { LogViewer } from '@patternfly/react-log-viewer';`,
+ output: null,
errors: [
{
message: `The stylesheet for LogViewer has been moved out of the PatternFly package and into LogViewer itself. You may need to update stylesheet imports or import the stylesheet manually.`,
- type: "ImportDeclaration",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/loginMainFooterLinksItemStructureUpdated/loginMainFooterLinksItem-structure-updated.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/loginMainFooterLinksItemStructureUpdated/loginMainFooterLinksItem-structure-updated.test.ts
index 685dc734b..954521125 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/loginMainFooterLinksItemStructureUpdated/loginMainFooterLinksItem-structure-updated.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/loginMainFooterLinksItemStructureUpdated/loginMainFooterLinksItem-structure-updated.test.ts
@@ -3,7 +3,6 @@ import * as rule from "./loginMainFooterLinksItem-structure-updated";
const loginMainFooterLinksItemError = {
message: `LoginMainFooterLinksItem structure has changed. Instead of passing it many properties, everything is now passed directly in a children component.`,
- type: "JSXElement",
};
ruleTester.run("loginMainFooterLinksItem-structure-updated", rule, {
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/loginMainFooterLinksItemStructureUpdated/loginMainFooterLinksItem-structure-updated.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/loginMainFooterLinksItemStructureUpdated/loginMainFooterLinksItem-structure-updated.ts
index 567403a8b..8194c9f8e 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/loginMainFooterLinksItemStructureUpdated/loginMainFooterLinksItem-structure-updated.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/loginMainFooterLinksItemStructureUpdated/loginMainFooterLinksItem-structure-updated.ts
@@ -57,7 +57,7 @@ module.exports = {
);
const linkComponentPropsSpread = linkComponentPropsExpression
? `{...${context
- .getSourceCode()
+ .sourceCode
.getText(linkComponentPropsExpression)}}`
: "";
@@ -65,7 +65,7 @@ module.exports = {
childrenAttribute?.value
);
const childrenAttributeValueText = childrenAttributeExpression
- ? context.getSourceCode().getText(childrenAttributeExpression)
+ ? context.sourceCode.getText(childrenAttributeExpression)
: "";
const wrapperProps = [
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/loginMainHeaderWarnUpdatedMarkup/loginMainHeader-warn-updated-markup.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/loginMainHeaderWarnUpdatedMarkup/loginMainHeader-warn-updated-markup.test.ts
index 9ffcb28d7..cefdaadcf 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/loginMainHeaderWarnUpdatedMarkup/loginMainHeader-warn-updated-markup.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/loginMainHeaderWarnUpdatedMarkup/loginMainHeader-warn-updated-markup.test.ts
@@ -19,71 +19,64 @@ ruleTester.run("loginMainHeader-warn-updated-markup", rule, {
invalid: [
{
code: `import { LoginMainHeader } from '@patternfly/react-core';`,
- output: `import { LoginMainHeader } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The markup for LoginMainHeader has been updated, now using a div wrapper instead of a header element wrapper.`,
- type: "ImportDeclaration",
},
],
},
{
code: `import { LoginPage } from '@patternfly/react-core';`,
- output: `import { LoginPage } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The markup for LoginMainHeader (which is used internally within LoginPage) has been updated, now using a div wrapper instead of a header element wrapper.`,
- type: "ImportDeclaration",
},
],
},
{
code: `import { LoginPage, LoginMainHeader, Button } from '@patternfly/react-core';`,
- output: `import { LoginPage, LoginMainHeader, Button } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The markup for LoginMainHeader (which is used internally within LoginPage) has been updated, now using a div wrapper instead of a header element wrapper.`,
- type: "ImportDeclaration",
},
],
},
{
code: `import { LoginMainHeader as CustomThing } from '@patternfly/react-core';`,
- output: `import { LoginMainHeader as CustomThing } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The markup for LoginMainHeader has been updated, now using a div wrapper instead of a header element wrapper.`,
- type: "ImportDeclaration",
},
],
},
{
code: `import { LoginMainHeader } from '@patternfly/react-core/dist/esm/components/LoginPage/index.js';`,
- output: `import { LoginMainHeader } from '@patternfly/react-core/dist/esm/components/LoginPage/index.js';`,
+ output: null,
errors: [
{
message: `The markup for LoginMainHeader has been updated, now using a div wrapper instead of a header element wrapper.`,
- type: "ImportDeclaration",
},
],
},
{
code: `import { LoginMainHeader } from '@patternfly/react-core/dist/js/components/LoginPage/index.js';`,
- output: `import { LoginMainHeader } from '@patternfly/react-core/dist/js/components/LoginPage/index.js';`,
+ output: null,
errors: [
{
message: `The markup for LoginMainHeader has been updated, now using a div wrapper instead of a header element wrapper.`,
- type: "ImportDeclaration",
},
],
},
{
code: `import { LoginMainHeader } from '@patternfly/react-core/dist/dynamic/components/LoginPage/index.js';`,
- output: `import { LoginMainHeader } from '@patternfly/react-core/dist/dynamic/components/LoginPage/index.js';`,
+ output: null,
errors: [
{
message: `The markup for LoginMainHeader has been updated, now using a div wrapper instead of a header element wrapper.`,
- type: "ImportDeclaration",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/mastheadNameChanges/masthead-name-changes.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/mastheadNameChanges/masthead-name-changes.test.ts
index 7a82e31af..ad0073e2a 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/mastheadNameChanges/masthead-name-changes.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/mastheadNameChanges/masthead-name-changes.test.ts
@@ -17,7 +17,6 @@ ruleTester.run("masthead-name-changes", rule, {
errors: [
{
message: `MastheadBrand has been renamed to MastheadLogo.`,
- type: "JSXOpeningElement",
},
],
},
@@ -28,7 +27,6 @@ ruleTester.run("masthead-name-changes", rule, {
errors: [
{
message: `MastheadBrand has been renamed to MastheadLogo.`,
- type: "JSXOpeningElement",
},
],
},
@@ -39,7 +37,6 @@ ruleTester.run("masthead-name-changes", rule, {
errors: [
{
message: `MastheadBrand has been renamed to MastheadLogo.`,
- type: "JSXOpeningElement",
},
],
},
@@ -50,7 +47,6 @@ ruleTester.run("masthead-name-changes", rule, {
errors: [
{
message: `MastheadBrand has been renamed to MastheadLogo.`,
- type: "JSXOpeningElement",
},
],
},
@@ -60,7 +56,6 @@ ruleTester.run("masthead-name-changes", rule, {
errors: [
{
message: `MastheadBrand has been renamed to MastheadLogo.`,
- type: "JSXOpeningElement",
},
],
},
@@ -70,7 +65,6 @@ ruleTester.run("masthead-name-changes", rule, {
errors: [
{
message: `MastheadBrand has been renamed to MastheadLogo.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/mastheadRemoveBackgroundColor/masthead-remove-background-color.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/mastheadRemoveBackgroundColor/masthead-remove-background-color.test.ts
index 4433a322e..e14b5c4c5 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/mastheadRemoveBackgroundColor/masthead-remove-background-color.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/mastheadRemoveBackgroundColor/masthead-remove-background-color.test.ts
@@ -16,7 +16,6 @@ ruleTester.run("masthead-remove-background-color", rule, {
output: `import { Masthead } from '@patternfly/react-core'; `,
errors: [{
message: `We've removed the \`backgroundColor\` prop from Masthead as theming is no longer handled React-side.`,
- type: "JSXOpeningElement",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/mastheadStructureChanges/masthead-structure-changes.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/mastheadStructureChanges/masthead-structure-changes.test.ts
index 57dbbeae6..b0e4f9b10 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/mastheadStructureChanges/masthead-structure-changes.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/mastheadStructureChanges/masthead-structure-changes.test.ts
@@ -28,11 +28,9 @@ ruleTester.run("masthead-structure-changes", rule, {
errors: [
{
message: `The structure of Masthead has been updated, MastheadToggle should now be wrapped in MastheadMain.`,
- type: "JSXOpeningElement",
},
{
message: `The structure of Masthead has been updated, the PF5 MastheadBrand has been renamed to MastheadLogo (this renaming is handled by our masthead-name-changes codemod) and should now be wrapped in a new MastheadBrand.`,
- type: "JSXOpeningElement",
},
],
},
@@ -43,7 +41,6 @@ ruleTester.run("masthead-structure-changes", rule, {
errors: [
{
message: `The structure of Masthead has been updated, the PF5 MastheadBrand has been renamed to MastheadLogo (this renaming is handled by our masthead-name-changes codemod) and should now be wrapped in a new MastheadBrand.`,
- type: "JSXOpeningElement",
},
],
},
@@ -54,11 +51,9 @@ ruleTester.run("masthead-structure-changes", rule, {
errors: [
{
message: `The structure of Masthead has been updated, MastheadToggle should now be wrapped in MastheadMain.`,
- type: "JSXOpeningElement",
},
{
message: `The structure of Masthead has been updated, MastheadLogo should now be wrapped in MastheadBrand.`,
- type: "JSXOpeningElement",
},
],
},
@@ -69,7 +64,6 @@ ruleTester.run("masthead-structure-changes", rule, {
errors: [
{
message: `The structure of Masthead has been updated, MastheadToggle should now be wrapped in MastheadMain.`,
- type: "JSXOpeningElement",
},
],
},
@@ -80,11 +74,9 @@ ruleTester.run("masthead-structure-changes", rule, {
errors: [
{
message: `The structure of Masthead has been updated, MastheadToggle should now be wrapped in MastheadMain.`,
- type: "JSXOpeningElement",
},
{
message: `The structure of Masthead has been updated, the PF5 MastheadBrand has been renamed to MastheadLogo (this renaming is handled by our masthead-name-changes codemod) and should now be wrapped in a new MastheadBrand.`,
- type: "JSXOpeningElement",
},
],
},
@@ -94,7 +86,6 @@ ruleTester.run("masthead-structure-changes", rule, {
errors: [
{
message: `The structure of Masthead has been updated, the PF5 MastheadBrand has been renamed to MastheadLogo (this renaming is handled by our masthead-name-changes codemod) and should now be wrapped in a new MastheadBrand.`,
- type: "JSXOpeningElement",
},
],
},
@@ -105,11 +96,9 @@ ruleTester.run("masthead-structure-changes", rule, {
errors: [
{
message: `The structure of Masthead has been updated, MastheadToggle should now be wrapped in MastheadMain.`,
- type: "JSXOpeningElement",
},
{
message: `The structure of Masthead has been updated, MastheadLogo should now be wrapped in MastheadBrand.`,
- type: "JSXOpeningElement",
},
],
},
@@ -119,7 +108,6 @@ ruleTester.run("masthead-structure-changes", rule, {
errors: [
{
message: `The structure of Masthead has been updated, MastheadToggle should now be wrapped in MastheadMain.`,
- type: "JSXOpeningElement",
},
],
},
@@ -129,11 +117,9 @@ ruleTester.run("masthead-structure-changes", rule, {
errors: [
{
message: `The structure of Masthead has been updated, MastheadToggle should now be wrapped in MastheadMain.`,
- type: "JSXOpeningElement",
},
{
message: `The structure of Masthead has been updated, MastheadLogo should now be wrapped in MastheadBrand.`,
- type: "JSXOpeningElement",
},
],
},
@@ -143,7 +129,6 @@ ruleTester.run("masthead-structure-changes", rule, {
errors: [
{
message: `The structure of Masthead has been updated, MastheadToggle should now be wrapped in MastheadMain.`,
- type: "JSXOpeningElement",
},
],
},
@@ -153,11 +138,9 @@ ruleTester.run("masthead-structure-changes", rule, {
errors: [
{
message: `The structure of Masthead has been updated, MastheadToggle should now be wrapped in MastheadMain.`,
- type: "JSXOpeningElement",
},
{
message: `The structure of Masthead has been updated, MastheadLogo should now be wrapped in MastheadBrand.`,
- type: "JSXOpeningElement",
},
],
},
@@ -167,7 +150,6 @@ ruleTester.run("masthead-structure-changes", rule, {
errors: [
{
message: `The structure of Masthead has been updated, MastheadToggle should now be wrapped in MastheadMain.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/mastheadStructureChanges/masthead-structure-changes.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/mastheadStructureChanges/masthead-structure-changes.ts
index d980355d3..bc2f47d7d 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/mastheadStructureChanges/masthead-structure-changes.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/mastheadStructureChanges/masthead-structure-changes.ts
@@ -32,7 +32,7 @@ function moveNodeIntoMastheadMain(
const fixes = [fixer.remove(node.parent)];
- const nodeString = context.getSourceCode().getText(node.parent);
+ const nodeString = context.sourceCode.getText(node.parent);
fixes.push(fixer.insertTextAfter(mastheadMain.openingElement, nodeString));
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/menuItemActionWarnUpdateMarkup/menuItemAction-warn-update-markup.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/menuItemActionWarnUpdateMarkup/menuItemAction-warn-update-markup.test.ts
index 8eac31ac8..f6aafe062 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/menuItemActionWarnUpdateMarkup/menuItemAction-warn-update-markup.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/menuItemActionWarnUpdateMarkup/menuItemAction-warn-update-markup.test.ts
@@ -10,11 +10,10 @@ ruleTester.run("menuItemAction-warn-update-markup", rule, {
invalid: [
{
code: `import { MenuItemAction } from '@patternfly/react-core';`,
- output: `import { MenuItemAction } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The markup for MenuItemAction has been updated. It now uses our Button component internally, has a wrapper around the action button, and no longer renders an icon wrapper inside the action button.`,
- type: "ImportDeclaration",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/menuToggleRemoveSplitButtonOptions/menuToggle-remove-splitButtonOptions.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/menuToggleRemoveSplitButtonOptions/menuToggle-remove-splitButtonOptions.test.ts
index 1bbcd79ef..707a2831a 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/menuToggleRemoveSplitButtonOptions/menuToggle-remove-splitButtonOptions.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/menuToggleRemoveSplitButtonOptions/menuToggle-remove-splitButtonOptions.test.ts
@@ -7,7 +7,6 @@ const interfaceRemovedMessage = `The SplitButtonOptions interface has been remov
const generalError = {
message,
- type: "JSXOpeningElement",
};
ruleTester.run("menuToggle-remove-splitButtonOptions", rule, {
@@ -65,11 +64,9 @@ ruleTester.run("menuToggle-remove-splitButtonOptions", rule, {
errors: [
{
message: interfaceRemovedMessage,
- type: "ImportSpecifier",
},
{
message: interfaceRemovedMessage,
- type: "Identifier",
},
generalError,
],
@@ -83,11 +80,9 @@ ruleTester.run("menuToggle-remove-splitButtonOptions", rule, {
errors: [
{
message: interfaceRemovedMessage,
- type: "ImportSpecifier",
},
{
message: interfaceRemovedMessage,
- type: "ExportNamedDeclaration",
},
],
},
@@ -100,11 +95,9 @@ ruleTester.run("menuToggle-remove-splitButtonOptions", rule, {
errors: [
{
message: interfaceRemovedMessage,
- type: "ImportSpecifier",
},
{
message: interfaceRemovedMessage,
- type: "ExportDefaultDeclaration",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/menuToggleRemoveSplitButtonOptions/menuToggle-remove-splitButtonOptions.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/menuToggleRemoveSplitButtonOptions/menuToggle-remove-splitButtonOptions.ts
index 1b3ca0bfb..2ef2cfecf 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/menuToggleRemoveSplitButtonOptions/menuToggle-remove-splitButtonOptions.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/menuToggleRemoveSplitButtonOptions/menuToggle-remove-splitButtonOptions.ts
@@ -89,7 +89,7 @@ module.exports = {
if (itemsProperty) {
const itemsPropertyValueString = context
- .getSourceCode()
+ .sourceCode
.getText(itemsProperty.value);
reportAndFix(itemsPropertyValueString);
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/menuToggleWarnIconOnlyToggle/menuToggle-warn-iconOnly-toggle.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/menuToggleWarnIconOnlyToggle/menuToggle-warn-iconOnly-toggle.test.ts
index c121f02e6..3d29a6241 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/menuToggleWarnIconOnlyToggle/menuToggle-warn-iconOnly-toggle.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/menuToggleWarnIconOnlyToggle/menuToggle-warn-iconOnly-toggle.test.ts
@@ -10,11 +10,10 @@ ruleTester.run("menuToggle-warn-iconOnly-toggle", rule, {
invalid: [
{
code: `import { MenuToggle } from '@patternfly/react-core'; `,
- output: `import { MenuToggle } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `We now recommend passing any icon to the \`icon\` prop instead of passing it as children, such as for plain, icon only toggles. Passing an icon as children will result in incorrect styling.`,
- type: "ImportDeclaration",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/modalDeprecated/modal-deprecated.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/modalDeprecated/modal-deprecated.test.ts
index 62802d2cb..675d5b2e5 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/modalDeprecated/modal-deprecated.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/modalDeprecated/modal-deprecated.test.ts
@@ -52,63 +52,63 @@ specifiersToMove.forEach((specifier) => {
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core';`,
`import {\n\t${specifier}\n} from '@patternfly/react-core/deprecated';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} as CustomSpecifier } from '@patternfly/react-core';`,
`import {\n\t${specifier} as CustomSpecifier\n} from '@patternfly/react-core/deprecated';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core/dist/esm/components/Modal/index.js';`,
`import {\n\t${specifier}\n} from '@patternfly/react-core/dist/esm/deprecated/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core/dist/js/components/Modal/index.js';`,
`import {\n\t${specifier}\n} from '@patternfly/react-core/dist/js/deprecated/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core/dist/dynamic/components/Modal/index.js';`,
`import {\n\t${specifier}\n} from '@patternfly/react-core/dist/dynamic/deprecated/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`export { ${specifier} } from '@patternfly/react-core';`,
`export {\n\t${specifier}\n} from '@patternfly/react-core/deprecated';`,
- [{ message: errorMessage, type: "ExportNamedDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`export { ${specifier} } from '@patternfly/react-core/dist/esm/components/Modal/index.js';`,
`export {\n\t${specifier}\n} from '@patternfly/react-core/dist/esm/deprecated/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ExportNamedDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`export { ${specifier} } from '@patternfly/react-core/dist/js/components/Modal/index.js';`,
`export {\n\t${specifier}\n} from '@patternfly/react-core/dist/js/deprecated/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ExportNamedDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`export { ${specifier} } from '@patternfly/react-core/dist/dynamic/components/Modal/index.js';`,
`export {\n\t${specifier}\n} from '@patternfly/react-core/dist/dynamic/deprecated/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ExportNamedDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
@@ -116,7 +116,7 @@ specifiersToMove.forEach((specifier) => {
`import { ${specifier}, Button } from '@patternfly/react-core';`,
`import {\n\tButton\n} from '@patternfly/react-core';
import {\n\t${specifier}\n} from '@patternfly/react-core/deprecated';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
});
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/modalNextPromoted/modalNext-promoted.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/modalNextPromoted/modalNext-promoted.test.ts
index ecf05015c..41b9f6508 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/modalNextPromoted/modalNext-promoted.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/modalNextPromoted/modalNext-promoted.test.ts
@@ -37,70 +37,70 @@ specifiersToMove.forEach((specifier) => {
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core/next';`,
`import {\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} as CustomSpecifier } from '@patternfly/react-core/next';`,
`import {\n\t${specifier} as CustomSpecifier /* data-codemods */\n} from '@patternfly/react-core';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core/dist/esm/next/components/Modal/index.js';`,
`import {\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core/dist/esm/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core/dist/js/next/components/Modal/index.js';`,
`import {\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core/dist/js/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core/dist/dynamic/next/components/Modal/index.js';`,
`import {\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core/dist/dynamic/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`export { ${specifier} } from '@patternfly/react-core/next';`,
`export {\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core';`,
- [{ message: errorMessage, type: "ExportNamedDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`export { ${specifier} } from '@patternfly/react-core/dist/esm/next/components/Modal/index.js';`,
`export {\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core/dist/esm/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ExportNamedDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`export { ${specifier} } from '@patternfly/react-core/dist/js/next/components/Modal/index.js';`,
`export {\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core/dist/js/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ExportNamedDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`export { ${specifier} } from '@patternfly/react-core/dist/dynamic/next/components/Modal/index.js';`,
`export {\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core/dist/dynamic/components/Modal/index.js';`,
- [{ message: errorMessage, type: "ExportNamedDeclaration" }]
+ [{ message: errorMessage }]
)
);
invalidTests.push(
createInvalidTest(
`import { ${specifier} } from '@patternfly/react-core/next';\nimport { Button } from '@patternfly/react-core';`,
`\nimport {\n\tButton,\n\t${specifier} /* data-codemods */\n} from '@patternfly/react-core';`,
- [{ message: errorMessage, type: "ImportDeclaration" }]
+ [{ message: errorMessage }]
)
);
});
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/navItemRemoveHasNavLinkWrapperProp/navItem-remove-hasNavLinkWrapper-prop.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/navItemRemoveHasNavLinkWrapperProp/navItem-remove-hasNavLinkWrapper-prop.test.ts
index ffc0cb22e..70d9e74bc 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/navItemRemoveHasNavLinkWrapperProp/navItem-remove-hasNavLinkWrapper-prop.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/navItemRemoveHasNavLinkWrapperProp/navItem-remove-hasNavLinkWrapper-prop.test.ts
@@ -17,7 +17,6 @@ ruleTester.run("navItem-remove-hasNavLinkWrapper-prop", rule, {
errors: [
{
message: `The \`hasNavLinkWrapper\` prop has been removed from NavItem. Additionally, any icons for a NavItem should be passed to its new \`icon\` prop.`,
- type: "JSXOpeningElement",
},
],
},
@@ -27,7 +26,6 @@ ruleTester.run("navItem-remove-hasNavLinkWrapper-prop", rule, {
errors: [
{
message: `The \`hasNavLinkWrapper\` prop has been removed from NavItem. Additionally, any icons for a NavItem should be passed to its new \`icon\` prop.`,
- type: "JSXOpeningElement",
},
],
},
@@ -37,7 +35,6 @@ ruleTester.run("navItem-remove-hasNavLinkWrapper-prop", rule, {
errors: [
{
message: `The \`hasNavLinkWrapper\` prop has been removed from NavItem. Additionally, any icons for a NavItem should be passed to its new \`icon\` prop.`,
- type: "JSXOpeningElement",
},
],
},
@@ -47,7 +44,6 @@ ruleTester.run("navItem-remove-hasNavLinkWrapper-prop", rule, {
errors: [
{
message: `The \`hasNavLinkWrapper\` prop has been removed from NavItem. Additionally, any icons for a NavItem should be passed to its new \`icon\` prop.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/navRemoveTertiaryVariant/nav-remove-tertiary-variant.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/navRemoveTertiaryVariant/nav-remove-tertiary-variant.test.ts
index 91cc94ab0..3e5ba93db 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/navRemoveTertiaryVariant/nav-remove-tertiary-variant.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/navRemoveTertiaryVariant/nav-remove-tertiary-variant.test.ts
@@ -20,7 +20,6 @@ ruleTester.run("nav-remove-tertiary-variant", rule, {
errors: [
{
message: `The "tertiary" Nav variant is no longer supported. Use variant="horizontal-subnav" instead.`,
- type: "JSXOpeningElement",
},
],
},
@@ -30,7 +29,6 @@ ruleTester.run("nav-remove-tertiary-variant", rule, {
errors: [
{
message: `The "tertiary" Nav variant is no longer supported. Use variant="horizontal-subnav" instead.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/navRemoveThemeProp/nav-remove-theme-prop.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/navRemoveThemeProp/nav-remove-theme-prop.test.ts
index a88064fc2..223c7ee41 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/navRemoveThemeProp/nav-remove-theme-prop.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/navRemoveThemeProp/nav-remove-theme-prop.test.ts
@@ -17,7 +17,6 @@ ruleTester.run("nav-remove-theme-prop", rule, {
errors: [
{
message: `The \`theme\` prop is no longer supported in Nav. Use light/dark mode theming instead.`,
- type: "JSXOpeningElement",
},
],
},
@@ -27,7 +26,6 @@ ruleTester.run("nav-remove-theme-prop", rule, {
errors: [
{
message: `The \`theme\` prop is no longer supported in Nav. Use light/dark mode theming instead.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/noDuplicateImportSpecifiers/no-duplicate-import-specifiers.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/noDuplicateImportSpecifiers/no-duplicate-import-specifiers.test.ts
index 0209ffcd9..d900df80c 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/noDuplicateImportSpecifiers/no-duplicate-import-specifiers.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/noDuplicateImportSpecifiers/no-duplicate-import-specifiers.test.ts
@@ -40,7 +40,6 @@ ruleTester.run("no-duplicate-import-specifiers", rule, {
errors: [
{
message: `Duplicate import specifier Button imported from '@patternfly/react-core'.`,
- type: "ImportSpecifier",
},
],
},
@@ -54,7 +53,6 @@ ruleTester.run("no-duplicate-import-specifiers", rule, {
errors: [
{
message: `Duplicate import specifier Button imported from '@patternfly/react-core'.`,
- type: "ImportSpecifier",
},
],
},
@@ -68,7 +66,6 @@ ruleTester.run("no-duplicate-import-specifiers", rule, {
errors: [
{
message: `Duplicate import specifier Button imported from '@patternfly/react-core/dist/dynamic/components/Button'.`,
- type: "ImportSpecifier",
},
],
},
@@ -86,7 +83,6 @@ ruleTester.run("no-duplicate-import-specifiers", rule, {
errors: [
{
message: `Duplicate import specifier BTN imported from '@patternfly/react-core'.`,
- type: "ImportSpecifier",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/noDuplicateImportSpecifiers/no-duplicate-import-specifiers.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/noDuplicateImportSpecifiers/no-duplicate-import-specifiers.ts
index 1a864e503..fcb31b949 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/noDuplicateImportSpecifiers/no-duplicate-import-specifiers.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/noDuplicateImportSpecifiers/no-duplicate-import-specifiers.ts
@@ -23,8 +23,8 @@ module.exports = {
: {
ImportSpecifier(node: ImportSpecifier) {
if (duplicatesToRemove.includes(node)) {
- const importDeclaration = context
- .getAncestors()
+ const importDeclaration = context.sourceCode
+ .getAncestors(node)
.find(
(ancestor) => ancestor.type === "ImportDeclaration"
) as ImportDeclaration;
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/noUnusedImportsV6/no-unused-imports-v6.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/noUnusedImportsV6/no-unused-imports-v6.test.ts
index 7a6d34306..b3d521c5a 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/noUnusedImportsV6/no-unused-imports-v6.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/noUnusedImportsV6/no-unused-imports-v6.test.ts
@@ -18,7 +18,6 @@ ruleTester.run("no-unused-imports-v6", rule, {
errors: [
{
message: `Unused PatternFly import Foo from '@patternfly/react-core' should be removed`,
- type: "ImportDeclaration",
},
],
},
@@ -29,7 +28,6 @@ ruleTester.run("no-unused-imports-v6", rule, {
errors: [
{
message: `Unused PatternFly import Foo from '@patternfly/react-core' should be removed`,
- type: "ImportDeclaration",
},
],
},
@@ -40,7 +38,6 @@ ruleTester.run("no-unused-imports-v6", rule, {
errors: [
{
message: `Unused PatternFly import Foo from '@patternfly/react-core' should be removed`,
- type: "ImportDeclaration",
},
],
},
@@ -51,7 +48,6 @@ ruleTester.run("no-unused-imports-v6", rule, {
errors: [
{
message: `Unused PatternFly imports Bash, Foo, Bang from '@patternfly/react-core' should be removed`,
- type: "ImportDeclaration",
},
],
},
@@ -62,7 +58,6 @@ ruleTester.run("no-unused-imports-v6", rule, {
errors: [
{
message: `Unused PatternFly import Foo from '@patternfly/react-core/dist/esm/components' should be removed`,
- type: "ImportDeclaration",
},
],
},
@@ -73,7 +68,6 @@ ruleTester.run("no-unused-imports-v6", rule, {
errors: [
{
message: `Unused PatternFly import Foo from '@patternfly/react-core/dist/js/components' should be removed`,
- type: "ImportDeclaration",
},
],
},
@@ -84,7 +78,6 @@ ruleTester.run("no-unused-imports-v6", rule, {
errors: [
{
message: `Unused PatternFly import Foo from '@patternfly/react-core/dist/dynamic/components' should be removed`,
- type: "ImportDeclaration",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/noUnusedImportsV6/no-unused-imports-v6.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/noUnusedImportsV6/no-unused-imports-v6.ts
index 0368212e7..062903af5 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/noUnusedImportsV6/no-unused-imports-v6.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/noUnusedImportsV6/no-unused-imports-v6.ts
@@ -6,7 +6,7 @@ import { getEndRange } from "../../helpers";
module.exports = {
meta: { fixable: "code" },
create: function (context: Rule.RuleContext) {
- const sourceCode = context.getSourceCode();
+ const sourceCode = context.sourceCode;
const allTokens = [
...new Set(
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/notificationBadgeWarnMarkupChange/notificationBadge-warn-markup-change.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/notificationBadgeWarnMarkupChange/notificationBadge-warn-markup-change.test.ts
index d898538d1..7e85e30ed 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/notificationBadgeWarnMarkupChange/notificationBadge-warn-markup-change.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/notificationBadgeWarnMarkupChange/notificationBadge-warn-markup-change.test.ts
@@ -10,11 +10,10 @@ ruleTester.run('notificationBadge-warn-markup-change', rule, {
invalid: [
{
code: `import { NotificationBadge } from '@patternfly/react-core';`,
- output: `import { NotificationBadge } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The markup for NotificationBadge has changed, as it now uses stateful button internally.`,
- type: 'ImportDeclaration',
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/notificationDrawerHeaderWarnUpdateMarkup/notificationDrawerHeader-warn-update-markup.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/notificationDrawerHeaderWarnUpdateMarkup/notificationDrawerHeader-warn-update-markup.test.ts
index 25aeec824..420c9d564 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/notificationDrawerHeaderWarnUpdateMarkup/notificationDrawerHeader-warn-update-markup.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/notificationDrawerHeaderWarnUpdateMarkup/notificationDrawerHeader-warn-update-markup.test.ts
@@ -10,51 +10,46 @@ ruleTester.run("notificationDrawerHeader-warn-update-markup", rule, {
invalid: [
{
code: `import { NotificationDrawerHeader } from '@patternfly/react-core'; `,
- output: `import { NotificationDrawerHeader } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `NotificationDrawerHeader no longer uses our Text component internally, and instead renders a native \`h1\` element.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { NotificationDrawerHeader as CustomDrawerHeader } from '@patternfly/react-core'; `,
- output: `import { NotificationDrawerHeader as CustomDrawerHeader } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `NotificationDrawerHeader no longer uses our Text component internally, and instead renders a native \`h1\` element.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { NotificationDrawerHeader } from '@patternfly/react-core/dist/esm/components/EmptyState/index.js'; `,
- output: `import { NotificationDrawerHeader } from '@patternfly/react-core/dist/esm/components/EmptyState/index.js'; `,
+ output: null,
errors: [
{
message: `NotificationDrawerHeader no longer uses our Text component internally, and instead renders a native \`h1\` element.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { NotificationDrawerHeader } from '@patternfly/react-core/dist/js/components/EmptyState/index.js'; `,
- output: `import { NotificationDrawerHeader } from '@patternfly/react-core/dist/js/components/EmptyState/index.js'; `,
+ output: null,
errors: [
{
message: `NotificationDrawerHeader no longer uses our Text component internally, and instead renders a native \`h1\` element.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { NotificationDrawerHeader } from '@patternfly/react-core/dist/dynamic/components/EmptyState/index.js'; `,
- output: `import { NotificationDrawerHeader } from '@patternfly/react-core/dist/dynamic/components/EmptyState/index.js'; `,
+ output: null,
errors: [
{
message: `NotificationDrawerHeader no longer uses our Text component internally, and instead renders a native \`h1\` element.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageBreadcrumbAndSectionWarnUpdatedWrapperLogic/pageBreadcrumbAndSection-warn-updated-wrapperLogic.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageBreadcrumbAndSectionWarnUpdatedWrapperLogic/pageBreadcrumbAndSection-warn-updated-wrapperLogic.test.ts
index 1fae61b22..15e5200d6 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageBreadcrumbAndSectionWarnUpdatedWrapperLogic/pageBreadcrumbAndSection-warn-updated-wrapperLogic.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageBreadcrumbAndSectionWarnUpdatedWrapperLogic/pageBreadcrumbAndSection-warn-updated-wrapperLogic.test.ts
@@ -16,7 +16,6 @@ for (const component of applicableComponents) {
const message = `The isWidthLimited prop on ${component} will no longer determine whether the children are wrapped in a PageBody. Instead the new hasBodyWrapper prop must be used. By default this new prop is set to true. Running the fix for this rule will apply hasBodyWrapper with the same value as the isWidthLimited prop or false if isWidthLimited is not passed.`;
const errorObject = {
message,
- type: "JSXOpeningElement",
};
invalidTests.push(
createInvalidTest(
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageHeaderToolsItemRemoveIsSelectedProp/pageHeaderToolsItem-remove-isSelected-prop.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageHeaderToolsItemRemoveIsSelectedProp/pageHeaderToolsItem-remove-isSelected-prop.test.ts
index bf9079b39..38fdd69a6 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageHeaderToolsItemRemoveIsSelectedProp/pageHeaderToolsItem-remove-isSelected-prop.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageHeaderToolsItemRemoveIsSelectedProp/pageHeaderToolsItem-remove-isSelected-prop.test.ts
@@ -17,7 +17,6 @@ ruleTester.run("pageHeaderToolsItem-remove-isSelected-prop", rule, {
errors: [
{
message: `The \`isSelected\` prop has been removed from PageHeaderToolsItem.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageNavigationRemoveComponent/pageNavigation-remove-component.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageNavigationRemoveComponent/pageNavigation-remove-component.test.ts
index ffbcba573..9fc833240 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageNavigationRemoveComponent/pageNavigation-remove-component.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageNavigationRemoveComponent/pageNavigation-remove-component.test.ts
@@ -23,7 +23,6 @@ ruleTester.run("pageNavigation-remove-component", rule, {
errors: [
{
message: `The PageNavigation component has been removed from PatternFly.`,
- type: "JSXElement",
},
],
},
@@ -33,7 +32,6 @@ ruleTester.run("pageNavigation-remove-component", rule, {
errors: [
{
message: `The PageNavigation component has been removed from PatternFly.`,
- type: "JSXElement",
},
],
},
@@ -43,7 +41,6 @@ ruleTester.run("pageNavigation-remove-component", rule, {
errors: [
{
message: `The PageNavigation component has been removed from PatternFly.`,
- type: "JSXElement",
},
],
},
@@ -53,7 +50,6 @@ ruleTester.run("pageNavigation-remove-component", rule, {
errors: [
{
message: `The PageNavigation component has been removed from PatternFly.`,
- type: "JSXElement",
},
],
},
@@ -63,7 +59,6 @@ ruleTester.run("pageNavigation-remove-component", rule, {
errors: [
{
message: `The PageNavigation component has been removed from PatternFly.`,
- type: "ExportNamedDeclaration",
},
],
},
@@ -73,7 +68,6 @@ ruleTester.run("pageNavigation-remove-component", rule, {
errors: [
{
message: `The PageNavigation component has been removed from PatternFly.`,
- type: "ExportNamedDeclaration",
},
],
},
@@ -83,7 +77,6 @@ ruleTester.run("pageNavigation-remove-component", rule, {
errors: [
{
message: `The PageNavigation component has been removed from PatternFly.`,
- type: "ExportNamedDeclaration",
},
],
},
@@ -93,7 +86,6 @@ ruleTester.run("pageNavigation-remove-component", rule, {
errors: [
{
message: `The PageNavigation component has been removed from PatternFly.`,
- type: "ExportNamedDeclaration",
},
],
},
@@ -103,7 +95,6 @@ ruleTester.run("pageNavigation-remove-component", rule, {
errors: [
{
message: `The PageNavigation component has been removed from PatternFly.`,
- type: "ExportDefaultDeclaration",
},
],
},
@@ -113,7 +104,6 @@ ruleTester.run("pageNavigation-remove-component", rule, {
errors: [
{
message: `The PageNavigation component has been removed from PatternFly.`,
- type: "JSXElement",
},
],
},
@@ -123,7 +113,6 @@ ruleTester.run("pageNavigation-remove-component", rule, {
errors: [
{
message: `The PageNavigation component has been removed from PatternFly.`,
- type: "JSXElement",
},
],
},
@@ -133,7 +122,6 @@ ruleTester.run("pageNavigation-remove-component", rule, {
errors: [
{
message: `The PageNavigation component has been removed from PatternFly.`,
- type: "JSXElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageNavigationRemoveComponent/pageNavigation-remove-component.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageNavigationRemoveComponent/pageNavigation-remove-component.ts
index df8bfcaf6..1388c2e3b 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageNavigationRemoveComponent/pageNavigation-remove-component.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageNavigationRemoveComponent/pageNavigation-remove-component.ts
@@ -66,7 +66,7 @@ module.exports = {
return [];
}
const tokenAfter = context
- .getSourceCode()
+ .sourceCode
.getTokenAfter(pageNavSpecifier);
const isCommaAfter = tokenAfter && tokenAfter.value === ",";
const rangeToRemove: AST.Range = [
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageRenameHeader/page-rename-header.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageRenameHeader/page-rename-header.test.ts
index 3cb827f7c..e64d9c30d 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageRenameHeader/page-rename-header.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageRenameHeader/page-rename-header.test.ts
@@ -3,7 +3,6 @@ import * as rule from './page-rename-header';
const error = {
message: `We've renamed the \`header\` prop for Page to \`masthead\`.`,
- type: 'JSXOpeningElement',
};
ruleTester.run('page-rename-header', rule, {
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageRenameIsTertiaryNavGrouped/page-rename-isTertiaryNavGrouped.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageRenameIsTertiaryNavGrouped/page-rename-isTertiaryNavGrouped.test.ts
index da360f292..b676cd152 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageRenameIsTertiaryNavGrouped/page-rename-isTertiaryNavGrouped.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageRenameIsTertiaryNavGrouped/page-rename-isTertiaryNavGrouped.test.ts
@@ -17,7 +17,6 @@ ruleTester.run('page-rename-isTertiaryNavGrouped', rule, {
errors: [
{
message: `We've renamed the \`isTertiaryNavGrouped\` prop to \`isHorizontalSubnavGrouped\`.`,
- type: 'JSXOpeningElement',
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageRenameIsTertiaryNavWidthLimited/page-rename-isTertiaryNavWidthLimited.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageRenameIsTertiaryNavWidthLimited/page-rename-isTertiaryNavWidthLimited.test.ts
index 2ead52045..4429b3b86 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageRenameIsTertiaryNavWidthLimited/page-rename-isTertiaryNavWidthLimited.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageRenameIsTertiaryNavWidthLimited/page-rename-isTertiaryNavWidthLimited.test.ts
@@ -17,7 +17,6 @@ ruleTester.run('page-rename-isTertiaryNavWidthLimited', rule, {
errors: [
{
message: `We've renamed the \`isTertiaryNavWidthLimited\` prop to \`isHorizontalSubnavWidthLimited\`.`,
- type: 'JSXOpeningElement',
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageRenameTertiaryNav/page-rename-tertiaryNav.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageRenameTertiaryNav/page-rename-tertiaryNav.test.ts
index ac511ccb7..46e2ade74 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageRenameTertiaryNav/page-rename-tertiaryNav.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageRenameTertiaryNav/page-rename-tertiaryNav.test.ts
@@ -17,7 +17,6 @@ ruleTester.run('page-rename-tertiaryNav', rule, {
errors: [
{
message: `We've renamed the \`tertiaryNav\` prop to \`horizontalSubnav\`.`,
- type: 'JSXOpeningElement',
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSectionRemoveNavType/pageSection-remove-nav-type.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSectionRemoveNavType/pageSection-remove-nav-type.test.ts
index 2e4cef9e3..3561db716 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSectionRemoveNavType/pageSection-remove-nav-type.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSectionRemoveNavType/pageSection-remove-nav-type.test.ts
@@ -17,7 +17,6 @@ ruleTester.run("pageSection-remove-nav-type", rule, {
errors: [
{
message: `The "nav" type for PageSection has been removed.`,
- type: "JSXOpeningElement",
},
],
},
@@ -27,7 +26,6 @@ ruleTester.run("pageSection-remove-nav-type", rule, {
errors: [
{
message: `The "nav" type for PageSection has been removed.`,
- type: "JSXOpeningElement",
},
],
},
@@ -37,7 +35,6 @@ ruleTester.run("pageSection-remove-nav-type", rule, {
errors: [
{
message: `The "nav" type for PageSection has been removed.`,
- type: "JSXOpeningElement",
},
],
},
@@ -47,7 +44,6 @@ ruleTester.run("pageSection-remove-nav-type", rule, {
errors: [
{
message: `The "nav" type for PageSection has been removed.`,
- type: "JSXOpeningElement",
},
],
},
@@ -57,7 +53,6 @@ ruleTester.run("pageSection-remove-nav-type", rule, {
errors: [
{
message: `The "nav" type for PageSection has been removed.`,
- type: "JSXOpeningElement",
},
],
},
@@ -67,7 +62,6 @@ ruleTester.run("pageSection-remove-nav-type", rule, {
errors: [
{
message: `The "nav" type for PageSection has been removed.`,
- type: "JSXOpeningElement",
},
],
},
@@ -77,7 +71,6 @@ ruleTester.run("pageSection-remove-nav-type", rule, {
errors: [
{
message: `The "nav" type for PageSection has been removed.`,
- type: "JSXOpeningElement",
},
],
},
@@ -87,7 +80,6 @@ ruleTester.run("pageSection-remove-nav-type", rule, {
errors: [
{
message: `The "nav" type for PageSection has been removed.`,
- type: "JSXOpeningElement",
},
],
},
@@ -97,7 +89,6 @@ ruleTester.run("pageSection-remove-nav-type", rule, {
errors: [
{
message: `The "nav" type for PageSection has been removed.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSectionUpdateVariantValues/pageSection-update-variant-values.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSectionUpdateVariantValues/pageSection-update-variant-values.test.ts
index cb7e1e732..8d93e4c74 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSectionUpdateVariantValues/pageSection-update-variant-values.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSectionUpdateVariantValues/pageSection-update-variant-values.test.ts
@@ -32,7 +32,6 @@ ruleTester.run("pageSection-update-variant-values", rule, {
errors: [
{
message: `The \`variant\` prop for PageSection now only accepts a value of "default" or "secondary". Running the fix for this rule will remove the prop so it uses the default value of "default".`,
- type: "JSXOpeningElement",
},
],
},
@@ -42,7 +41,6 @@ ruleTester.run("pageSection-update-variant-values", rule, {
errors: [
{
message: `The \`variant\` prop for PageSection now only accepts a value of "default" or "secondary". Running the fix for this rule will remove the prop so it uses the default value of "default".`,
- type: "JSXOpeningElement",
},
],
},
@@ -52,7 +50,6 @@ ruleTester.run("pageSection-update-variant-values", rule, {
errors: [
{
message: `The \`variant\` prop for PageSection now only accepts a value of "default" or "secondary". Running the fix for this rule will remove the prop so it uses the default value of "default".`,
- type: "JSXOpeningElement",
},
],
},
@@ -62,7 +59,6 @@ ruleTester.run("pageSection-update-variant-values", rule, {
errors: [
{
message: `The \`variant\` prop for PageSection now only accepts a value of "default" or "secondary". Running the fix for this rule will remove the prop so it uses the default value of "default".`,
- type: "JSXOpeningElement",
},
],
},
@@ -72,7 +68,6 @@ ruleTester.run("pageSection-update-variant-values", rule, {
errors: [
{
message: `The \`variant\` prop for PageSection now only accepts a value of "default" or "secondary". Running the fix for this rule will remove the prop so it uses the default value of "default".`,
- type: "JSXOpeningElement",
},
],
},
@@ -82,7 +77,6 @@ ruleTester.run("pageSection-update-variant-values", rule, {
errors: [
{
message: `The \`variant\` prop for PageSection now only accepts a value of "default" or "secondary". Running the fix for this rule will remove the prop so it uses the default value of "default".`,
- type: "JSXOpeningElement",
},
],
},
@@ -92,7 +86,6 @@ ruleTester.run("pageSection-update-variant-values", rule, {
errors: [
{
message: `The \`variant\` prop for PageSection now only accepts a value of "default" or "secondary". Running the fix for this rule will remove the prop so it uses the default value of "default".`,
- type: "JSXOpeningElement",
},
],
},
@@ -102,7 +95,6 @@ ruleTester.run("pageSection-update-variant-values", rule, {
errors: [
{
message: `The \`variant\` prop for PageSection now only accepts a value of "default" or "secondary". Running the fix for this rule will remove the prop so it uses the default value of "default".`,
- type: "JSXOpeningElement",
},
],
},
@@ -112,7 +104,6 @@ ruleTester.run("pageSection-update-variant-values", rule, {
errors: [
{
message: `The \`variant\` prop for PageSection now only accepts a value of "default" or "secondary". Running the fix for this rule will remove the prop so it uses the default value of "default".`,
- type: "JSXOpeningElement",
},
],
},
@@ -122,7 +113,6 @@ ruleTester.run("pageSection-update-variant-values", rule, {
errors: [
{
message: `The \`variant\` prop for PageSection now only accepts a value of "default" or "secondary". Running the fix for this rule will remove the prop so it uses the default value of "default".`,
- type: "JSXOpeningElement",
},
],
},
@@ -132,7 +122,6 @@ ruleTester.run("pageSection-update-variant-values", rule, {
errors: [
{
message: `The \`variant\` prop for PageSection now only accepts a value of "default" or "secondary". Running the fix for this rule will remove the prop so it uses the default value of "default".`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSectionUpdateVariantValues/pageSection-update-variant-values.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSectionUpdateVariantValues/pageSection-update-variant-values.ts
index a7d08b0cf..fdcf2707d 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSectionUpdateVariantValues/pageSection-update-variant-values.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSectionUpdateVariantValues/pageSection-update-variant-values.ts
@@ -46,7 +46,7 @@ module.exports = {
const hasPatternFlyEnum =
pageSectionVariantImport &&
variantValueEnum?.object &&
- context.getSourceCode().getText(variantValueEnum.object) ===
+ context.sourceCode.getText(variantValueEnum.object) ===
pageSectionVariantImport.local.name;
if (
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSectionWarnVariantClassesApplied/pageSection-warn-variantClasses-applied.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSectionWarnVariantClassesApplied/pageSection-warn-variantClasses-applied.test.ts
index 7cbec8f75..92c50ea76 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSectionWarnVariantClassesApplied/pageSection-warn-variantClasses-applied.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSectionWarnVariantClassesApplied/pageSection-warn-variantClasses-applied.test.ts
@@ -13,11 +13,10 @@ ruleTester.run("pageSection-warn-variantClasses-applied", rule, {
invalid: [
{
code: `import { PageSection } from '@patternfly/react-core'; `,
- output: `import { PageSection } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `Classes from the \`variant\` prop will now only be applied to PageSection when the \`type\` prop has a value of "default".`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSidebarRemoveThemeProp/pageSidebar-remove-theme-prop.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSidebarRemoveThemeProp/pageSidebar-remove-theme-prop.test.ts
index 3b1700114..e798316d3 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSidebarRemoveThemeProp/pageSidebar-remove-theme-prop.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageSidebarRemoveThemeProp/pageSidebar-remove-theme-prop.test.ts
@@ -17,7 +17,6 @@ ruleTester.run("pageSidebar-remove-theme-prop", rule, {
errors: [
{
message: `The \`theme\` prop has been removed from PageSidebar as theming is no longer handled React-side.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageToggleButtonReplaceBarsIconWithIsHamburgerButton/pageToggleButton-replace-barsIcon-with-isHamburgerButton.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageToggleButtonReplaceBarsIconWithIsHamburgerButton/pageToggleButton-replace-barsIcon-with-isHamburgerButton.test.ts
index 92a5299a6..ea8a033e5 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageToggleButtonReplaceBarsIconWithIsHamburgerButton/pageToggleButton-replace-barsIcon-with-isHamburgerButton.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageToggleButtonReplaceBarsIconWithIsHamburgerButton/pageToggleButton-replace-barsIcon-with-isHamburgerButton.test.ts
@@ -38,7 +38,6 @@ ruleTester.run("pageToggleButton-replace-barsIcon-with-isHamburgerButton", rule,
errors: [
{
message: `The BarsIcon child component should be replaced with the \`isHamburgerButton\` prop on PageToggleButton.`,
- type: "JSXElement",
},
],
},
@@ -48,7 +47,6 @@ ruleTester.run("pageToggleButton-replace-barsIcon-with-isHamburgerButton", rule,
errors: [
{
message: `The BarsIcon child component should be replaced with the \`isHamburgerButton\` prop on PageToggleButton.`,
- type: "JSXElement",
},
],
},
@@ -58,7 +56,6 @@ ruleTester.run("pageToggleButton-replace-barsIcon-with-isHamburgerButton", rule,
errors: [
{
message: `The BarsIcon child component should be replaced with the \`isHamburgerButton\` prop on PageToggleButton.`,
- type: "JSXElement",
},
],
},
@@ -68,7 +65,6 @@ ruleTester.run("pageToggleButton-replace-barsIcon-with-isHamburgerButton", rule,
errors: [
{
message: `The BarsIcon child component should be replaced with the \`isHamburgerButton\` prop on PageToggleButton.`,
- type: "JSXElement",
},
],
},
@@ -78,7 +74,6 @@ ruleTester.run("pageToggleButton-replace-barsIcon-with-isHamburgerButton", rule,
errors: [
{
message: `The BarsIcon child component should be replaced with the \`isHamburgerButton\` prop on PageToggleButton.`,
- type: "JSXElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageToggleButtonReplaceBarsIconWithIsHamburgerButton/pageToggleButton-replace-barsIcon-with-isHamburgerButton.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageToggleButtonReplaceBarsIconWithIsHamburgerButton/pageToggleButton-replace-barsIcon-with-isHamburgerButton.ts
index 5a9c85de5..9ff5cb89a 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageToggleButtonReplaceBarsIconWithIsHamburgerButton/pageToggleButton-replace-barsIcon-with-isHamburgerButton.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageToggleButtonReplaceBarsIconWithIsHamburgerButton/pageToggleButton-replace-barsIcon-with-isHamburgerButton.ts
@@ -13,7 +13,7 @@ import {
module.exports = {
meta: { fixable: "code" },
create: function (context: Rule.RuleContext) {
- const source = context.getSourceCode();
+ const source = context.sourceCode;
const { imports } = getFromPackage(context, "@patternfly/react-core");
const pageToggleButtonImport = imports.find(
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageWarnUpdatedMarkup/page-warn-updated-markup.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageWarnUpdatedMarkup/page-warn-updated-markup.test.ts
index 377fc5d2f..d51fbd105 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/pageWarnUpdatedMarkup/page-warn-updated-markup.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/pageWarnUpdatedMarkup/page-warn-updated-markup.test.ts
@@ -13,71 +13,64 @@ ruleTester.run("page-warn-updated-markup", rule, {
invalid: [
{
code: `import { Page } from '@patternfly/react-core'; `,
- output: `import { Page } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `The markup for Page has changed. When either the \`horizontalSubnav\` or \`breadcrumb\` props are passed, a PageBody component will always wrap the contents.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { Page } from '@patternfly/react-core'; `,
- output: `import { Page } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `The markup for Page has changed. When either the \`horizontalSubnav\` or \`breadcrumb\` props are passed, a PageBody component will always wrap the contents.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { Page } from '@patternfly/react-core'; `,
- output: `import { Page } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `The markup for Page has changed. When either the \`horizontalSubnav\` or \`breadcrumb\` props are passed, a PageBody component will always wrap the contents.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { Page as CustomThing } from '@patternfly/react-core'; `,
- output: `import { Page as CustomThing } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `The markup for Page has changed. When either the \`horizontalSubnav\` or \`breadcrumb\` props are passed, a PageBody component will always wrap the contents.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { Page } from '@patternfly/react-core/dist/esm/components/Page/index.js'; `,
- output: `import { Page } from '@patternfly/react-core/dist/esm/components/Page/index.js'; `,
+ output: null,
errors: [
{
message: `The markup for Page has changed. When either the \`horizontalSubnav\` or \`breadcrumb\` props are passed, a PageBody component will always wrap the contents.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { Page } from '@patternfly/react-core/dist/js/components/Page/index.js'; `,
- output: `import { Page } from '@patternfly/react-core/dist/js/components/Page/index.js'; `,
+ output: null,
errors: [
{
message: `The markup for Page has changed. When either the \`horizontalSubnav\` or \`breadcrumb\` props are passed, a PageBody component will always wrap the contents.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { Page } from '@patternfly/react-core/dist/dynamic/components/Page/index.js'; `,
- output: `import { Page } from '@patternfly/react-core/dist/dynamic/components/Page/index.js'; `,
+ output: null,
errors: [
{
message: `The markup for Page has changed. When either the \`horizontalSubnav\` or \`breadcrumb\` props are passed, a PageBody component will always wrap the contents.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/paginationWarnMarkupChanged/pagination-warn-markup-changed.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/paginationWarnMarkupChanged/pagination-warn-markup-changed.test.ts
index ab1fc0918..11e173f67 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/paginationWarnMarkupChanged/pagination-warn-markup-changed.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/paginationWarnMarkupChanged/pagination-warn-markup-changed.test.ts
@@ -13,61 +13,55 @@ ruleTester.run("pagination-warn-markup-changed", rule, {
invalid: [
{
code: `import { Pagination } from '@patternfly/react-core';`,
- output: `import { Pagination } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The markup for Pagination has changed. There is now a wrapper element rendered around the PaginationOptionsMenu toggle.`,
- type: "ImportSpecifier",
},
],
},
{
code: `import { Pagination as CustomThing } from '@patternfly/react-core';`,
- output: `import { Pagination as CustomThing } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The markup for Pagination has changed. There is now a wrapper element rendered around the PaginationOptionsMenu toggle.`,
- type: "ImportSpecifier",
},
],
},
{
code: `import { Menu, Pagination, Button, Alert } from '@patternfly/react-core';`,
- output: `import { Menu, Pagination, Button, Alert } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The markup for Pagination has changed. There is now a wrapper element rendered around the PaginationOptionsMenu toggle.`,
- type: "ImportSpecifier",
},
],
},
{
code: `import { Pagination } from '@patternfly/react-core/dist/esm/components/Pagination/index.js';`,
- output: `import { Pagination } from '@patternfly/react-core/dist/esm/components/Pagination/index.js';`,
+ output: null,
errors: [
{
message: `The markup for Pagination has changed. There is now a wrapper element rendered around the PaginationOptionsMenu toggle.`,
- type: "ImportSpecifier",
},
],
},
{
code: `import { Pagination } from '@patternfly/react-core/dist/js/components/Pagination/index.js';`,
- output: `import { Pagination } from '@patternfly/react-core/dist/js/components/Pagination/index.js';`,
+ output: null,
errors: [
{
message: `The markup for Pagination has changed. There is now a wrapper element rendered around the PaginationOptionsMenu toggle.`,
- type: "ImportSpecifier",
},
],
},
{
code: `import { Pagination } from '@patternfly/react-core/dist/dynamic/components/Pagination/index.js';`,
- output: `import { Pagination } from '@patternfly/react-core/dist/dynamic/components/Pagination/index.js';`,
+ output: null,
errors: [
{
message: `The markup for Pagination has changed. There is now a wrapper element rendered around the PaginationOptionsMenu toggle.`,
- type: "ImportSpecifier",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/popperUpdateAppendToDefault/popper-update-appendTo-default.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/popperUpdateAppendToDefault/popper-update-appendTo-default.test.ts
index 0bc045944..4a73bf539 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/popperUpdateAppendToDefault/popper-update-appendTo-default.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/popperUpdateAppendToDefault/popper-update-appendTo-default.test.ts
@@ -13,89 +13,79 @@ ruleTester.run("popper-update-appendTo-default", rule, {
invalid: [
{
code: `import { Dropdown } from '@patternfly/react-core';`,
- output: `import { Dropdown } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The default value of appendTo on Dropdown has been updated to \`document.body\`.`,
- type: "ImportSpecifier",
},
],
},
{
code: `import { Dropdown as CustomThing } from '@patternfly/react-core';`,
- output: `import { Dropdown as CustomThing } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The default value of appendTo on Dropdown has been updated to \`document.body\`.`,
- type: "ImportSpecifier",
},
],
},
{
code: `import { Select } from '@patternfly/react-core';`,
- output: `import { Select } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The default value of appendTo on Select has been updated to \`document.body\`.`,
- type: "ImportSpecifier",
},
],
},
{
code: `import { Popper } from '@patternfly/react-core';`,
- output: `import { Popper } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The default value of appendTo on Popper has been updated to \`document.body\`.`,
- type: "ImportSpecifier",
},
],
},
{
code: `import { Dropdown, Select, Popper, Button } from '@patternfly/react-core';`,
- output: `import { Dropdown, Select, Popper, Button } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The default value of appendTo on Dropdown has been updated to \`document.body\`.`,
- type: "ImportSpecifier",
},
{
message: `The default value of appendTo on Select has been updated to \`document.body\`.`,
- type: "ImportSpecifier",
},
{
message: `The default value of appendTo on Popper has been updated to \`document.body\`.`,
- type: "ImportSpecifier",
},
],
},
{
code: `import { Dropdown } from '@patternfly/react-core/dist/esm/components/Dropdown/index.js';`,
- output: `import { Dropdown } from '@patternfly/react-core/dist/esm/components/Dropdown/index.js';`,
+ output: null,
errors: [
{
message: `The default value of appendTo on Dropdown has been updated to \`document.body\`.`,
- type: "ImportSpecifier",
},
],
},
{
code: `import { Dropdown } from '@patternfly/react-core/dist/js/components/Dropdown/index.js';`,
- output: `import { Dropdown } from '@patternfly/react-core/dist/js/components/Dropdown/index.js';`,
+ output: null,
errors: [
{
message: `The default value of appendTo on Dropdown has been updated to \`document.body\`.`,
- type: "ImportSpecifier",
},
],
},
{
code: `import { Dropdown } from '@patternfly/react-core/dist/dynamic/components/Dropdown/index.js';`,
- output: `import { Dropdown } from '@patternfly/react-core/dist/dynamic/components/Dropdown/index.js';`,
+ output: null,
errors: [
{
message: `The default value of appendTo on Dropdown has been updated to \`document.body\`.`,
- type: "ImportSpecifier",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/removeDeprecatedComponents/remove-deprecated-components.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/removeDeprecatedComponents/remove-deprecated-components.test.ts
index 1e6fc9127..e17ccbdfd 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/removeDeprecatedComponents/remove-deprecated-components.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/removeDeprecatedComponents/remove-deprecated-components.test.ts
@@ -23,7 +23,6 @@ function createAllInvalidTests(
[
{
message: createErrorMessage(specifier, baseErrorMessage),
- type: "ImportSpecifier",
},
]
)
@@ -35,7 +34,6 @@ function createAllInvalidTests(
[
{
message: createErrorMessage(specifier, baseErrorMessage),
- type: "ImportSpecifier",
},
]
)
@@ -47,7 +45,6 @@ function createAllInvalidTests(
[
{
message: createErrorMessage(specifier, baseErrorMessage),
- type: "ExportSpecifier",
},
]
)
@@ -59,11 +56,9 @@ function createAllInvalidTests(
[
{
message: createErrorMessage(specifier, baseErrorMessage),
- type: "ImportSpecifier",
},
{
message: createErrorMessage(specifier, baseErrorMessage),
- type: "ExportDefaultDeclaration",
},
]
)
@@ -75,11 +70,9 @@ function createAllInvalidTests(
[
{
message: createErrorMessage(specifier, baseErrorMessage),
- type: "ImportSpecifier",
},
{
message: createErrorMessage(specifier, baseErrorMessage),
- type: "ExportDefaultDeclaration",
},
]
)
@@ -93,7 +86,6 @@ function createAllInvalidTests(
[
{
message: createErrorMessage(specifier, baseErrorMessage),
- type: "ImportSpecifier",
},
]
)
@@ -105,7 +97,6 @@ function createAllInvalidTests(
[
{
message: createErrorMessage(specifier, baseErrorMessage),
- type: "ImportSpecifier",
},
]
)
@@ -117,7 +108,6 @@ function createAllInvalidTests(
[
{
message: createErrorMessage(specifier, baseErrorMessage),
- type: "ImportSpecifier",
},
]
)
@@ -254,25 +244,22 @@ ruleTester.run("remove-deprecated-components", rule, {
...invalidTests,
{
code: `import { ApplicationLauncher, Dropdown, Select, Chip } from '@patternfly/react-core/deprecated';`,
- output: `import { ApplicationLauncher, Dropdown, Select, Chip } from '@patternfly/react-core/deprecated';`,
+ output: null,
errors: [
{
message: createErrorMessage(
"ApplicationLauncher",
componentErrorMessages.appLauncher
),
- type: "ImportSpecifier",
},
{
message: createErrorMessage(
"Dropdown",
componentErrorMessages.dropdown
),
- type: "ImportSpecifier",
},
{
message: createErrorMessage("Select", componentErrorMessages.select),
- type: "ImportSpecifier",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/simpleFileUploadWarnChanges/simpleFileUpload-warn-changes.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/simpleFileUploadWarnChanges/simpleFileUpload-warn-changes.test.ts
index 7f904cf75..eb9f269b3 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/simpleFileUploadWarnChanges/simpleFileUpload-warn-changes.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/simpleFileUploadWarnChanges/simpleFileUpload-warn-changes.test.ts
@@ -16,26 +16,24 @@ ruleTester.run("simpleFileUpload-warn-changes", rule, {
invalid: [
{
code: `import { SimpleFileUpload } from '@patternfly/react-core';`,
- output: `import { SimpleFileUpload } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The \`aria-describedby\` attribute was removed from the TextInput within the SimpleFileUpload, and the \`id\` attribute was removed from the "browse" button. Instead use the new \`browseButtonAriaDescribedby\` prop to provide a description to the browse button.
Additionally, we recommend using our FileUploadHelperText component as a child to the FileUpload, instead of using our FormHelperText (the previous recommendation).`,
- type: "ImportDeclaration",
},
],
},
// Test that a warning only gets flagged once
{
code: `import { SimpleFileUpload } from '@patternfly/react-core'; import { Alert } from '@patternfly/react-core';`,
- output: `import { SimpleFileUpload } from '@patternfly/react-core'; import { Alert } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The \`aria-describedby\` attribute was removed from the TextInput within the SimpleFileUpload, and the \`id\` attribute was removed from the "browse" button. Instead use the new \`browseButtonAriaDescribedby\` prop to provide a description to the browse button.
Additionally, we recommend using our FileUploadHelperText component as a child to the FileUpload, instead of using our FormHelperText (the previous recommendation).`,
- type: "ImportDeclaration",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/sliderStepWarnUpdateMarkup/sliderStep-warn-update-markup.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/sliderStepWarnUpdateMarkup/sliderStep-warn-update-markup.test.ts
index 0e98f4578..62d01b554 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/sliderStepWarnUpdateMarkup/sliderStep-warn-update-markup.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/sliderStepWarnUpdateMarkup/sliderStep-warn-update-markup.test.ts
@@ -10,51 +10,46 @@ ruleTester.run("sliderStep-warn-update-markup", rule, {
invalid: [
{
code: `import { Slider } from '@patternfly/react-core'; `,
- output: `import { Slider } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `The \`--pf-v6-c-slider__step--Left\` CSS variable applied as an inline style to SliderStep has been updated to the \`--pf-v6-c-slider__step--InsetInlineStart\` CSS variable.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { Slider as CustomSlider } from '@patternfly/react-core'; `,
- output: `import { Slider as CustomSlider } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `The \`--pf-v6-c-slider__step--Left\` CSS variable applied as an inline style to SliderStep has been updated to the \`--pf-v6-c-slider__step--InsetInlineStart\` CSS variable.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { Slider } from '@patternfly/react-core/dist/esm/components/Slider/index.js'; `,
- output: `import { Slider } from '@patternfly/react-core/dist/esm/components/Slider/index.js'; `,
+ output: null,
errors: [
{
message: `The \`--pf-v6-c-slider__step--Left\` CSS variable applied as an inline style to SliderStep has been updated to the \`--pf-v6-c-slider__step--InsetInlineStart\` CSS variable.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { Slider } from '@patternfly/react-core/dist/js/components/Slider/index.js'; `,
- output: `import { Slider } from '@patternfly/react-core/dist/js/components/Slider/index.js'; `,
+ output: null,
errors: [
{
message: `The \`--pf-v6-c-slider__step--Left\` CSS variable applied as an inline style to SliderStep has been updated to the \`--pf-v6-c-slider__step--InsetInlineStart\` CSS variable.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { Slider } from '@patternfly/react-core/dist/dynamic/components/Slider/index.js'; `,
- output: `import { Slider } from '@patternfly/react-core/dist/dynamic/components/Slider/index.js'; `,
+ output: null,
errors: [
{
message: `The \`--pf-v6-c-slider__step--Left\` CSS variable applied as an inline style to SliderStep has been updated to the \`--pf-v6-c-slider__step--InsetInlineStart\` CSS variable.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/switchRemoveLabelOff/switch-remove-labelOff.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/switchRemoveLabelOff/switch-remove-labelOff.test.ts
index 90a4840cb..57548a342 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/switchRemoveLabelOff/switch-remove-labelOff.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/switchRemoveLabelOff/switch-remove-labelOff.test.ts
@@ -17,7 +17,6 @@ ruleTester.run("switch-remove-labelOff", rule, {
errors: [
{
message: `The \`labelOff\` prop has been removed from Switch. The label for a Switch should not dynamically update based on the on/off state.`,
- type: "JSXOpeningElement",
},
],
},
@@ -27,7 +26,6 @@ ruleTester.run("switch-remove-labelOff", rule, {
errors: [
{
message: `The \`labelOff\` prop has been removed from Switch. The label for a Switch should not dynamically update based on the on/off state.`,
- type: "JSXOpeningElement",
},
],
},
@@ -37,7 +35,6 @@ ruleTester.run("switch-remove-labelOff", rule, {
errors: [
{
message: `The \`labelOff\` prop has been removed from Switch. The label for a Switch should not dynamically update based on the on/off state.`,
- type: "JSXOpeningElement",
},
],
},
@@ -47,7 +44,6 @@ ruleTester.run("switch-remove-labelOff", rule, {
errors: [
{
message: `The \`labelOff\` prop has been removed from Switch. The label for a Switch should not dynamically update based on the on/off state.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/tabsRenamedIsSecondaryProp/tabs-renamed-isSecondary-prop.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/tabsRenamedIsSecondaryProp/tabs-renamed-isSecondary-prop.test.ts
index 2c89e6b5c..72dcfad69 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/tabsRenamedIsSecondaryProp/tabs-renamed-isSecondary-prop.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/tabsRenamedIsSecondaryProp/tabs-renamed-isSecondary-prop.test.ts
@@ -17,7 +17,6 @@ ruleTester.run("tabs-renamed-isSecondary-prop", rule, {
errors: [
{
message: `The \`isSecondary\` prop for Tabs has been renamed to \`isSubtab\`.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/tabsReplaceVariantLight300/tabs-replace-variant-light300.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/tabsReplaceVariantLight300/tabs-replace-variant-light300.test.ts
index aa170fba9..b86b33070 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/tabsReplaceVariantLight300/tabs-replace-variant-light300.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/tabsReplaceVariantLight300/tabs-replace-variant-light300.test.ts
@@ -17,7 +17,6 @@ ruleTester.run("tabs-replace-variant-light300", rule, {
errors: [
{
message: `The "light300" value for the \`variant\` prop on Tabs has been replaced with the "secondary" value.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/tabsUpdateMarkup/tabs-update-markup.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/tabsUpdateMarkup/tabs-update-markup.test.ts
index ef50f5fe3..046cdf427 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/tabsUpdateMarkup/tabs-update-markup.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/tabsUpdateMarkup/tabs-update-markup.test.ts
@@ -10,11 +10,10 @@ ruleTester.run("tabs-update-markup", rule, {
invalid: [
{
code: `import { Tabs } from '@patternfly/react-core';`,
- output: `import { Tabs } from '@patternfly/react-core';`,
+ output: null,
errors: [
{
message: `The markup for the Tabs scroll buttons has been updated. They are now rendered with a div wrapper, use our Button component, and no longer have adjusted styling when the \`isSubtab\` prop is true.`,
- type: "ImportDeclaration",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/textReplaceWithContent/text-replace-with-content.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/textReplaceWithContent/text-replace-with-content.test.ts
index dc86443a9..e531df9ec 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/textReplaceWithContent/text-replace-with-content.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/textReplaceWithContent/text-replace-with-content.test.ts
@@ -4,19 +4,15 @@ import * as rule from "./text-replace-with-content";
const errorMessage = `We have replaced Text, TextContent, TextList and TextListItem with one Content component. Running this fix will change all of those components names to Content and add a \`component\` prop where necessary.`;
const importDeclarationError = {
message: errorMessage,
- type: "ImportDeclaration",
};
const jsxOpeningElementError = {
message: errorMessage,
- type: "JSXOpeningElement",
};
const jsxClosingElementError = {
message: errorMessage,
- type: "JSXClosingElement",
};
const identifierError = {
message: errorMessage,
- type: "Identifier",
};
ruleTester.run("text-replace-with-content", rule, {
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/thTdWarnUpdateMarkup/Th-Td-warn-update-markup.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/thTdWarnUpdateMarkup/Th-Td-warn-update-markup.test.ts
index 4d3327d12..29f0e6afb 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/thTdWarnUpdateMarkup/Th-Td-warn-update-markup.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/thTdWarnUpdateMarkup/Th-Td-warn-update-markup.test.ts
@@ -19,61 +19,55 @@ ruleTester.run("Th-Td-warn-update-markup", rule, {
invalid: [
{
code: `import { Th } from '@patternfly/react-table'; | `,
- output: `import { Th } from '@patternfly/react-table'; | `,
+ output: null,
errors: [
{
message: `The \`--pf-v6-c-table__sticky-cell--Left\` and \`--pf-v6-c-table__sticky-cell--Right\` CSS variables applied as inline styles have been updated to \`--pf-v6-c-table__sticky-cell--InsetInlineStart\` and \`--pf-v6-c-table__sticky-cell--InsetInlineEnd\`, respectively.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { Th as CustomTh } from '@patternfly/react-table'; `,
- output: `import { Th as CustomTh } from '@patternfly/react-table'; `,
+ output: null,
errors: [
{
message: `The \`--pf-v6-c-table__sticky-cell--Left\` and \`--pf-v6-c-table__sticky-cell--Right\` CSS variables applied as inline styles have been updated to \`--pf-v6-c-table__sticky-cell--InsetInlineStart\` and \`--pf-v6-c-table__sticky-cell--InsetInlineEnd\`, respectively.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { Td } from '@patternfly/react-table'; | `,
- output: `import { Td } from '@patternfly/react-table'; | `,
+ output: null,
errors: [
{
message: `The \`--pf-v6-c-table__sticky-cell--Left\` and \`--pf-v6-c-table__sticky-cell--Right\` CSS variables applied as inline styles have been updated to \`--pf-v6-c-table__sticky-cell--InsetInlineStart\` and \`--pf-v6-c-table__sticky-cell--InsetInlineEnd\`, respectively.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { Th } from '@patternfly/react-table/dist/esm/components/Table/index.js'; | `,
- output: `import { Th } from '@patternfly/react-table/dist/esm/components/Table/index.js'; | `,
+ output: null,
errors: [
{
message: `The \`--pf-v6-c-table__sticky-cell--Left\` and \`--pf-v6-c-table__sticky-cell--Right\` CSS variables applied as inline styles have been updated to \`--pf-v6-c-table__sticky-cell--InsetInlineStart\` and \`--pf-v6-c-table__sticky-cell--InsetInlineEnd\`, respectively.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { Th } from '@patternfly/react-table/dist/js/components/Table/index.js'; | `,
- output: `import { Th } from '@patternfly/react-table/dist/js/components/Table/index.js'; | `,
+ output: null,
errors: [
{
message: `The \`--pf-v6-c-table__sticky-cell--Left\` and \`--pf-v6-c-table__sticky-cell--Right\` CSS variables applied as inline styles have been updated to \`--pf-v6-c-table__sticky-cell--InsetInlineStart\` and \`--pf-v6-c-table__sticky-cell--InsetInlineEnd\`, respectively.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { Th } from '@patternfly/react-table/dist/dynamic/components/Table/index.js'; | `,
- output: `import { Th } from '@patternfly/react-table/dist/dynamic/components/Table/index.js'; | `,
+ output: null,
errors: [
{
message: `The \`--pf-v6-c-table__sticky-cell--Left\` and \`--pf-v6-c-table__sticky-cell--Right\` CSS variables applied as inline styles have been updated to \`--pf-v6-c-table__sticky-cell--InsetInlineStart\` and \`--pf-v6-c-table__sticky-cell--InsetInlineEnd\`, respectively.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/tileDeprecated/tile-deprecated.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/tileDeprecated/tile-deprecated.test.ts
index 7aed6423b..965545a19 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/tileDeprecated/tile-deprecated.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/tileDeprecated/tile-deprecated.test.ts
@@ -14,7 +14,6 @@ ruleTester.run('tile-deprecated', rule, {
errors: [
{
message: `Tile has been deprecated. Running the fix flag will update your imports to our deprecated package, but we suggest using Card instead.`,
- type: 'ImportDeclaration',
},
],
},
@@ -24,7 +23,6 @@ ruleTester.run('tile-deprecated', rule, {
errors: [
{
message: `Tile has been deprecated. Running the fix flag will update your imports to our deprecated package, but we suggest using Card instead.`,
- type: 'ImportDeclaration',
},
],
},
@@ -34,7 +32,6 @@ ruleTester.run('tile-deprecated', rule, {
errors: [
{
message: `Tile has been deprecated. Running the fix flag will update your imports to our deprecated package, but we suggest using Card instead.`,
- type: 'ImportDeclaration',
},
],
},
@@ -44,7 +41,6 @@ ruleTester.run('tile-deprecated', rule, {
errors: [
{
message: `Tile has been deprecated. Running the fix flag will update your imports to our deprecated package, but we suggest using Card instead.`,
- type: 'ImportDeclaration',
},
],
},
@@ -54,7 +50,6 @@ ruleTester.run('tile-deprecated', rule, {
errors: [
{
message: `Tile has been deprecated. Running the fix flag will update your imports to our deprecated package, but we suggest using Card instead.`,
- type: 'ImportDeclaration',
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/tokensPrefixWithT/tokens-prefix-with-t.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/tokensPrefixWithT/tokens-prefix-with-t.test.ts
index 8804954a9..efc88b152 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/tokensPrefixWithT/tokens-prefix-with-t.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/tokensPrefixWithT/tokens-prefix-with-t.test.ts
@@ -22,11 +22,9 @@ ruleTester.run("tokens-prefix-with-t", rule, {
errors: [
{
message,
- type: "ImportSpecifier",
},
{
message,
- type: "Identifier",
},
],
},
@@ -39,7 +37,6 @@ ruleTester.run("tokens-prefix-with-t", rule, {
errors: [
{
message,
- type: "ImportSpecifier",
},
],
},
@@ -52,11 +49,9 @@ ruleTester.run("tokens-prefix-with-t", rule, {
errors: [
{
message,
- type: "ImportSpecifier",
},
{
message,
- type: "Identifier",
},
],
},
@@ -69,11 +64,9 @@ ruleTester.run("tokens-prefix-with-t", rule, {
errors: [
{
message,
- type: "ImportSpecifier",
},
{
message,
- type: "Identifier",
},
],
},
@@ -86,11 +79,9 @@ ruleTester.run("tokens-prefix-with-t", rule, {
errors: [
{
message,
- type: "ImportDefaultSpecifier",
},
{
message,
- type: "Identifier",
},
],
},
@@ -103,11 +94,9 @@ ruleTester.run("tokens-prefix-with-t", rule, {
errors: [
{
message,
- type: "ImportDefaultSpecifier",
},
{
message,
- type: "Identifier",
},
],
},
@@ -120,11 +109,9 @@ ruleTester.run("tokens-prefix-with-t", rule, {
errors: [
{
message,
- type: "ImportDefaultSpecifier",
},
{
message,
- type: "Identifier",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/tokensUpdate/tokens-update.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/tokensUpdate/tokens-update.test.ts
index 183482d72..616774daa 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/tokensUpdate/tokens-update.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/tokensUpdate/tokens-update.test.ts
@@ -27,77 +27,70 @@ ruleTester.run("tokens-warn", rule, {
// WARNINGS - tokens
{
code: `import { c_badge_PaddingLeft } from '@patternfly/react-tokens';`,
- output: `import { c_badge_PaddingLeft } from '@patternfly/react-tokens';`,
+ output: null,
errors: [
{
message: getWarnMessage("c_badge_PaddingLeft"),
- type: "ImportSpecifier",
},
],
},
{
// with alias
code: `import { c_badge_PaddingLeft as badgePL } from '@patternfly/react-tokens';`,
- output: `import { c_badge_PaddingLeft as badgePL } from '@patternfly/react-tokens';`,
+ output: null,
errors: [
{
message: getWarnMessage("c_badge_PaddingLeft"),
- type: "ImportSpecifier",
},
],
},
{
// named import - esm
code: `import { c_badge_PaddingLeft } from '@patternfly/react-tokens/dist/esm/c_badge_PaddingLeft';`,
- output: `import { c_badge_PaddingLeft } from '@patternfly/react-tokens/dist/esm/c_badge_PaddingLeft';`,
+ output: null,
errors: [
{
message: getWarnMessage("c_badge_PaddingLeft"),
- type: "ImportSpecifier",
},
],
},
{
// named import - js
code: `import { c_badge_PaddingLeft } from '@patternfly/react-tokens/dist/js/c_badge_PaddingLeft';`,
- output: `import { c_badge_PaddingLeft } from '@patternfly/react-tokens/dist/js/c_badge_PaddingLeft';`,
+ output: null,
errors: [
{
message: getWarnMessage("c_badge_PaddingLeft"),
- type: "ImportSpecifier",
},
],
},
{
// default import - esm
code: `import c_badge_PaddingLeft from '@patternfly/react-tokens/dist/esm/c_badge_PaddingLeft';`,
- output: `import c_badge_PaddingLeft from '@patternfly/react-tokens/dist/esm/c_badge_PaddingLeft';`,
+ output: null,
errors: [
{
message: getWarnMessage("c_badge_PaddingLeft"),
- type: "ImportDefaultSpecifier",
},
],
},
{
// default import - js
code: `import c_badge_PaddingLeft from '@patternfly/react-tokens/dist/js/c_badge_PaddingLeft';`,
- output: `import c_badge_PaddingLeft from '@patternfly/react-tokens/dist/js/c_badge_PaddingLeft';`,
+ output: null,
errors: [
{
message: getWarnMessage("c_badge_PaddingLeft"),
- type: "ImportDefaultSpecifier",
},
],
},
{
// default import with custom name
code: `import someToken from '@patternfly/react-tokens/dist/esm/c_badge_PaddingLeft';`,
- output: `import someToken from '@patternfly/react-tokens/dist/esm/c_badge_PaddingLeft';`,
+ output: null,
errors: [
{
message: getWarnMessage("c_badge_PaddingLeft"),
- type: "ImportDefaultSpecifier",
},
],
},
@@ -105,21 +98,19 @@ ruleTester.run("tokens-warn", rule, {
// WARNINGS - CSS variables
{
code: `document.documentElement.style.setProperty("--pf-v5-c-button--PaddingTop", "2rem");`,
- output: `document.documentElement.style.setProperty("--pf-v5-c-button--PaddingTop", "2rem");`,
+ output: null,
errors: [
{
message: getWarnMessage("--pf-v5-c-button--PaddingTop"),
- type: "Literal",
},
],
},
{
code: `Some banner
`,
- output: `Some banner
`,
+ output: null,
errors: [
{
message: getWarnMessage("--pf-v5-c-banner--PaddingBottom"),
- type: "Literal",
},
],
},
@@ -136,14 +127,12 @@ ruleTester.run("tokens-warn", rule, {
"global_FontWeight_normal",
"global_font_weight_body_default"
),
- type: "ImportSpecifier",
},
{
message: getFixMessage(
"global_FontWeight_normal",
"global_font_weight_body_default"
),
- type: "Identifier",
},
],
},
@@ -159,7 +148,6 @@ ruleTester.run("tokens-warn", rule, {
"global_FontWeight_normal",
"global_font_weight_body_default"
),
- type: "ImportSpecifier",
},
],
},
@@ -175,14 +163,12 @@ ruleTester.run("tokens-warn", rule, {
"global_FontWeight_normal",
"global_font_weight_body_default"
),
- type: "ImportSpecifier",
},
{
message: getFixMessage(
"global_FontWeight_normal",
"global_font_weight_body_default"
),
- type: "Identifier",
},
],
},
@@ -198,14 +184,12 @@ ruleTester.run("tokens-warn", rule, {
"global_FontWeight_normal",
"global_font_weight_body_default"
),
- type: "ImportSpecifier",
},
{
message: getFixMessage(
"global_FontWeight_normal",
"global_font_weight_body_default"
),
- type: "Identifier",
},
],
},
@@ -221,14 +205,12 @@ ruleTester.run("tokens-warn", rule, {
"global_FontWeight_normal",
"global_font_weight_body_default"
),
- type: "ImportDefaultSpecifier",
},
{
message: getFixMessage(
"global_FontWeight_normal",
"global_font_weight_body_default"
),
- type: "Identifier",
},
],
},
@@ -244,14 +226,12 @@ ruleTester.run("tokens-warn", rule, {
"global_FontWeight_normal",
"global_font_weight_body_default"
),
- type: "ImportDefaultSpecifier",
},
{
message: getFixMessage(
"global_FontWeight_normal",
"global_font_weight_body_default"
),
- type: "Identifier",
},
],
},
@@ -267,14 +247,12 @@ ruleTester.run("tokens-warn", rule, {
"global_FontWeight_normal",
"global_font_weight_body_default"
),
- type: "ImportDefaultSpecifier",
},
{
message: getFixMessage(
"global_FontWeight_normal",
"global_font_weight_body_default"
),
- type: "Identifier",
},
],
},
@@ -289,7 +267,6 @@ ruleTester.run("tokens-warn", rule, {
"--pf-v5-global--ZIndex--lg",
"--pf-t--global--z-index--lg"
),
- type: "Literal",
},
],
},
@@ -302,7 +279,6 @@ ruleTester.run("tokens-warn", rule, {
"--pf-v5-global--BorderWidth--lg",
"--pf-t--global--border--width--extra-strong"
),
- type: "Literal",
},
],
},
@@ -314,7 +290,6 @@ ruleTester.run("tokens-warn", rule, {
errors: [
{
message: getColorFixMessage("global_Color_100"),
- type: "ImportSpecifier",
},
],
},
@@ -325,7 +300,6 @@ ruleTester.run("tokens-warn", rule, {
errors: [
{
message: getColorFixMessage("global_Color_100"),
- type: "ImportSpecifier",
},
],
},
@@ -336,7 +310,6 @@ ruleTester.run("tokens-warn", rule, {
errors: [
{
message: getColorFixMessage("global_Color_100"),
- type: "ImportSpecifier",
},
],
},
@@ -347,7 +320,6 @@ ruleTester.run("tokens-warn", rule, {
errors: [
{
message: getColorFixMessage("global_Color_100"),
- type: "ImportSpecifier",
},
],
},
@@ -358,7 +330,6 @@ ruleTester.run("tokens-warn", rule, {
errors: [
{
message: getColorFixMessage("global_Color_100"),
- type: "ImportDefaultSpecifier",
},
],
},
@@ -369,7 +340,6 @@ ruleTester.run("tokens-warn", rule, {
errors: [
{
message: getColorFixMessage("global_Color_100"),
- type: "ImportDefaultSpecifier",
},
],
},
@@ -380,7 +350,6 @@ ruleTester.run("tokens-warn", rule, {
errors: [
{
message: getColorFixMessage("global_Color_100"),
- type: "ImportDefaultSpecifier",
},
],
},
@@ -392,7 +361,6 @@ ruleTester.run("tokens-warn", rule, {
errors: [
{
message: getColorFixMessage("--pf-v5-global--success-color--200", false),
- type: "Literal",
},
],
},
@@ -402,7 +370,6 @@ ruleTester.run("tokens-warn", rule, {
errors: [
{
message: getColorFixMessage("--pf-v5-global--Color--100", false),
- type: "Literal",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarChipGroupContentRenameComponent/toolbarChipGroupContent-rename-component.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarChipGroupContentRenameComponent/toolbarChipGroupContent-rename-component.test.ts
index 66d987cad..27f91c269 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarChipGroupContentRenameComponent/toolbarChipGroupContent-rename-component.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarChipGroupContentRenameComponent/toolbarChipGroupContent-rename-component.test.ts
@@ -23,7 +23,6 @@ ruleTester.run("toolbarChipGroupContent-rename-component", rule, {
errors: [
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "ImportSpecifier",
},
],
},
@@ -33,7 +32,6 @@ ruleTester.run("toolbarChipGroupContent-rename-component", rule, {
errors: [
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "ExportSpecifier",
},
],
},
@@ -43,11 +41,9 @@ ruleTester.run("toolbarChipGroupContent-rename-component", rule, {
errors: [
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "ImportSpecifier",
},
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "ExportSpecifier",
},
],
},
@@ -57,7 +53,6 @@ ruleTester.run("toolbarChipGroupContent-rename-component", rule, {
errors: [
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "ImportSpecifier",
},
],
},
@@ -67,7 +62,6 @@ ruleTester.run("toolbarChipGroupContent-rename-component", rule, {
errors: [
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "ImportSpecifier",
},
],
},
@@ -77,15 +71,12 @@ ruleTester.run("toolbarChipGroupContent-rename-component", rule, {
errors: [
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "ImportSpecifier",
},
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "JSXIdentifier",
},
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "JSXIdentifier",
},
],
},
@@ -95,11 +86,9 @@ ruleTester.run("toolbarChipGroupContent-rename-component", rule, {
errors: [
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "ImportSpecifier",
},
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "JSXIdentifier",
},
],
},
@@ -109,7 +98,6 @@ ruleTester.run("toolbarChipGroupContent-rename-component", rule, {
errors: [
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "ImportSpecifier",
},
],
},
@@ -119,11 +107,9 @@ ruleTester.run("toolbarChipGroupContent-rename-component", rule, {
errors: [
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "ImportSpecifier",
},
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "Identifier",
},
],
},
@@ -133,7 +119,6 @@ ruleTester.run("toolbarChipGroupContent-rename-component", rule, {
errors: [
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "ImportSpecifier",
},
],
},
@@ -143,7 +128,6 @@ ruleTester.run("toolbarChipGroupContent-rename-component", rule, {
errors: [
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "ImportSpecifier",
},
],
},
@@ -153,7 +137,6 @@ ruleTester.run("toolbarChipGroupContent-rename-component", rule, {
errors: [
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "ImportSpecifier",
},
],
},
@@ -163,7 +146,6 @@ ruleTester.run("toolbarChipGroupContent-rename-component", rule, {
errors: [
{
message: `The ToolbarChipGroupContent component has been renamed to ToolbarLabelGroupContent`,
- type: "ImportSpecifier",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarGroupUpdatedIconButtonGroupVariant/toolbarGroup-updated-variant.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarGroupUpdatedIconButtonGroupVariant/toolbarGroup-updated-variant.test.ts
index 0c601df62..4e9312a57 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarGroupUpdatedIconButtonGroupVariant/toolbarGroup-updated-variant.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarGroupUpdatedIconButtonGroupVariant/toolbarGroup-updated-variant.test.ts
@@ -18,21 +18,21 @@ const oldVariantNames = Object.keys(renames) as (
const validTests: ValidTests = [];
const invalidTests: InvalidTests = [];
+for (const oldName of oldVariantNames) {
+ validTests.push(createValidTest(``));
+ validTests.push(
+ createValidTest(
+ `import { ToolbarGroup } from '@patternfly/react-core'; `
+ )
+ );
+}
for (const component of applicableComponents) {
for (const oldName of oldVariantNames) {
const newName = renames[oldName];
- validTests.push(createValidTest(``));
- validTests.push(
- createValidTest(
- `import { ToolbarGroup } from '@patternfly/react-core'; `
- )
- );
-
const message = `The \`${oldName}\` variant of ${component} has been renamed to \`${newName}\`.`;
const errorObject = {
message,
- type: "JSXOpeningElement",
};
invalidTests.push(
createInvalidTest(
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarItemVariantPropUpdates/toolbarItem-variant-prop-updates.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarItemVariantPropUpdates/toolbarItem-variant-prop-updates.test.ts
index 0d84e27b2..d1c940682 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarItemVariantPropUpdates/toolbarItem-variant-prop-updates.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarItemVariantPropUpdates/toolbarItem-variant-prop-updates.test.ts
@@ -26,7 +26,6 @@ ruleTester.run("toolbarItem-replace-chipGroup-variant", rule, {
errors: [
{
message: `The "chip-group" variant for ToolbarItem has been replaced with "label-group".`,
- type: "JSXOpeningElement",
},
],
},
@@ -36,7 +35,6 @@ ruleTester.run("toolbarItem-replace-chipGroup-variant", rule, {
errors: [
{
message: `The "chip-group" variant for ToolbarItem has been replaced with "label-group".`,
- type: "JSXOpeningElement",
},
],
},
@@ -46,7 +44,6 @@ ruleTester.run("toolbarItem-replace-chipGroup-variant", rule, {
errors: [
{
message: `The "chip-group" variant for ToolbarItem has been replaced with "label-group".`,
- type: "JSXOpeningElement",
},
],
},
@@ -56,7 +53,6 @@ ruleTester.run("toolbarItem-replace-chipGroup-variant", rule, {
errors: [
{
message: `The "chip-group" variant for ToolbarItem has been replaced with "label-group".`,
- type: "MemberExpression",
},
],
},
@@ -66,7 +62,6 @@ ruleTester.run("toolbarItem-replace-chipGroup-variant", rule, {
errors: [
{
message: `The "chip-group" variant for ToolbarItem has been replaced with "label-group".`,
- type: "MemberExpression",
},
],
},
@@ -76,7 +71,6 @@ ruleTester.run("toolbarItem-replace-chipGroup-variant", rule, {
errors: [
{
message: `The "chip-group" variant for ToolbarItem has been replaced with "label-group".`,
- type: "JSXOpeningElement",
},
],
},
@@ -86,7 +80,6 @@ ruleTester.run("toolbarItem-replace-chipGroup-variant", rule, {
errors: [
{
message: `The "chip-group" variant for ToolbarItem has been replaced with "label-group".`,
- type: "JSXOpeningElement",
},
],
},
@@ -96,7 +89,6 @@ ruleTester.run("toolbarItem-replace-chipGroup-variant", rule, {
errors: [
{
message: `The "chip-group" variant for ToolbarItem has been replaced with "label-group".`,
- type: "JSXOpeningElement",
},
],
},
@@ -106,7 +98,6 @@ ruleTester.run("toolbarItem-replace-chipGroup-variant", rule, {
errors: [
{
message: `The "bulk-select" variant for ToolbarItem has been removed.`,
- type: "JSXOpeningElement",
},
],
},
@@ -116,7 +107,6 @@ ruleTester.run("toolbarItem-replace-chipGroup-variant", rule, {
errors: [
{
message: `The "overflow-menu" variant for ToolbarItem has been removed.`,
- type: "JSXOpeningElement",
},
],
},
@@ -126,7 +116,6 @@ ruleTester.run("toolbarItem-replace-chipGroup-variant", rule, {
errors: [
{
message: `The "search-filter" variant for ToolbarItem has been removed.`,
- type: "JSXOpeningElement",
},
],
},
@@ -136,7 +125,6 @@ ruleTester.run("toolbarItem-replace-chipGroup-variant", rule, {
errors: [
{
message: `The "bulk-select" variant for ToolbarItem has been removed.`,
- type: "JSXOpeningElement",
},
],
},
@@ -146,11 +134,9 @@ ruleTester.run("toolbarItem-replace-chipGroup-variant", rule, {
errors: [
{
message: `The "bulk-select" variant for ToolbarItem has been removed.`,
- type: "JSXOpeningElement",
},
{
message: `The "bulk-select" variant for ToolbarItem has been removed.`,
- type: "MemberExpression",
},
],
},
@@ -162,22 +148,19 @@ ruleTester.run("toolbarItem-replace-chipGroup-variant", rule, {
errors: [
{
message: `The "bulk-select" variant for ToolbarItem has been removed.`,
- type: "MemberExpression",
},
{
message: `The "bulk-select" variant for ToolbarItem has been removed.`,
- type: "JSXOpeningElement",
},
],
},
// error without the option to fix
{
code: `import { ToolbarItem, ToolbarItemVariant } from '@patternfly/react-core'; const variant = ToolbarItemVariant["bulk-select"];`,
- output: `import { ToolbarItem, ToolbarItemVariant } from '@patternfly/react-core'; const variant = ToolbarItemVariant["bulk-select"];`,
+ output: null,
errors: [
{
message: `The "bulk-select" variant for ToolbarItem has been removed.`,
- type: "MemberExpression",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarLabelGroupContentUpdatedMarkup/toolbarLabelGroupContent-updated-markup.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarLabelGroupContentUpdatedMarkup/toolbarLabelGroupContent-updated-markup.test.ts
index c0dc2375f..93ff3f1df 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarLabelGroupContentUpdatedMarkup/toolbarLabelGroupContent-updated-markup.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarLabelGroupContentUpdatedMarkup/toolbarLabelGroupContent-updated-markup.test.ts
@@ -16,17 +16,16 @@ const message =
"The markup for ToolbarLabelGruopContent has changed when numberOfFilters is greater than 0, showClearFilterButton is true, or customLabelGroupContent is passed.";
const errorObject = {
message,
- type: "JSXOpeningElement",
};
const validTests: ValidTests = [];
const invalidTests: InvalidTests = [];
+validTests.push(
+ createValidTest(
+ `import { ToolbarLabelGroupContent } from '@patternfly/react-core'; `
+ )
+);
for (const prop of applicableProps) {
validTests.push(createValidTest(``));
- validTests.push(
- createValidTest(
- `import { ToolbarLabelGroupContent } from '@patternfly/react-core'; `
- )
- );
invalidTests.push(
createInvalidTest(
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarRemoveProps/toolbar-remove-props.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarRemoveProps/toolbar-remove-props.test.ts
index 8814cabd6..804525297 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarRemoveProps/toolbar-remove-props.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarRemoveProps/toolbar-remove-props.test.ts
@@ -40,7 +40,6 @@ for (const component in renames) {
[
{
message: createMessage(),
- type: "JSXOpeningElement",
},
]
)
@@ -52,7 +51,6 @@ for (const component in renames) {
[
{
message: createMessage(),
- type: "JSXOpeningElement",
},
]
)
@@ -64,7 +62,6 @@ for (const component in renames) {
[
{
message: createMessage("CustomThing"),
- type: "JSXOpeningElement",
},
]
)
@@ -76,7 +73,6 @@ for (const component in renames) {
[
{
message: createMessage(),
- type: "JSXOpeningElement",
},
]
)
@@ -88,7 +84,6 @@ for (const component in renames) {
[
{
message: createMessage(),
- type: "JSXOpeningElement",
},
]
)
@@ -100,7 +95,6 @@ for (const component in renames) {
[
{
message: createMessage(),
- type: "JSXOpeningElement",
},
]
)
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarRenameChipProps/toolbar-rename-chip-props.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarRenameChipProps/toolbar-rename-chip-props.test.ts
index 49637d4ec..1ab298dcb 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarRenameChipProps/toolbar-rename-chip-props.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarRenameChipProps/toolbar-rename-chip-props.test.ts
@@ -57,7 +57,6 @@ for (const component in renames) {
[
{
message: createMessage(),
- type: "JSXOpeningElement",
},
]
)
@@ -69,7 +68,6 @@ for (const component in renames) {
[
{
message: createMessage(),
- type: "JSXOpeningElement",
},
]
)
@@ -81,7 +79,6 @@ for (const component in renames) {
[
{
message: createMessage("CustomThing"),
- type: "JSXOpeningElement",
},
]
)
@@ -93,7 +90,6 @@ for (const component in renames) {
[
{
message: createMessage(),
- type: "JSXOpeningElement",
},
]
)
@@ -105,7 +101,6 @@ for (const component in renames) {
[
{
message: createMessage(),
- type: "JSXOpeningElement",
},
]
)
@@ -117,7 +112,6 @@ for (const component in renames) {
[
{
message: createMessage(),
- type: "JSXOpeningElement",
},
]
)
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarRenameInterfaces/toolbar-rename-interfaces.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarRenameInterfaces/toolbar-rename-interfaces.test.ts
index 59e4e35f4..7cd0d18f7 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarRenameInterfaces/toolbar-rename-interfaces.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarRenameInterfaces/toolbar-rename-interfaces.test.ts
@@ -36,7 +36,6 @@ for (const previousName in replacementMap) {
[
{
message,
- type: "ImportSpecifier",
},
]
)
@@ -48,7 +47,6 @@ for (const previousName in replacementMap) {
[
{
message,
- type: "ImportSpecifier",
},
]
)
@@ -60,11 +58,9 @@ for (const previousName in replacementMap) {
[
{
message,
- type: "ImportSpecifier",
},
{
message,
- type: "TSTypeReference",
},
]
)
@@ -76,7 +72,6 @@ for (const previousName in replacementMap) {
[
{
message,
- type: "ImportSpecifier",
},
]
)
@@ -88,11 +83,9 @@ for (const previousName in replacementMap) {
[
{
message,
- type: "ImportSpecifier",
},
{
message,
- type: "TSInterfaceHeritage",
},
]
)
@@ -104,7 +97,6 @@ for (const previousName in replacementMap) {
[
{
message,
- type: "ImportSpecifier",
},
]
)
@@ -116,11 +108,9 @@ for (const previousName in replacementMap) {
[
{
message,
- type: "ImportSpecifier",
},
{
message,
- type: "ExportSpecifier",
},
]
)
@@ -132,7 +122,6 @@ for (const previousName in replacementMap) {
[
{
message,
- type: "ExportSpecifier",
},
]
)
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarReplacedSpacerSpaceItems/toolbar-replaced-spacer-spaceItems.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarReplacedSpacerSpaceItems/toolbar-replaced-spacer-spaceItems.test.ts
index 67dfa8661..64848f6c3 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarReplacedSpacerSpaceItems/toolbar-replaced-spacer-spaceItems.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarReplacedSpacerSpaceItems/toolbar-replaced-spacer-spaceItems.test.ts
@@ -12,7 +12,6 @@ const validTests: ValidTests = [];
const invalidTests: InvalidTests = [];
const createErrorObject = (message: string) => ({
message,
- type: "JSXOpeningElement",
});
toolbarComponents.forEach((component) => {
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarUpdateAlignValues/toolbar-update-align-values.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarUpdateAlignValues/toolbar-update-align-values.test.ts
index ad35bdf39..b0e0bf2d4 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarUpdateAlignValues/toolbar-update-align-values.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/toolbarUpdateAlignValues/toolbar-update-align-values.test.ts
@@ -34,7 +34,6 @@ for (const component in componentProps) {
errors: [
{
message: createMessage(),
- type: "JSXOpeningElement",
},
],
},
@@ -44,7 +43,6 @@ for (const component in componentProps) {
errors: [
{
message: createMessage(),
- type: "JSXOpeningElement",
},
],
},
@@ -54,7 +52,6 @@ for (const component in componentProps) {
errors: [
{
message: createMessage(),
- type: "JSXOpeningElement",
},
],
},
@@ -65,7 +62,6 @@ for (const component in componentProps) {
errors: [
{
message: createMessage(),
- type: "JSXOpeningElement",
},
],
},
@@ -76,7 +72,6 @@ for (const component in componentProps) {
errors: [
{
message: createMessage(`Custom${component}`),
- type: "JSXOpeningElement",
},
],
},
@@ -87,7 +82,6 @@ for (const component in componentProps) {
errors: [
{
message: createMessage(),
- type: "JSXOpeningElement",
},
],
},
@@ -98,7 +92,6 @@ for (const component in componentProps) {
errors: [
{
message: createMessage(),
- type: "JSXOpeningElement",
},
],
},
@@ -109,7 +102,6 @@ for (const component in componentProps) {
errors: [
{
message: createMessage(),
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/treeViewWarnSelectableStylingModifierRemoved/treeView-warn-selectable-styling-modifier-removed.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/treeViewWarnSelectableStylingModifierRemoved/treeView-warn-selectable-styling-modifier-removed.test.ts
index 3587b9ade..df1ba880b 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/treeViewWarnSelectableStylingModifierRemoved/treeView-warn-selectable-styling-modifier-removed.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/treeViewWarnSelectableStylingModifierRemoved/treeView-warn-selectable-styling-modifier-removed.test.ts
@@ -10,12 +10,11 @@ ruleTester.run("treeView-warn-selectable-styling-modifier-removed", rule, {
invalid: [
{
code: `import { TreeView } from '@patternfly/react-core'; `,
- output: `import { TreeView } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message:
"Selectable styling attribute (`pf-m-selectable`) has been removed on the list items of the TreeView component. You should update selectors, tests and snapshot tests which are relying on the `pf-m-selectable` class.",
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/userFeedbackWarnChanges/user-feedback-warn-changes.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/userFeedbackWarnChanges/user-feedback-warn-changes.test.ts
index c3d56fada..db2ba1a02 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/userFeedbackWarnChanges/user-feedback-warn-changes.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/userFeedbackWarnChanges/user-feedback-warn-changes.test.ts
@@ -13,31 +13,28 @@ ruleTester.run("user-feedback-warn-changes", rule, {
invalid: [
{
code: `import { FeedbackModal } from '@patternfly/react-user-feedback';`,
- output: `import { FeedbackModal } from '@patternfly/react-user-feedback';`,
+ output: null,
errors: [
{
message: `FeedbackModal no longer internally references a scss stylesheet. You may have to import "Feedback.css" located in the dist "@patternfly/react-user-feedback/dist/esm/Feedback/Feedback.css" to maintain styling on FeedbackModal.`,
- type: "ImportDeclaration",
},
],
},
{
code: `import { FeedbackModal as MyModal } from '@patternfly/react-user-feedback';`,
- output: `import { FeedbackModal as MyModal } from '@patternfly/react-user-feedback';`,
+ output: null,
errors: [
{
message: `FeedbackModal no longer internally references a scss stylesheet. You may have to import "Feedback.css" located in the dist "@patternfly/react-user-feedback/dist/esm/Feedback/Feedback.css" to maintain styling on FeedbackModal.`,
- type: "ImportDeclaration",
},
],
},
{
code: `import myDefaultModal from '@patternfly/react-user-feedback/dist/esm/Feedback/FeedbackModal';`,
- output: `import myDefaultModal from '@patternfly/react-user-feedback/dist/esm/Feedback/FeedbackModal';`,
+ output: null,
errors: [
{
message: `FeedbackModal no longer internally references a scss stylesheet. You may have to import "Feedback.css" located in the dist "@patternfly/react-user-feedback/dist/esm/Feedback/Feedback.css" to maintain styling on FeedbackModal.`,
- type: "ImportDeclaration",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/wizardFooterWarnUpdateMarkup/wizardFooter-warn-update-markup.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/wizardFooterWarnUpdateMarkup/wizardFooter-warn-update-markup.test.ts
index 66fb76943..c480df546 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/wizardFooterWarnUpdateMarkup/wizardFooter-warn-update-markup.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/wizardFooterWarnUpdateMarkup/wizardFooter-warn-update-markup.test.ts
@@ -16,71 +16,64 @@ ruleTester.run("wizardFooter-warn-update-markup", rule, {
invalid: [
{
code: `import { Wizard } from '@patternfly/react-core'; `,
- output: `import { Wizard } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `The default WizardFooter now uses an ActionList wrapped around our Button components, rather than just our Button components.`,
- type: "JSXElement",
},
],
},
{
code: `import { Wizard as CustomWizard } from '@patternfly/react-core'; `,
- output: `import { Wizard as CustomWizard } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `The default WizardFooter now uses an ActionList wrapped around our Button components, rather than just our Button components.`,
- type: "JSXElement",
},
],
},
{
code: `import { Wizard } from '@patternfly/react-core/dist/esm/components/Wizard/index.js'; `,
- output: `import { Wizard } from '@patternfly/react-core/dist/esm/components/Wizard/index.js'; `,
+ output: null,
errors: [
{
message: `The default WizardFooter now uses an ActionList wrapped around our Button components, rather than just our Button components.`,
- type: "JSXElement",
},
],
},
{
code: `import { Wizard } from '@patternfly/react-core/dist/js/components/Wizard/index.js'; `,
- output: `import { Wizard } from '@patternfly/react-core/dist/js/components/Wizard/index.js'; `,
+ output: null,
errors: [
{
message: `The default WizardFooter now uses an ActionList wrapped around our Button components, rather than just our Button components.`,
- type: "JSXElement",
},
],
},
{
code: `import { Wizard } from '@patternfly/react-core/dist/dynamic/components/Wizard/index.js'; `,
- output: `import { Wizard } from '@patternfly/react-core/dist/dynamic/components/Wizard/index.js'; `,
+ output: null,
errors: [
{
message: `The default WizardFooter now uses an ActionList wrapped around our Button components, rather than just our Button components.`,
- type: "JSXElement",
},
],
},
{
code: `import { Wizard } from '@patternfly/react-core'; } />`,
- output: `import { Wizard } from '@patternfly/react-core'; } />`,
+ output: null,
errors: [
{
message: `The default WizardFooter now uses an ActionList wrapped around our Button components, rather than just our Button components.`,
- type: "JSXElement",
},
],
},
{
code: `import { Wizard, WizardStep as CustomStep } from '@patternfly/react-core'; } />`,
- output: `import { Wizard, WizardStep as CustomStep } from '@patternfly/react-core'; } />`,
+ output: null,
errors: [
{
message: `The default WizardFooter now uses an ActionList wrapped around our Button components, rather than just our Button components.`,
- type: "JSXElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/wizardNavItemWarnUpdateMarkup/wizardNavItem-warn-update-markup.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/wizardNavItemWarnUpdateMarkup/wizardNavItem-warn-update-markup.test.ts
index 6f7ea5456..875e556ad 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/wizardNavItemWarnUpdateMarkup/wizardNavItem-warn-update-markup.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/wizardNavItemWarnUpdateMarkup/wizardNavItem-warn-update-markup.test.ts
@@ -13,61 +13,55 @@ ruleTester.run("wizardNavItem-warn-update-markup", rule, {
invalid: [
{
code: `import { WizardNavItem } from '@patternfly/react-core'; `,
- output: `import { WizardNavItem } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `There is now a wrapper element with class \`pf-v6-c-wizard__nav-link-main\` rendered around the nav item content.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { WizardNavItem as CustomNavItem } from '@patternfly/react-core'; `,
- output: `import { WizardNavItem as CustomNavItem } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `There is now a wrapper element with class \`pf-v6-c-wizard__nav-link-main\` rendered around the nav item content.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { WizardNavItem } from '@patternfly/react-core'; `,
- output: `import { WizardNavItem } from '@patternfly/react-core'; `,
+ output: null,
errors: [
{
message: `There is now a wrapper element with class \`pf-v6-c-wizard__nav-link-main\` rendered around the nav item content. Additionally, when the nav item has a status of "error" the icon will be rendered before the item content, and the WizardToggle will also now render an error icon.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { WizardNavItem } from '@patternfly/react-core/dist/esm/components/Wizard/index.js'; `,
- output: `import { WizardNavItem } from '@patternfly/react-core/dist/esm/components/Wizard/index.js'; `,
+ output: null,
errors: [
{
message: `There is now a wrapper element with class \`pf-v6-c-wizard__nav-link-main\` rendered around the nav item content.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { WizardNavItem } from '@patternfly/react-core/dist/js/components/Wizard/index.js'; `,
- output: `import { WizardNavItem } from '@patternfly/react-core/dist/js/components/Wizard/index.js'; `,
+ output: null,
errors: [
{
message: `There is now a wrapper element with class \`pf-v6-c-wizard__nav-link-main\` rendered around the nav item content.`,
- type: "JSXOpeningElement",
},
],
},
{
code: `import { WizardNavItem } from '@patternfly/react-core/dist/dynamic/components/Wizard/index.js'; `,
- output: `import { WizardNavItem } from '@patternfly/react-core/dist/dynamic/components/Wizard/index.js'; `,
+ output: null,
errors: [
{
message: `There is now a wrapper element with class \`pf-v6-c-wizard__nav-link-main\` rendered around the nav item content.`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/wizardStepUpdatedBodyTyping/wizardStep-updated-body-typing.test.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/wizardStepUpdatedBodyTyping/wizardStep-updated-body-typing.test.ts
index 06bb13b1c..974966635 100644
--- a/packages/eslint-plugin-pf-codemods/src/rules/v6/wizardStepUpdatedBodyTyping/wizardStep-updated-body-typing.test.ts
+++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/wizardStepUpdatedBodyTyping/wizardStep-updated-body-typing.test.ts
@@ -20,7 +20,6 @@ ruleTester.run("wizardStep-updated-body-typing", rule, {
errors: [
{
message: `The \`body\` prop on WizardStep no longer accepts a value of "null".`,
- type: "JSXOpeningElement",
},
],
},
@@ -30,7 +29,6 @@ ruleTester.run("wizardStep-updated-body-typing", rule, {
errors: [
{
message: `The \`body\` prop on WizardStep no longer accepts a value of "null".`,
- type: "JSXOpeningElement",
},
],
},
@@ -40,7 +38,6 @@ ruleTester.run("wizardStep-updated-body-typing", rule, {
errors: [
{
message: `The \`body\` prop on WizardStep no longer accepts a value of "null".`,
- type: "JSXOpeningElement",
},
],
},
@@ -50,7 +47,6 @@ ruleTester.run("wizardStep-updated-body-typing", rule, {
errors: [
{
message: `The \`body\` prop on WizardStep no longer accepts a value of "null".`,
- type: "JSXOpeningElement",
},
],
},
@@ -60,7 +56,6 @@ ruleTester.run("wizardStep-updated-body-typing", rule, {
errors: [
{
message: `The \`body\` prop on WizardStep no longer accepts a value of "null".`,
- type: "JSXOpeningElement",
},
],
},
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/accordion-remove-noBoxShadow.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/accordion-remove-noBoxShadow.js
index b5e9bb9e1..6e6d672e0 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/accordion-remove-noBoxShadow.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/accordion-remove-noBoxShadow.js
@@ -17,7 +17,6 @@ ruleTester.run("accordion-remove-noBoxShadow", rule, {
output: `import { Accordion } from '@patternfly/react-core'; `,
errors: [{
message: `noBoxShadow prop has been removed for Accordion. If a shadow is needed, the accordion can be placed in a card, or a shadow can be applied either using CSS or a box-shadow utility class`,
- type: "JSXOpeningElement",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/alert-new-action.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/alert-new-action.js
index f0db98b11..0b69b1649 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/alert-new-action.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/alert-new-action.js
@@ -13,7 +13,6 @@ ruleTester.run("alert-new-action", rule, {
output: `import { Alert } from '@patternfly/react-core'; Close} />`,
errors: [{
message: `action prop for Alert has been replaced with actionLinks or actionClose`,
- type: "JSXOpeningElement",
}]
},
{
@@ -21,7 +20,6 @@ ruleTester.run("alert-new-action", rule, {
output: `import { Alert } from '@patternfly/react-core'; Close} />`,
errors: [{
message: `action prop for Alert has been replaced with actionLinks or actionClose`,
- type: "JSXOpeningElement",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/application-launcher-rename-dropdownItems.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/application-launcher-rename-dropdownItems.js
index 0dcf6cec5..06fb7750b 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/application-launcher-rename-dropdownItems.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/application-launcher-rename-dropdownItems.js
@@ -17,7 +17,6 @@ ruleTester.run("application-launcher-rename-dropdownItems", rule, {
output: `import { ApplicationLauncher } from '@patternfly/react-core'; `,
errors: [{
message: `dropdownItems prop for ApplicationLauncher has been renamed to items`,
- type: "JSXOpeningElement",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/aria-props.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/aria-props.js
index 5db851752..840f71a6c 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/aria-props.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/aria-props.js
@@ -17,7 +17,6 @@ ruleTester.run("aria-props", rule, {
output: `import { AboutModalContainer } from '@patternfly/react-core'; `,
errors: [{
message: `ariaLabelledbyId prop for AboutModalContainer has been renamed to aboutModalBoxHeaderId`,
- type: "JSXOpeningElement",
}]
},
{
@@ -25,7 +24,6 @@ ruleTester.run("aria-props", rule, {
output: `import { WizardNav } from '@patternfly/react-core'; `,
errors: [{
message: `ariaLabel prop for WizardNav has been renamed to aria-label`,
- type: "JSXOpeningElement",
}]
},
{
@@ -33,7 +31,6 @@ ruleTester.run("aria-props", rule, {
output: `import { LoginForm } from '@patternfly/react-core'; `,
errors: [{
message: `rememberMeAriaLabel prop for LoginForm has been removed`,
- type: "JSXOpeningElement",
}]
}
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/background-image-src-enum.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/background-image-src-enum.js
index c04374dd3..3a7bd2fb2 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/background-image-src-enum.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/background-image-src-enum.js
@@ -44,27 +44,21 @@ const images = {
errors: [
{
message: "BackgroundImageSrc.lg has been removed. Use the string 'lg' instead",
- type: "Property",
},
{
message: "BackgroundImageSrc.sm has been removed. Use the string 'sm' instead",
- type: "Property",
},
{
message: "BackgroundImageSrc.sm2x has been removed. Use the string 'sm2x' instead",
- type: "Property",
},
{
message: "BackgroundImageSrc.xs has been removed. Use the string 'xs' instead",
- type: "Property",
},
{
message: "BackgroundImageSrc.xs2x has been removed. Use the string 'xs2x' instead",
- type: "Property",
},
{
message: "BackgroundImageSrc.filter has been removed. If you want a custom filter, use the new filter prop instead",
- type: "Property",
}
]
},
@@ -92,27 +86,21 @@ const images = {
errors: [
{
message: "BackgroundImageSrc.lg has been removed. Use the string 'lg' instead",
- type: "Property",
},
{
message: "BackgroundImageSrc.sm has been removed. Use the string 'sm' instead",
- type: "Property",
},
{
message: "BackgroundImageSrc.sm2x has been removed. Use the string 'sm2x' instead",
- type: "Property",
},
{
message: "BackgroundImageSrc.xs has been removed. Use the string 'xs' instead",
- type: "Property",
},
{
message: "BackgroundImageSrc.xs2x has been removed. Use the string 'xs2x' instead",
- type: "Property",
},
{
message: "BackgroundImageSrc.filter has been removed. If you want a custom filter, use the new filter prop instead",
- type: "Property",
}
]
}
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/card-rename-components.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/card-rename-components.js
index 873509341..94faf954b 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/card-rename-components.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/card-rename-components.js
@@ -59,31 +59,24 @@ ruleTester.run("card-rename-components", rule, {
errors: [
{
message: 'add missing imports CardTitle, CardHeaderMain from @patternfly/react-core',
- type: 'ImportDeclaration'
},
{
message: 'CardHead renamed to CardHeader',
- type: 'JSXIdentifier'
},
{
message: 'CardHeadMain renamed to CardHeaderMain',
- type: 'JSXIdentifier'
},
{
message: 'CardHeadMain renamed to CardHeaderMain',
- type: 'JSXIdentifier'
},
{
message: 'CardHead renamed to CardHeader',
- type: 'JSXIdentifier'
},
{
message: 'CardHeader renamed to CardTitle',
- type: 'JSXIdentifier'
},
{
message: 'CardHeader renamed to CardTitle',
- type: 'JSXIdentifier'
}
]
},
@@ -95,23 +88,18 @@ ruleTester.run("card-rename-components", rule, {
errors: [
{
message: 'add missing imports CardTitle, CardHeaderMain from @patternfly/react-core',
- type: 'ImportDeclaration'
},
{
message: 'CardHead renamed to CardHeader',
- type: 'JSXIdentifier'
},
{
message: 'CardHeadMain renamed to CardHeaderMain',
- type: 'JSXIdentifier'
},
{
message: 'CardHeadMain renamed to CardHeaderMain',
- type: 'JSXIdentifier'
},
{
message: 'CardHead renamed to CardHeader',
- type: 'JSXIdentifier'
}
]
}
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/chart-remove-allowZoom.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/chart-remove-allowZoom.js
index 422d5532e..2b55d2000 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/chart-remove-allowZoom.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/chart-remove-allowZoom.js
@@ -38,15 +38,12 @@ import { VictoryZoomContainer } from 'victory-zoom-container';
errors: [
{
message: `add missing import { VictoryZoomContainer } from 'victory-zoom-container';`,
- type: "ImportDeclaration",
},
{
message: `allowZoom prop for Chart has been replaced with containerComponent={}`,
- type: "JSXOpeningElement",
},
{
message: `allowZoom prop for ChartGroup has been removed`,
- type: "JSXOpeningElement",
}]
},
{
@@ -70,15 +67,12 @@ import { VictoryZoomContainer } from 'victory-zoom-container';
errors: [
{
message: `add missing import { VictoryZoomContainer } from 'victory-zoom-container';`,
- type: "ImportDeclaration",
},
{
message: `allowZoom prop for Chart has been replaced with containerComponent={}`,
- type: "JSXOpeningElement",
},
{
message: `allowZoom prop for ChartGroup has been removed`,
- type: "JSXOpeningElement",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/chartVoronoiContainer-remove-allowTooltip.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/chartVoronoiContainer-remove-allowTooltip.js
index 5218625b5..847d7f214 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/chartVoronoiContainer-remove-allowTooltip.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/chartVoronoiContainer-remove-allowTooltip.js
@@ -13,7 +13,6 @@ ruleTester.run("chartVoronoiContainer-remove-allowTooltip", rule, {
output: `import { ChartVoronoiContainer } from '@patternfly/react-charts'; `,
errors: [{
message: `allowTooltip prop for ChartVoronoiContainer has been removed`,
- type: "JSXOpeningElement",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/chipgroup-remove-chipbutton.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/chipgroup-remove-chipbutton.js
index 5a8ae7d60..843f278c7 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/chipgroup-remove-chipbutton.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/chipgroup-remove-chipbutton.js
@@ -17,15 +17,12 @@ ruleTester.run("chipgroup-remove-chipbutton", rule, {
errors: [
{
message: `add missing imports Button from @patternfly/react-core`,
- type: "ImportDeclaration",
},
{
message: `ChipButton has been replaced with Button`,
- type: "JSXIdentifier",
},
{
message: `ChipButton has been replaced with Button`,
- type: "JSXIdentifier",
},
]
},
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/chipgroup-remove-chipgrouptoolbaritem.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/chipgroup-remove-chipgrouptoolbaritem.js
index c5c68db34..c16116fa8 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/chipgroup-remove-chipgrouptoolbaritem.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/chipgroup-remove-chipgrouptoolbaritem.js
@@ -37,7 +37,6 @@ ruleTester.run("chipgroup-remove-chipgrouptoolbaritem", rule, {
`,
errors: [{
message: `ChipGroupToolbarItem has been removed, move its props up to parent ChipGroup and remove it`,
- type: "JSXElement",
}]
},
{
@@ -52,25 +51,13 @@ ruleTester.run("chipgroup-remove-chipgrouptoolbaritem", rule, {
`,
- output: `import { ChipGroup, ChipGroupToolbarItem } from '@patternfly/react-core';
-
-
- Item
-
- Another item
-
-
-
-
-`,
+ output: null,
errors: [
{
message: `ChipGroupToolbarItem has been removed, move its props up to parent ChipGroup and remove it`,
- type: "JSXElement",
},
{
message: `ChipGroupToolbarItem has been removed, move its props up to parent ChipGroup and remove it`,
- type: "JSXElement",
}
]
},
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/chipgroup-remove-props.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/chipgroup-remove-props.js
index 7a7b10cb1..0c35b7df2 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/chipgroup-remove-props.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/chipgroup-remove-props.js
@@ -14,7 +14,6 @@ ruleTester.run("chipgroup-remove-props", rule, {
errors: [
{
message: `withToolbar has been removed from ChipGroup. Add the categoryName prop instead for a category.`,
- type: "JSXOpeningElement",
},
]
},
@@ -24,7 +23,6 @@ ruleTester.run("chipgroup-remove-props", rule, {
errors: [
{
message: `headingLevel has been removed from ChipGroup since the category name is now a `,
- type: "JSXOpeningElement",
},
]
},
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/datatoolbar-rename-toolbar.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/datatoolbar-rename-toolbar.js
index 57d29666a..6ac5a7780 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/datatoolbar-rename-toolbar.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/datatoolbar-rename-toolbar.js
@@ -29,51 +29,39 @@ ruleTester.run("datatoolbar-rename-toolbar", rule, {
errors: [
{
message: `DataToolbar has been replaced with Toolbar`,
- type: "ImportSpecifier",
},
{
message: `DataToolbarContent has been replaced with ToolbarContent`,
- type: "ImportSpecifier",
},
{
message: `DataToolbarGroup has been replaced with ToolbarGroup`,
- type: "ImportSpecifier",
},
{
message: `DataToolbarItem has been replaced with ToolbarItem`,
- type: "ImportSpecifier",
},
{
message: `DataToolbar has been replaced with Toolbar`,
- type: "JSXIdentifier",
},
{
message: `DataToolbarContent has been replaced with ToolbarContent`,
- type: "JSXIdentifier",
},
{
message: `DataToolbarGroup has been replaced with ToolbarGroup`,
- type: "JSXIdentifier",
},
{
message: `DataToolbarItem has been replaced with ToolbarItem`,
- type: "JSXIdentifier",
},
{
message: `DataToolbarItem has been replaced with ToolbarItem`,
- type: "JSXIdentifier",
},
{
message: `DataToolbarGroup has been replaced with ToolbarGroup`,
- type: "JSXIdentifier",
},
{
message: `DataToolbarContent has been replaced with ToolbarContent`,
- type: "JSXIdentifier",
},
{
message: `DataToolbar has been replaced with Toolbar`,
- type: "JSXIdentifier",
}
]
},
@@ -84,7 +72,6 @@ ruleTester.run("datatoolbar-rename-toolbar", rule, {
`,
errors: [{
message: `DataToolbar has been replaced with Toolbar`,
- type: "ImportSpecifier",
}]
}
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/dropdown-rename-icon.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/dropdown-rename-icon.js
index eab9f5e55..d103eccb5 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/dropdown-rename-icon.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/dropdown-rename-icon.js
@@ -22,7 +22,6 @@ ruleTester.run("dropdown-rename-icon", rule, {
`,
errors: [{
message: `variant="icon" has been removed from DropdownItem, use icon={} instead`,
- type: "JSXElement",
}]
},
{
@@ -43,7 +42,6 @@ ruleTester.run("dropdown-rename-icon", rule, {
`,
errors: [{
message: `variant="icon" has been removed from DropdownItem, use icon={} instead`,
- type: "JSXElement",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/dropdown-toggle-rename-iconComponent.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/dropdown-toggle-rename-iconComponent.js
index cd4fcd9f4..203cd53ef 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/dropdown-toggle-rename-iconComponent.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/dropdown-toggle-rename-iconComponent.js
@@ -13,7 +13,6 @@ ruleTester.run("dropdown-toggle-rename-iconComponent", rule, {
output: `import { DropdownToggle } from '@patternfly/react-core'; `,
errors: [{
message: `iconComponent prop for DropdownToggle has been renamed to toggleIndicator`,
- type: "JSXOpeningElement",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/empty-state-icon-removed-props.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/empty-state-icon-removed-props.js
index 0c9e1366f..ebce9564d 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/empty-state-icon-removed-props.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/empty-state-icon-removed-props.js
@@ -14,11 +14,9 @@ ruleTester.run("empty-state-icon-removed-props", rule, {
errors: [
{
message: `Removed prop size from EmptyStateIcon. Use the icon prop instead.`,
- type: "JSXOpeningElement",
},
{
message: `Removed prop title from EmptyStateIcon. Use the icon prop instead.`,
- type: "JSXOpeningElement",
},
]
},
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/expandable-rename-expandablesection.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/expandable-rename-expandablesection.js
index ece33cdf3..018728b2f 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/expandable-rename-expandablesection.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/expandable-rename-expandablesection.js
@@ -21,15 +21,12 @@ ruleTester.run("expandable-rename-expandablesection", rule, {
errors: [
{
message: `add missing imports ExpandableSection from @patternfly/react-core`,
- type: "ImportDeclaration",
},
{
message: 'Expandable has been replaced with ExpandableSection',
- type: "JSXIdentifier"
},
{
message: 'Expandable has been replaced with ExpandableSection',
- type: "JSXIdentifier"
}
]
},
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/form-fix-isValid.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/form-fix-isValid.js
index 944395f62..a1015f2f3 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/form-fix-isValid.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/form-fix-isValid.js
@@ -13,7 +13,6 @@ ruleTester.run("form-fix-isValid", rule, {
output: `import { FormGroup } from '@patternfly/react-core'; `,
errors: [{
message: `isValid prop has been replaced with validated={'default' | 'error' | 'success'}`,
- type: "JSXOpeningElement",
}]
},
{
@@ -21,7 +20,6 @@ ruleTester.run("form-fix-isValid", rule, {
output: `import { FormGroup } from '@patternfly/react-core'; `,
errors: [{
message: `isValid prop has been replaced with validated={'default' | 'error' | 'success'}`,
- type: "JSXOpeningElement",
}]
},
{
@@ -29,7 +27,6 @@ ruleTester.run("form-fix-isValid", rule, {
output: `import { FormGroup } from '@patternfly/react-core'; `,
errors: [{
message: `isValid prop has been replaced with validated={'default' | 'error' | 'success'}`,
- type: "JSXOpeningElement",
}]
},
{
@@ -37,7 +34,6 @@ ruleTester.run("form-fix-isValid", rule, {
output: `import { FormGroup } from '@patternfly/react-core'; `,
errors: [{
message: `isValid prop has been replaced with validated={'default' | 'error' | 'success'}`,
- type: "JSXOpeningElement",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/global-background-color.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/global-background-color.js
index 41649f32f..faa0ee1bf 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/global-background-color.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/global-background-color.js
@@ -13,7 +13,6 @@ ruleTester.run("global-background-color", rule, {
output: `import { global_BackgroundColor_200 as global_BackgroundColor_300 } from '@patternfly/react-tokens'; const a = global_BackgroundColor_300;`,
errors: [{
message: `global_BackgroundColor_300 has been removed. Consider using global_BackgroundColor_200 with its new value #f0f0f0 instead`,
- type: "ImportDeclaration",
}]
},
{
@@ -21,7 +20,6 @@ ruleTester.run("global-background-color", rule, {
output: `import { global_BackgroundColor_200 as global_BackgroundColor_150 } from '@patternfly/react-tokens'; const a = global_BackgroundColor_150;`,
errors: [{
message: `global_BackgroundColor_150 has been removed. Consider using global_BackgroundColor_200 with its new value #f0f0f0 instead`,
- type: "ImportDeclaration",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/label-remove-isCompact.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/label-remove-isCompact.js
index 0a1319504..176d4bb79 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/label-remove-isCompact.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/label-remove-isCompact.js
@@ -3,9 +3,6 @@ const rule = require('../../../lib/rules/v4/label-remove-isCompact');
ruleTester.run("label-remove-isCompact", rule, {
valid: [
- {
- code: ``,
- },
{
code: ``,
}
@@ -16,7 +13,6 @@ ruleTester.run("label-remove-isCompact", rule, {
output: `import { Label } from '@patternfly/react-core'; `,
errors: [{
message: `isCompact prop for Label has been removed`,
- type: "JSXOpeningElement",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/modal-remove-props.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/modal-remove-props.js
index f46f680af..2f3cd8768 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/modal-remove-props.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/modal-remove-props.js
@@ -17,7 +17,6 @@ ruleTester.run("modal-remove-props", rule, {
output: `import { Modal } from '@patternfly/react-core'; `,
errors: [{
message: `isFooterLeftAligned prop for Modal has been removed`,
- type: "JSXOpeningElement",
}]
},
{
@@ -25,7 +24,6 @@ ruleTester.run("modal-remove-props", rule, {
output: `import { Modal } from '@patternfly/react-core'; `,
errors: [{
message: `hideTitle prop for Modal has been removed`,
- type: "JSXOpeningElement",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/modal-variant.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/modal-variant.js
index a92941edc..7e5e5781a 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/modal-variant.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/modal-variant.js
@@ -17,7 +17,6 @@ ruleTester.run("modal-variant", rule, {
output: `import { Modal } from '@patternfly/react-core'; `,
errors: [{
message: `isLarge prop for Modal has been replaced with variant="large"`,
- type: "JSXOpeningElement",
}]
},
{
@@ -25,7 +24,6 @@ ruleTester.run("modal-variant", rule, {
output: `import { Modal } from '@patternfly/react-core'; `,
errors: [{
message: `isSmall prop for Modal has been replaced with variant="small"`,
- type: "JSXOpeningElement",
}]
}
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/nav-list-variant.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/nav-list-variant.js
index 435f0fa98..6a0c71a9d 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/nav-list-variant.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/nav-list-variant.js
@@ -45,7 +45,6 @@ ruleTester.run("nav-list-variant", rule, {
navListName: navListName,
variantVal: variant.default
},
- type: "JSXElement",
}]
},
{
@@ -67,7 +66,6 @@ ruleTester.run("nav-list-variant", rule, {
navListName: navListName,
variantVal: variant.tertiary
},
- type: "JSXElement",
}]
},
{
@@ -89,7 +87,6 @@ ruleTester.run("nav-list-variant", rule, {
navListName: navListName,
variantVal: variant.horizontal
},
- type: "JSXElement",
}]
},
{
@@ -111,7 +108,6 @@ ruleTester.run("nav-list-variant", rule, {
navListName: navListName,
variantVal: variant.all
},
- type: "JSXElement",
}]
},
{
@@ -129,7 +125,6 @@ ruleTester.run("nav-list-variant", rule, {
navListName: navListName,
variantVal: variant.all
},
- type: "JSXElement",
}]
},
{
@@ -147,7 +142,6 @@ ruleTester.run("nav-list-variant", rule, {
navListName: navListName,
variantVal: variant.horizontal
},
- type: "JSXElement",
}]
},
{
@@ -161,7 +155,6 @@ ruleTester.run("nav-list-variant", rule, {
`,
errors: [{
messageId: "removeNavListSimpleVariant",
- type: "JSXElement",
}]
},
{
@@ -179,7 +172,6 @@ ruleTester.run("nav-list-variant", rule, {
`,
errors: [{
messageId: "removeNavListSimpleVariant",
- type: "JSXElement",
}]
},
{
@@ -201,7 +193,6 @@ ruleTester.run("nav-list-variant", rule, {
navListName: navListName,
variantVal: `variant="tertiary"`
},
- type: "JSXElement",
}]
}
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/no-experimental-imports.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/no-experimental-imports.js
index c40ebb4ba..dc683f694 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/no-experimental-imports.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/no-experimental-imports.js
@@ -13,7 +13,6 @@ ruleTester.run("no-experimental-imports", rule, {
output: `import { Divider } from '@patternfly/react-core';`,
errors: [{
message: `Experimental imports have been removed. Import directly from @patternfly/react-core instead`,
- type: "ImportDeclaration",
}]
}
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/no-unused-imports.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/no-unused-imports.js
index 9987729a5..3e2cd3468 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/no-unused-imports.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/no-unused-imports.js
@@ -13,7 +13,6 @@ ruleTester.run("no-unused-imports", rule, {
output: `import { Nav } from '@patternfly/react-core'; `,
errors: [{
message: `unused patternfly import NavVariants`,
- type: "ImportDeclaration",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/page-header-move-avatar.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/page-header-move-avatar.js
index 35cde5ebe..9cdf901e3 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/page-header-move-avatar.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/page-header-move-avatar.js
@@ -18,7 +18,6 @@ ruleTester.run("page-header-move-avatar", rule, {
errors: [
{
message: 'avatar prop was removed from PageHeader, move the avatar component into PageHeaderTools',
- type: 'JSXElement'
}
]
},
@@ -28,7 +27,6 @@ ruleTester.run("page-header-move-avatar", rule, {
errors: [
{
message: 'avatar prop was removed from PageHeader, move the avatar component into PageHeaderTools',
- type: 'JSXElement'
}
]
},
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/page-header-prop-rename.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/page-header-prop-rename.js
index e81b18008..68b74fdd6 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/page-header-prop-rename.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/page-header-prop-rename.js
@@ -16,7 +16,6 @@ ruleTester.run("page-header-prop-rename", rule, {
output: `import { PageHeader } from '@patternfly/react-core'; `,
errors: [{
message: `toolbar prop for PageHeader has been renamed to headerTools`,
- type: "JSXOpeningElement",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/pagination-removed-variant.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/pagination-removed-variant.js
index 4b3b645df..43d5a1a30 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/pagination-removed-variant.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/pagination-removed-variant.js
@@ -16,7 +16,6 @@ ruleTester.run("pagination-removed-variant", rule, {
output: `import { Pagination } from '@patternfly/react-core'; `,
errors: [{
message: `variant "left" has been removed from Pagination`,
- type: "JSXOpeningElement",
}]
},
{
@@ -24,7 +23,6 @@ ruleTester.run("pagination-removed-variant", rule, {
output: `import { Pagination } from '@patternfly/react-core'; `,
errors: [{
message: `variant "right" has been removed from Pagination`,
- type: "JSXOpeningElement",
}]
},
{
@@ -32,7 +30,6 @@ ruleTester.run("pagination-removed-variant", rule, {
output: `import { Pagination, PaginationVariant } from '@patternfly/react-core'; `,
errors: [{
message: `variant {PaginationVariant.right} has been removed from Pagination`,
- type: "JSXOpeningElement",
}]
}
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/progress-remove-info-variant.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/progress-remove-info-variant.js
index 8acaab62f..21a19d763 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/progress-remove-info-variant.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/progress-remove-info-variant.js
@@ -17,7 +17,6 @@ ruleTester.run("progress-remove-info-variant", rule, {
output: `import { Progress } from '@patternfly/react-core'; `,
errors: [{
message: `info variant which adds no styling has been removed for Progress. Don't pass this prop`,
- type: "JSXOpeningElement",
}]
},
{
@@ -25,7 +24,6 @@ ruleTester.run("progress-remove-info-variant", rule, {
output: `import { Progress, ProgressVariant } from '@patternfly/react-core'; `,
errors: [{
message: `info variant which adds no styling has been removed for Progress. Don't pass this prop`,
- type: "JSXOpeningElement",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/react-icons-remove-icon.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/react-icons-remove-icon.js
index 339720afa..289b745e2 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/react-icons-remove-icon.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/react-icons-remove-icon.js
@@ -15,11 +15,9 @@ import { fontAwesomeLogoFull } from '@fortawesome/free-regular-svg-icons';`,
errors: [
{
message: `add missing import { fontAwesomeLogoFull } from '@fortawesome/free-regular-svg-icons';`,
- type: "ImportDeclaration",
},
{
message: `Removed OutlinedFontAwesomeLogoFullIcon. Import it from @FortAwesome instead.`,
- type: "ImportSpecifier",
}
]
},
@@ -30,7 +28,6 @@ import { fontAwesomeLogoFull } from '@fortawesome/free-regular-svg-icons';`,
import { fontAwesomeLogoFull } from '@fortawesome/free-regular-svg-icons';`,
errors: [{
message: `Removed OutlinedFontAwesomeLogoFullIcon. Import it from @FortAwesome instead.`,
- type: "ImportSpecifier",
}]
},
{
@@ -41,11 +38,9 @@ import { anotherIcon, fontAwesomeLogoFull } from '@fortawesome/free-regular-svg-
errors: [
{
message: `Removed OutlinedFontAwesomeLogoFullIcon. Import it from @FortAwesome instead.`,
- type: "ImportSpecifier",
},
{
message: `add missing import { fontAwesomeLogoFull } from '@fortawesome/free-regular-svg-icons';`,
- type: "ImportDeclaration",
}
]
},
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/refactor-breakpointmods.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/refactor-breakpointmods.js
index d52502939..c83cca718 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/refactor-breakpointmods.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/refactor-breakpointmods.js
@@ -47,11 +47,9 @@ ruleTester.run("refactor-breakpointmods", rule, {
errors: [
{
message: `Removed breakpointMods prop from Flex in favor of spacer, spaceItems, grow, shrink, flex, direction, alignItems, alignContent, alignSelf, align, justifyContent, display, fullWidth and flexWrap`,
- type: "JSXOpeningElement",
},
{
message: `Removed breakpointMods prop from FlexItem in favor of spacer, grow, shrink, flex, alignSelf, align, and fullWidth`,
- type: "JSXOpeningElement",
},
]
},
@@ -62,7 +60,6 @@ ruleTester.run("refactor-breakpointmods", rule, {
`,
errors: [{
message: `hasNoPadding prop on PageSection component removed in favor of padding={{ default: 'noPadding' }}`,
- type: "JSXOpeningElement",
}]
},
{
@@ -76,7 +73,6 @@ ruleTester.run("refactor-breakpointmods", rule, {
`,
errors: [{
message: `Removed breakpointMods prop from ToolbarItem in favor of visiblity, alignment, and spacer`,
- type: "JSXOpeningElement",
}]
},
{
@@ -90,11 +86,9 @@ ruleTester.run("refactor-breakpointmods", rule, {
errors: [
{
message: `breakpoint prop on ToolbarToggleGroup removed in favor of show={{ xl: 'show' }}`,
- type: "JSXOpeningElement",
},
{
message: `Removed breakpointMods prop from ToolbarToggleGroup in favor of visiblity, alignment, spacer, and spaceItems`,
- type: "JSXOpeningElement",
}
]
},
@@ -105,7 +99,6 @@ ruleTester.run("refactor-breakpointmods", rule, {
`,
errors: [ {
message: `Removed breakpointMods prop from Flex in favor of spacer, spaceItems, grow, shrink, flex, direction, alignItems, alignContent, alignSelf, align, justifyContent, display, fullWidth and flexWrap`,
- type: "JSXOpeningElement",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/remove-gutter-size.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/remove-gutter-size.js
index 677475983..3a61423e8 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/remove-gutter-size.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/remove-gutter-size.js
@@ -17,7 +17,6 @@ ruleTester.run("remove-gutter-size", rule, {
output: `import { Gallery } from '@patternfly/react-core'; `,
errors: [{
message: "gutter prop for Gallery has been replaced with hasGutter",
- type: "JSXOpeningElement",
}]
}
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/remove-isPseudo-props.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/remove-isPseudo-props.js
index cece49bc0..4de217b0d 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/remove-isPseudo-props.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/remove-isPseudo-props.js
@@ -14,11 +14,9 @@ ruleTester.run("remove-isPseudo-props", rule, {
errors: [
{
message: `isHover prop for Button has been removed`,
- type: "JSXOpeningElement",
},
{
message: `isFocus prop for Button has been removed`,
- type: "JSXOpeningElement",
},
]
},
@@ -28,11 +26,9 @@ ruleTester.run("remove-isPseudo-props", rule, {
errors: [
{
message: `isHovered prop for ContextSelectorToggle has been removed`,
- type: "JSXOpeningElement",
},
{
message: `isFocused prop for ContextSelectorToggle has been removed`,
- type: "JSXOpeningElement",
},
]
}
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/rename-noPadding.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/rename-noPadding.js
index 0d937c246..a0a35eac0 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/rename-noPadding.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/rename-noPadding.js
@@ -13,7 +13,6 @@ ruleTester.run("rename-noPadding", rule, {
output: `import { DataListContent } from '@patternfly/react-core'; `,
errors: [{
message: `noPadding prop for DataListContent has been renamed to hasNoPadding`,
- type: "JSXOpeningElement",
}]
},
{
@@ -21,7 +20,6 @@ ruleTester.run("rename-noPadding", rule, {
output: `import { DrawerHead } from '@patternfly/react-core'; `,
errors: [{
message: `noPadding prop for DrawerHead has been renamed to hasNoPadding`,
- type: "JSXOpeningElement",
}]
},
{
@@ -29,7 +27,6 @@ ruleTester.run("rename-noPadding", rule, {
output: `import { DrawerPanelBody } from '@patternfly/react-core'; `,
errors: [{
message: `noPadding prop for DrawerPanelBody has been renamed to hasNoPadding`,
- type: "JSXOpeningElement",
}]
},
{
@@ -37,7 +34,6 @@ ruleTester.run("rename-noPadding", rule, {
output: `import { PageSection } from '@patternfly/react-core'; `,
errors: [{
message: `noPadding prop for PageSection has been renamed to hasNoPadding`,
- type: "JSXOpeningElement",
}]
},
]
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/rename-toolbar-components.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/rename-toolbar-components.js
index 5437ecb24..27ae835b6 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/rename-toolbar-components.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/rename-toolbar-components.js
@@ -63,27 +63,21 @@ ruleTester.run("rename-toolbar-components", rule, {
errors: [
{
message: `add missing imports PageHeaderTools, PageHeaderToolsGroup, PageHeaderToolsItem from @patternfly/react-core`,
- type: "ImportDeclaration",
},
{
message: `Toolbar has been replaced with PageHeaderTools`,
- type: "JSXIdentifier",
},
{
message: `ToolbarGroup has been replaced with PageHeaderToolsGroup`,
- type: "JSXIdentifier",
},
{
message: `ToolbarItem has been replaced with PageHeaderToolsItem`,
- type: "JSXIdentifier",
},
{
message: `ToolbarGroup has been replaced with PageHeaderToolsGroup`,
- type: "JSXIdentifier",
},
{
message: `Toolbar has been replaced with PageHeaderTools`,
- type: "JSXIdentifier",
},
]
},
diff --git a/packages/eslint-plugin-pf-codemods/test/rules/v4/select-rename-checkbox.js b/packages/eslint-plugin-pf-codemods/test/rules/v4/select-rename-checkbox.js
index 23c8f8746..7068e4b20 100644
--- a/packages/eslint-plugin-pf-codemods/test/rules/v4/select-rename-checkbox.js
+++ b/packages/eslint-plugin-pf-codemods/test/rules/v4/select-rename-checkbox.js
@@ -18,11 +18,9 @@ ruleTester.run("select-rename-checkbox", rule, {
errors: [
{
message: `CheckboxSelect has been removed. Use