diff --git a/.changeset/happy-fireants-mate.md b/.changeset/happy-fireants-mate.md
new file mode 100644
index 00000000000..7ba1f1375bc
--- /dev/null
+++ b/.changeset/happy-fireants-mate.md
@@ -0,0 +1,5 @@
+---
+'@primer/react': major
+---
+
+Remove temporary folders for TypeScript resolution of sub-paths
diff --git a/packages/react/codemods/.eslintrc.js b/packages/react/codemods/.eslintrc.js
deleted file mode 100644
index fba95be8273..00000000000
--- a/packages/react/codemods/.eslintrc.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict'
-
-module.exports = {
- rules: {
- 'github/array-foreach': 'off',
- },
- ignorePatterns: ['**/__testfixtures__/**'],
-}
diff --git a/packages/react/codemods/__tests__/deprecateUtilityComponents.js b/packages/react/codemods/__tests__/deprecateUtilityComponents.js
deleted file mode 100644
index c7cda752fe3..00000000000
--- a/packages/react/codemods/__tests__/deprecateUtilityComponents.js
+++ /dev/null
@@ -1,200 +0,0 @@
-import {defineInlineTest} from 'jscodeshift/dist/testUtils'
-import deprecateUtilityComponents from '../deprecateUtilityComponents'
-
-defineInlineTest(
- deprecateUtilityComponents,
- {},
- `
-import {Flex} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- `
-import {Box} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- 'deprecateUtilityComponents',
-)
-
-defineInlineTest(
- deprecateUtilityComponents,
- {},
- `
-import {Grid} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- `
-import {Box} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- 'deprecateUtilityComponents',
-)
-
-defineInlineTest(
- deprecateUtilityComponents,
- {},
- `
-import {Position} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- `
-import {Box} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- 'deprecateUtilityComponents',
-)
-
-defineInlineTest(
- deprecateUtilityComponents,
- {},
- `
-import {Absolute} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- `
-import {Box} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- 'deprecateUtilityComponents',
-)
-
-defineInlineTest(
- deprecateUtilityComponents,
- {},
- `
-import {Relative} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- `
-import {Box} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- 'deprecateUtilityComponents',
-)
-
-defineInlineTest(
- deprecateUtilityComponents,
- {},
- `
-import {Fixed} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- `
-import {Box} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- 'deprecateUtilityComponents',
-)
-
-defineInlineTest(
- deprecateUtilityComponents,
- {},
- `
-import {Sticky} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- `
-import {Box} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- 'deprecateUtilityComponents',
-)
-
-defineInlineTest(
- deprecateUtilityComponents,
- {},
- `
-import {BorderBox} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- `
-import {Box} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- 'deprecateUtilityComponents',
-)
-
-defineInlineTest(
- deprecateUtilityComponents,
- {},
- `
-import {Flex} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- `
-import {Box} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- 'deprecateUtilityComponents',
-)
diff --git a/packages/react/codemods/__tests__/removeSystemProps.js b/packages/react/codemods/__tests__/removeSystemProps.js
deleted file mode 100644
index e2a33e9f69d..00000000000
--- a/packages/react/codemods/__tests__/removeSystemProps.js
+++ /dev/null
@@ -1,225 +0,0 @@
-import {defineInlineTest} from 'jscodeshift/dist/testUtils'
-import removeSystemProps from '../removeSystemProps'
-
-defineInlineTest(
- removeSystemProps,
- {},
- `
-import {Label} from '@primer/components'
-const leftMargin = 2
-export default () => (
-
-)
-`.trim(),
- `
-import {Label} from '@primer/components'
-const leftMargin = 2
-export default () => (
-
-)
-`.trim(),
- 'removeSystemProps',
-)
-
-defineInlineTest(
- removeSystemProps,
- {},
- `
-import {Button, Octicon} from '@primer/components'
-import {CheckIcon, ClippyIcon} from '@primer/octicons-react'
-
-const ClipboardCopy = ({value}) =>
-
-`.trim(),
- `
-import {Button, Octicon} from '@primer/components'
-import {CheckIcon, ClippyIcon} from '@primer/octicons-react'
-
-const ClipboardCopy = ({value}) => (
-
-)`.trim(),
- 'removeSystemProps',
-)
-
-defineInlineTest(
- removeSystemProps,
- {},
- `
-import {Link} from '@primer/components'
-const siteMetadata = {shortName: 'inline-block'}
-
-const link =
- Primer
-
-`.trim(),
- `
-import {Link} from '@primer/components'
-const siteMetadata = {shortName: 'inline-block'}
-
-const link = (
-
- Primer
-
-)`.trim(),
- 'removeSystemProps',
-)
-
-defineInlineTest(
- removeSystemProps,
- {},
- `
-import {Label} from '@primer/components'
-const leftMargin = 2
-export default () => (
-
-)
-`.trim(),
- `
-import {Label} from '@primer/components'
-const leftMargin = 2
-export default () => (
-
-)
-`.trim(),
- 'removeSystemProps',
-)
-
-defineInlineTest(
- removeSystemProps,
- {},
- `
-import {Label} from '@primer/components'
-const leftMargin = 2
-export default () => (
-
-)
-`.trim(),
- `
-import {Label} from '@primer/components'
-const leftMargin = 2
-export default () => (
-
-)
-`.trim(),
- 'removeSystemProps',
-)
-
-defineInlineTest(
- removeSystemProps,
- {},
- `
-import {Label} from '@primer/components'
-const leftMargin = 2
-const colorProps = {backgroundColor: 'red'}
-const borderProps = {borderColor: 'red'}
-export default () => (
-
-)
-`.trim(),
- `
-import {Label} from '@primer/components'
-const leftMargin = 2
-const colorProps = {backgroundColor: 'red'}
-const borderProps = {borderColor: 'red'}
-export default () => (
-
-)
-`.trim(),
- 'removeSystemProps',
-)
-
-defineInlineTest(
- removeSystemProps,
- {},
- `
-import {Label} from '@primer/components'
-const leftMargin = 2
-export default () => (
-
-)
-`.trim(),
- `
-import {Label} from '@primer/components'
-const leftMargin = 2
-export default () => (
-
-)
-`.trim(),
- 'removeSystemProps',
-)
-
-defineInlineTest(
- removeSystemProps,
- {},
- `
-import {Label} from '@primer/components'
-const leftMargin = 2
-const colorProps = {dark: {backgroundColor: 'red'}}
-export default () => (
-
-)
-`.trim(),
- `
-import {Label} from '@primer/components'
-const leftMargin = 2
-const colorProps = {dark: {backgroundColor: 'red'}}
-export default () => (
-
-)
-`.trim(),
- 'removeSystemProps',
-)
diff --git a/packages/react/codemods/__tests__/v1.js b/packages/react/codemods/__tests__/v1.js
deleted file mode 100644
index 4bb0ded4402..00000000000
--- a/packages/react/codemods/__tests__/v1.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import {defineInlineTest} from 'jscodeshift/dist/testUtils'
-import v1 from '../v1'
-defineInlineTest(
- v1,
- {},
- `
-import {Box} from 'primer-react'
-export default () => (
-
- hi
-
-)
-`.trim(),
- `
-import {Box} from 'primer-react'
-export default () => (
-
- hi
-
-)
-`.trim(),
- 'v1',
-)
diff --git a/packages/react/codemods/__tests__/v12.js b/packages/react/codemods/__tests__/v12.js
deleted file mode 100644
index 3247dbb8207..00000000000
--- a/packages/react/codemods/__tests__/v12.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import {defineInlineTest} from 'jscodeshift/dist/testUtils'
-import v12 from '../v12'
-defineInlineTest(
- v12,
- {},
- `
-import {Box} from '@primer/components'
-export default () => (
-
- hi
-
-)
-`.trim(),
- `
-import {Box} from '@primer/components'
-export default () => (
-
- hi
-
-)
-`.trim(),
- 'v12',
-)
diff --git a/packages/react/codemods/__tests__/v2.js b/packages/react/codemods/__tests__/v2.js
deleted file mode 100644
index 8516cb7a410..00000000000
--- a/packages/react/codemods/__tests__/v2.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import {defineInlineTest} from 'jscodeshift/dist/testUtils'
-import v2 from '../v2'
-
-defineInlineTest(
- v2,
- {},
- `
-import {Block, Box} from 'primer-react'
-export default () => (
-
-
-
-)
-`.trim(),
- `
-import {Box, BorderBox} from 'primer-react'
-export default () => (
-
-
-
-)
-`.trim(),
- 'v2',
-)
diff --git a/packages/react/codemods/__tests__/v3.js b/packages/react/codemods/__tests__/v3.js
deleted file mode 100644
index 1c0474cd37e..00000000000
--- a/packages/react/codemods/__tests__/v3.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import {defineInlineTest} from 'jscodeshift/dist/testUtils'
-import v3 from '../v3'
-
-defineInlineTest(
- v3,
- {},
- `
-import {DonutChart, DonutSlice} from 'primer-react'
-export default () => (
-
-
-
-)
-`.trim(),
- `
-import {Donut} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- 'v3',
-)
diff --git a/packages/react/codemods/__tests__/v4.js b/packages/react/codemods/__tests__/v4.js
deleted file mode 100644
index 5e5f4b97ece..00000000000
--- a/packages/react/codemods/__tests__/v4.js
+++ /dev/null
@@ -1,68 +0,0 @@
-import {defineInlineTest} from 'jscodeshift/dist/testUtils'
-import v4 from '../v4'
-
-defineInlineTest(
- v4,
- {},
- `
-import {FlexContainer, FlexItem} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- `
-import {Flex} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- 'v4',
-)
-
-defineInlineTest(
- v4,
- {},
- `
-import {UnderlineNav, UnderlineNavItem} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- `
-import {UnderlineNav} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- 'v4',
-)
-
-defineInlineTest(
- v4,
- {},
- `
-import {FilterList, FilterListItem} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- `
-import {FilterList} from '@primer/components'
-export default () => (
-
-
-
-)
-`.trim(),
- 'v4',
-)
diff --git a/packages/react/codemods/deprecateUtilityComponents.js b/packages/react/codemods/deprecateUtilityComponents.js
deleted file mode 100644
index e72a41b215f..00000000000
--- a/packages/react/codemods/deprecateUtilityComponents.js
+++ /dev/null
@@ -1,111 +0,0 @@
-const prettify = require('./lib/prettify')
-
-module.exports = (file, api) => {
- const j = api.jscodeshift
- const ast = j(file.source)
-
- deprecateComponents(ast, j, '@primer/components', {
- Flex: {
- identifier: 'Box',
- attributes: {
- display: 'flex',
- },
- },
- Grid: {
- identifier: 'Box',
- attributes: {
- display: 'grid',
- },
- },
- Position: {
- identifier: 'Box',
- attributes: {},
- },
- Absolute: {
- identifier: 'Box',
- attributes: {
- position: 'absolute',
- },
- },
- Relative: {
- identifier: 'Box',
- attributes: {
- position: 'relative',
- },
- },
- Fixed: {
- identifier: 'Box',
- attributes: {
- position: 'fixed',
- },
- },
- Sticky: {
- identifier: 'Box',
- attributes: {
- position: 'sticky',
- },
- },
- BorderBox: {
- identifier: 'Box',
- attributes: {
- borderWidth: '1px',
- borderStyle: 'solid',
- borderColor: 'border.default',
- borderRadius: 2,
- },
- },
- })
-
- return prettify(ast, file)
-}
-
-function deprecateComponents(ast, j, importSource, importMap) {
- const imports = ast.find(j.ImportDeclaration, {source: {value: importSource}})
- const importsByName = {}
-
- imports.forEach(decl => {
- j(decl)
- .find(j.ImportSpecifier)
- .forEach(spec => {
- importsByName[spec.node.imported.name] = spec
- })
- })
-
- for (const [from, to] of Object.entries(importMap)) {
- rewriteImport(from, to.identifier, to.attributes)
- }
-
- function rewriteImport(from, to, attributes) {
- imports.forEach(decl => {
- j(decl)
- .find(j.ImportSpecifier, {imported: {name: from}})
- .forEach(spec => {
- if (importsByName[to]) {
- // if the destination import already exists and there are members
- // in this identifier, then this one is a dupe
- j(spec).remove()
- } else {
- // otherwise, we can safely rename this one to the new identifier
- spec.node.imported.name = to
- importsByName[to] = spec
- }
- })
- })
-
- ast.find(j.JSXOpeningElement, {name: {name: from}}).forEach(nodePath => {
- for (const [attr, value] of Object.entries(attributes || {})) {
- const expression = typeof value === 'string' ? j.literal(value) : j.jsxExpressionContainer(j.literal(value))
- const attrExists = nodePath.value.attributes.find(a => a?.name?.name === attr)
- if (!attrExists) {
- nodePath.value.attributes.push(j.jsxAttribute(j.jsxIdentifier(attr), expression))
- }
- }
- })
-
- // replace all of the rewritten identifiers with member expressions
- ast
- .find(j.Identifier, {name: from})
- .filter(id => id.parent.node.type !== 'ImportSpecifier')
- .replaceWith(j.jsxIdentifier(to))
- }
-}
diff --git a/packages/react/codemods/lib/__tests__/changeImportSource.test.js b/packages/react/codemods/lib/__tests__/changeImportSource.test.js
deleted file mode 100644
index fb60dcc1034..00000000000
--- a/packages/react/codemods/lib/__tests__/changeImportSource.test.js
+++ /dev/null
@@ -1,104 +0,0 @@
-import { defineInlineTest } from 'jscodeshift/dist/testUtils';
-import { changeImportSource } from '../changeImportSource';
-import { setupPreserveLeadingComments } from '../preserveLeadingComments';
-
-function defaultTransform(file, api, options) {
- const j = api.jscodeshift;
- const root = j(file.source);
- const preserveLeadingComments = setupPreserveLeadingComments(j, root);
-
- changeImportSource(j, root, {
- name: 'TreeView',
- from: '@primer/react/drafts',
- to: '@primer/react'
- });
-
- preserveLeadingComments();
-
- return root.toSource(options.printOptions ?? {});
-}
-
-const transformOptions = {
- printOptions: {
- quote: 'single',
- },
-};
-
-defineInlineTest(
- defaultTransform,
- transformOptions,
-`
-import { TreeView } from '@primer/react/drafts';
-`,
-`
-import { TreeView } from '@primer/react';
-`,
- 'moves the import from the source to the target ImportDeclaration'
-);
-
-defineInlineTest(
- defaultTransform,
- transformOptions,
-`
-import { TreeView as PrimerTreeView } from '@primer/react/drafts';
-`,
-`
-import { TreeView as PrimerTreeView } from '@primer/react';
-`,
- 'supports remapped imports'
-);
-
-
-defineInlineTest(
- defaultTransform,
- transformOptions,
-`
-// Comment
-import { TreeView } from '@primer/react/drafts';
-`,
-`
-// Comment
-import { TreeView } from '@primer/react';
-`,
- 'preserves leading comments'
-);
-
-defineInlineTest(
- defaultTransform,
- transformOptions,
-`
-import { TreeView } from '@primer/react/drafts';
-import { Box } from '@primer/react';
-`,
-`
-import { Box, TreeView } from '@primer/react';
-`,
- 'adds to existing ImportDeclaration'
-);
-
-defineInlineTest(
- defaultTransform,
- transformOptions,
-`
-import fs from 'node:fs';
-import { TreeView } from '@primer/react/drafts';
-`,
-`
-import { TreeView } from '@primer/react';
-import fs from 'node:fs';
-`,
- 'replaces import declaration location'
-)
-defineInlineTest(
- defaultTransform,
- transformOptions,
-`
-import fs from 'node:fs';
-import path from 'node:path';
-`,
-`
-import fs from 'node:fs';
-import path from 'node:path';
-`,
- 'no changes if import is not available'
-);;
diff --git a/packages/react/codemods/lib/changeImportSource.js b/packages/react/codemods/lib/changeImportSource.js
deleted file mode 100644
index 52493fa2bd9..00000000000
--- a/packages/react/codemods/lib/changeImportSource.js
+++ /dev/null
@@ -1,130 +0,0 @@
-function changeImportSource(j, root, options) {
- const { name, from, to } = options;
- // Changes is a mapping of `imported` values to their `local` values. For
- // example, someone may import `Link` but remaps it to `PrimerLink`
- //
- // Example:
- // Map(
- // 'Link' => ['PrimerLink'],
- // )
- const changes = new Map();
-
- root.find(j.ImportDeclaration, {
- source: {
- value: from,
- },
- }).forEach((path) => {
- // Iterate through every ImportSpecifier that matches the given `name` of
- // the import that we're changing. Add the name of the import to our list of
- // changes and remove the ImportSpecifier
- j(path).find(j.ImportSpecifier, {
- imported: {
- name,
- },
- }).forEach((specifierPath) => {
- const imported = specifierPath.value.imported.name;
- if (!changes.has(imported)) {
- changes.set(imported, []);
- }
- changes.get(imported).push(specifierPath.value.local.name);
- j(specifierPath).remove();
- });
-
- // If the ImportDeclaration is empty (has no specifiers), remove it
- const specifiers = j(path).find(j.ImportSpecifier);
- if (specifiers.length === 0) {
- j(path).remove();
- }
- });
-
- if (changes.size === 0) {
- return;
- }
-
- // If we have no ImportDeclaration's, create one at the top of the file.
- // Note: make sure to preserve leading comments in the transformer that uses
- // this utility function
- if (root.find(j.ImportDeclaration).length === 0) {
- root.find(j.Program).get('body', 0).insertBefore(
- j.importDeclaration(Array.from(changes).flatMap(([imported, locals]) => {
- return locals.map((local) => {
- return j.importSpecifier(j.identifier(imported), j.identifier(local));
- });
- }), j.stringLiteral('@primer/react'))
- );
- return;
- }
-
- // Look for import declarations that match the given `to` ImportDeclaration
- // source
- const matchingImportDeclarations = root.find(j.ImportDeclaration, {
- source: {
- value: to,
- },
- });
-
- // If none exist, try to insert the ImportDeclaration for `to` in alphabetical
- // order
- if (matchingImportDeclarations.length === 0) {
- const importDeclarations = root.find(j.ImportDeclaration);
- const order = [
- ...importDeclarations.nodes().map((node) => {
- return node.source.value;
- }),
- to,
- ].sort((a, b) => {
- return a.localeCompare(b);
- });
- const insertionIndex = order.indexOf(to);
- const specifiers = Array.from(changes).flatMap(([imported, locals]) => {
- return locals.map(local => {
- return j.importSpecifier(j.identifier(imported), j.identifier(local));
- });
- });
-
- if (insertionIndex === 0) {
- importDeclarations.at(0).insertBefore(
- j.importDeclaration(specifiers, j.stringLiteral(to)),
- );
- } else {
- importDeclarations.at(insertionIndex - 1).insertAfter(
- j.importDeclaration(specifiers, j.stringLiteral(to)),
- );
- }
-
- return;
- }
-
- // If one exists, try to add the specifier in alphabetical order
- matchingImportDeclarations.at(0).forEach((path) => {
- const specifiers = path.value.specifiers.map((specifier) => {
- return specifier.imported.name;
- });
- const order = [...specifiers, ...Array.from(changes.keys())].sort((a, b) => {
- return a.localeCompare(b);
- });
-
- for (const [imported, locals] of changes) {
- const insertionIndex = order.indexOf(imported);
- const specifiers = locals.map(local => {
- return j.importSpecifier(j.identifier(imported), j.identifier(local));
- });
-
- // The `change` should be at the front of the list
- if (insertionIndex === 0) {
- j(path).find(j.ImportSpecifier).at(0).insertBefore(
- specifiers
- );
- } else {
- // The `change` should be after an item in the list
- j(path).find(j.ImportSpecifier).at(insertionIndex - 1).insertAfter(
- specifiers
- );
- }
- }
- });
-}
-
-module.exports = {
- changeImportSource,
-};
diff --git a/packages/react/codemods/lib/format.js b/packages/react/codemods/lib/format.js
deleted file mode 100644
index 8d3392767e6..00000000000
--- a/packages/react/codemods/lib/format.js
+++ /dev/null
@@ -1,15 +0,0 @@
-'use strict';
-
-const prettier = require('@prettier/sync');
-const config = prettier.resolveConfig(process.cwd());
-
-function format(file, source) {
- return prettier.format(source, {
- ...config,
- filepath: file.path,
- });
-}
-
-module.exports = {
- format,
-};
diff --git a/packages/react/codemods/lib/modifyProps.js b/packages/react/codemods/lib/modifyProps.js
deleted file mode 100644
index 87cbff2a2d5..00000000000
--- a/packages/react/codemods/lib/modifyProps.js
+++ /dev/null
@@ -1,43 +0,0 @@
-module.exports = (ast, j, moduleName, propsMap) => {
- const importsByName = {}
-
- ast
- .find(j.ImportDeclaration, decl => decl.source.value === moduleName)
- .forEach(decl => {
- j(decl)
- .find(j.ImportSpecifier)
- .forEach(spec => {
- importsByName[spec.node.imported.name] = spec.node.local.name
- })
- })
-
- ast
- .find(j.JSXElement, {
- openingElement: {
- name: {
- name: name => {
- return name in importsByName
- },
- },
- },
- })
- .forEach(el => {
- j(el)
- .find(j.JSXAttribute, {
- name: name => {
- return name.name in propsMap
- },
- })
- .forEach(attr => {
- const name = attr.value.name.name
- const op = propsMap[name]
- if (typeof op === 'function') {
- op(attr, el)
- } else if (typeof op === 'string' && attr.value.name instanceof Object) {
- attr.value.name.name = op
- } else if (op instanceof Object) {
- j(attr).replaceWith(op)
- }
- })
- })
-}
diff --git a/packages/react/codemods/lib/preserveLeadingComments.js b/packages/react/codemods/lib/preserveLeadingComments.js
deleted file mode 100644
index 852009b9421..00000000000
--- a/packages/react/codemods/lib/preserveLeadingComments.js
+++ /dev/null
@@ -1,22 +0,0 @@
-'use strict';
-
-function setupPreserveLeadingComments(j, root) {
- const getFirstNode = () => {
- return root.find(j.Program).get('body', 0).node
- }
- // Save the comments attached to the first node
- const firstNode = getFirstNode()
- const {comments} = firstNode
-
- return () => {
- // If the first node has been modified or deleted, reattach the comments
- const firstNode2 = getFirstNode()
- if (firstNode2 !== firstNode) {
- firstNode2.comments = comments
- }
- }
-}
-
-module.exports = {
- setupPreserveLeadingComments,
-};
diff --git a/packages/react/codemods/lib/prettify.js b/packages/react/codemods/lib/prettify.js
deleted file mode 100644
index 7437572f4b4..00000000000
--- a/packages/react/codemods/lib/prettify.js
+++ /dev/null
@@ -1,16 +0,0 @@
-const prettier = require('prettier')
-
-module.exports = function prettify(ast, file) {
- const config = prettier.resolveConfig.sync(process.cwd())
- const source = ast.toSource()
- return prettier.format(
- source,
- Object.assign(
- {
- parser: 'typescript',
- filepath: file.path,
- },
- config,
- ),
- )
-}
diff --git a/packages/react/codemods/lib/renameImports.js b/packages/react/codemods/lib/renameImports.js
deleted file mode 100644
index b1bae25f712..00000000000
--- a/packages/react/codemods/lib/renameImports.js
+++ /dev/null
@@ -1,47 +0,0 @@
-module.exports = function renameImports(ast, j, importSource, importMap) {
- const imports = ast.find(j.ImportDeclaration, {source: {value: importSource}})
- const importsByName = {}
-
- imports.forEach(decl => {
- j(decl)
- .find(j.ImportSpecifier)
- .forEach(spec => {
- importsByName[spec.node.imported.name] = spec
- })
- })
-
- for (const [from, to] of Object.entries(importMap)) {
- const idents = to.split('.')
- rewriteImport(from, idents[0], idents.slice(1))
- }
-
- function rewriteImport(from, to, members) {
- imports.forEach(decl => {
- j(decl)
- .find(j.ImportSpecifier, {imported: {name: from}})
- .forEach(spec => {
- if (importsByName[to] && members.length) {
- // if the destination import already exists and there are members
- // in this identifier, then this one is a dupe
- j(spec).remove()
- } else {
- // otherwise, we can safely rename this one to the new identifier
- spec.node.imported.name = to
- importsByName[to] = spec
- }
- })
- })
-
- // replace all of the rewritten identifiers with member expressions
- ast
- .find(j.Identifier, {name: from})
- .filter(id => id.parent.node.type !== 'ImportSpecifier')
- .replaceWith(memberExpression(to, ...members))
- }
-
- function memberExpression(ident, ...members) {
- return members.reduce((expr, member) => {
- return j.memberExpression(expr, j.identifier(member))
- }, j.identifier(ident))
- }
-}
diff --git a/packages/react/codemods/lib/replaceImportSource.js b/packages/react/codemods/lib/replaceImportSource.js
deleted file mode 100644
index 4131dadf8fb..00000000000
--- a/packages/react/codemods/lib/replaceImportSource.js
+++ /dev/null
@@ -1,7 +0,0 @@
-module.exports = function replaceImportSource(ast, j, from, to) {
- ast
- .find(j.ImportDeclaration, decl => decl.source.value === from)
- .forEach(decl => {
- j(decl).find(j.Literal, {value: from}).replaceWith(j.literal(to))
- })
-}
diff --git a/packages/react/codemods/removeSystemProps.js b/packages/react/codemods/removeSystemProps.js
deleted file mode 100644
index f829a124668..00000000000
--- a/packages/react/codemods/removeSystemProps.js
+++ /dev/null
@@ -1,312 +0,0 @@
-const prettify = require('./lib/prettify')
-
-const COMMON = [
- 'margin',
- 'marginTop',
- 'marginRight',
- 'marginBottom',
- 'marginLeft',
- 'marginX',
- 'marginY',
- 'm',
- 'mt',
- 'mr',
- 'mb',
- 'ml',
- 'mx',
- 'my',
- 'padding',
- 'paddingTop',
- 'paddingRight',
- 'paddingBottom',
- 'paddingLeft',
- 'paddingX',
- 'paddingY',
- 'p',
- 'pt',
- 'pr',
- 'pb',
- 'pl',
- 'px',
- 'py',
- 'color',
- 'backgroundColor',
- 'opacity',
- 'bg',
- 'display',
-]
-
-const TYPOGRAPHY = [
- 'fontFamily',
- 'fontSize',
- 'fontWeight',
- 'lineHeight',
- 'letterSpacing',
- 'textAlign',
- 'fontStyle',
- 'whiteSpace',
-]
-
-const BORDER = [
- 'border',
- 'borderWidth',
- 'borderStyle',
- 'borderColor',
- 'borderRadius',
- 'borderTop',
- 'borderTopLeftRadius',
- 'borderTopRightRadius',
- 'borderRight',
- 'borderBottom',
- 'borderBottomLeftRadius',
- 'borderBottomRightRadius',
- 'borderLeft',
- 'borderX',
- 'borderY',
- 'borderTopWidth',
- 'borderTopColor',
- 'borderTopStyle',
- 'borderBottomWidth',
- 'borderBottomColor',
- 'borderBottomStyle',
- 'borderLeftWidth',
- 'borderLeftColor',
- 'borderLeftStyle',
- 'borderRightWidth',
- 'borderRightColor',
- 'borderRightStyle',
- 'boxShadow',
- 'textShadow',
-]
-
-const LAYOUT = [
- 'width',
- 'height',
- 'minWidth',
- 'minHeight',
- 'maxWidth',
- 'maxHeight',
- 'size',
- 'overflow',
- 'overflowX',
- 'overflowY',
- 'display',
- 'verticalAlign',
-]
-
-const POSITION = ['position', 'zIndex', 'top', 'right', 'bottom', 'left']
-
-const FLEX = [
- 'alignItems',
- 'alignContent',
- 'justifyItems',
- 'justifyContent',
- 'flexWrap',
- 'flexDirection',
- 'flex',
- 'flexGrow',
- 'flexShrink',
- 'flexBasis',
- 'justifySelf',
- 'alignSelf',
- 'order',
-]
-
-// const GRID = [
-// 'gridGap',
-// 'gridColumnGap',
-// 'gridRowGap',
-// 'gridColumn',
-// 'gridRow',
-// 'gridAutoFlow',
-// 'gridAutoColumns',
-// 'gridAutoRows',
-// 'gridTemplateColumns',
-// 'gridTemplateRows',
-// 'gridTemplateAreas',
-// 'gridArea'
-// ]
-
-const stylePropsMap = {
- Avatar: [...COMMON],
- AvatarStack: [...COMMON],
- BranchName: [...COMMON],
- Breadcrumb: [...COMMON, ...FLEX],
- Button: [...COMMON, ...LAYOUT, ...TYPOGRAPHY],
- ButtonBase: [...COMMON, ...LAYOUT],
- ButtonClose: [...COMMON, ...LAYOUT],
- ButtonTableList: [...COMMON, ...TYPOGRAPHY, ...LAYOUT],
- CircleBadge: [...COMMON],
- CounterLabel: [...COMMON],
- Details: [...COMMON],
- Dialog: [...LAYOUT, ...COMMON, ...POSITION],
- Dropdown: [...COMMON],
- FilteredSearch: [...COMMON],
- FilterList: [...COMMON],
- Flash: [...COMMON],
- FormGroup: [...COMMON],
- FormGroupLabel: [...COMMON, ...TYPOGRAPHY],
- Header: [...COMMON, ...BORDER],
- HeaderItem: [...COMMON, ...BORDER],
- Label: [...COMMON, ...BORDER],
- LabelGroup: [...COMMON],
- Link: [...COMMON, ...TYPOGRAPHY],
- Overlay: [...COMMON],
- Pagehead: [...COMMON],
- Pagination: [...COMMON],
- Popover: [...COMMON, ...LAYOUT, ...POSITION],
- PopoverContent: [...COMMON, ...LAYOUT, ...POSITION, ...FLEX],
- SelectMenu: [...COMMON],
- SelectMenuDivider: [...COMMON],
- SelectMenuFilter: [...COMMON],
- SelectMenuFooter: [...COMMON],
- SelectMenuHeader: [...COMMON, ...TYPOGRAPHY],
- SelectMenuItem: [...COMMON],
- SelectMenuList: [...COMMON],
- SelectMenuLoadingAnimation: [...COMMON],
- SelectMenuModal: [...COMMON],
- SelectMenuTab: [...COMMON],
- SelectMenuTabPanel: [...COMMON],
- SelectMenuTabs: [...COMMON],
- SideNav: [...COMMON],
- Spinner: [...COMMON],
- StateLabel: [...COMMON],
- Octicon: [...COMMON],
- SubNav: [...COMMON, ...FLEX],
- TabNav: [...COMMON],
- TabNavLink: [...COMMON, ...TYPOGRAPHY],
- TextInput: [...COMMON],
- Timeline: [...COMMON],
- Tooltip: [...COMMON],
- Truncate: [...TYPOGRAPHY, ...COMMON],
- UnderlineNav: [...COMMON],
-}
-
-const expressionToString = expression => {
- if (expression.type === 'Literal') {
- const expressionValue = expression.value
- return typeof expressionValue === 'string' ? `"${expressionValue}"` : expressionValue
- } else if (expression.type === 'Identifier') {
- return expression.name
- } else if (expression.type === 'Identifier') {
- return expression.name
- } else if (['null', 'undefined'].includes(expression.raw)) {
- return expression.raw
- } else {
- const start = expression.start
- const end = expression.end
- const toks = expression.loc.tokens.filter(token => {
- return token.type !== 'CommentLine' && token.start >= start && token.end <= end
- })
- const vals = toks.map(tok => {
- return tok.type.label === 'string' ? `"${tok.value}"` : tok.value
- })
- return vals.join('')
- }
-}
-
-const objectToString = (object, spreads = []) => {
- const values = Object.values(object)
- const keys = Object.keys(object)
- const duples = keys.map(function (key, i) {
- return [key, values[i]]
- })
- const accumulator = (string, duple) => {
- const expression = duple[1]
- const expressionString = expressionToString(expression)
- return `${string} ${duple[0]}: ${expressionString},`
- }
- const objString = duples.reduce(accumulator, '')
- const spreadsString = spreads.map(s => `...${s},`).join('')
- return `{${spreadsString}${objString}}`
-}
-
-module.exports = (file, api) => {
- const j = api.jscodeshift
- const ast = j(file.source)
-
- const importsByName = {}
-
- ast
- .find(j.ImportDeclaration, decl => decl.source.value.includes('@primer/components'))
- .forEach(decl => {
- j(decl)
- .find(j.ImportSpecifier)
- .forEach(spec => {
- importsByName[spec.node.imported.name] = spec.node.local.name
- })
- })
-
- ast
- .find(j.JSXElement, {
- openingElement: {
- name: {
- name: name => {
- return name in stylePropsMap
- },
- },
- },
- })
- .forEach(el => {
- const sx = {}
- const elementName = el.value?.openingElement?.name?.name
- const elementNameScrubbed = elementName.replace('.', '')
- const systemProps = stylePropsMap[elementNameScrubbed]
- const attrNodes = j(el).find(j.JSXAttribute, {
- name: name => {
- const isInElement = name.start >= el.node.start && name.end <= el.value.openingElement.end
- return systemProps && systemProps.includes(name.name) && isInElement
- },
- })
-
- const sxNodes = j(el).find(j.JSXAttribute, {
- name: name => {
- const isInElement = name.start >= el.node.start && name.end <= el.value.openingElement.end
- return name.name === 'sx' && isInElement
- },
- })
-
- const existingSx = {}
- const sxNodesArray = sxNodes.nodes() || []
- const existingSxProps = sxNodesArray[0]?.value?.expression?.properties
- existingSxProps &&
- existingSxProps.forEach(p => {
- const keyName = p?.key?.name
- const keyValue = p?.key?.raw
- if (!keyName && !keyValue) {
- return
- }
- existingSx[keyName || keyValue] = p.value
- })
- const spreads =
- existingSxProps &&
- existingSxProps
- .filter(p => p.type === 'SpreadElement')
- .map(s => {
- const argName = s?.argument?.name
- const propName = s?.argument?.property?.name
- const objectName = s?.argument?.object?.name
- return argName || `${objectName}.${propName}`
- })
-
- attrNodes.forEach((attr, index) => {
- const key = attr?.value?.name?.name
- const literal = attr?.value?.value
- const val = literal.type === 'JSXExpressionContainer' ? literal.expression : literal
- if (key && val) {
- sx[key] = val
- }
- if (index + 1 !== attrNodes.length) {
- attr.prune()
- } else {
- const keys = Object.keys(sx)
- if (keys.length > 0) {
- sxNodes.forEach(node => node.prune())
- j(attr).replaceWith(`sx={${objectToString({...existingSx, ...sx}, spreads)}}`)
- }
- }
- })
- })
-
- return prettify(ast, file)
-}
diff --git a/packages/react/codemods/v1.js b/packages/react/codemods/v1.js
deleted file mode 100644
index fde3eb3b70f..00000000000
--- a/packages/react/codemods/v1.js
+++ /dev/null
@@ -1,14 +0,0 @@
-const prettify = require('./lib/prettify')
-const modifyProps = require('./lib/modifyProps')
-
-module.exports = (file, api) => {
- const j = api.jscodeshift
- const ast = j(file.source)
-
- modifyProps(ast, j, 'primer-react', {
- tag: 'is',
- fg: 'color',
- })
-
- return prettify(ast, file)
-}
diff --git a/packages/react/codemods/v12.js b/packages/react/codemods/v12.js
deleted file mode 100644
index 2041b3d989c..00000000000
--- a/packages/react/codemods/v12.js
+++ /dev/null
@@ -1,13 +0,0 @@
-const prettify = require('./lib/prettify')
-const modifyProps = require('./lib/modifyProps')
-
-module.exports = (file, api) => {
- const j = api.jscodeshift
- const ast = j(file.source)
-
- modifyProps(ast, j, '@primer/components', {
- is: 'as',
- })
-
- return prettify(ast, file)
-}
diff --git a/packages/react/codemods/v2.js b/packages/react/codemods/v2.js
deleted file mode 100644
index 6232df59f63..00000000000
--- a/packages/react/codemods/v2.js
+++ /dev/null
@@ -1,15 +0,0 @@
-const renameImports = require('./lib/renameImports')
-const prettify = require('./lib/prettify')
-
-module.exports = (file, api) => {
- const j = api.jscodeshift
- const ast = j(file.source)
-
- renameImports(ast, j, 'primer-react', {
- Box: 'BorderBox',
- Block: 'Box',
- CaretBox: 'PointerBox',
- })
-
- return prettify(ast, file)
-}
diff --git a/packages/react/codemods/v3.js b/packages/react/codemods/v3.js
deleted file mode 100644
index 3c594a69f67..00000000000
--- a/packages/react/codemods/v3.js
+++ /dev/null
@@ -1,17 +0,0 @@
-const replaceImportSource = require('./lib/replaceImportSource')
-const renameImports = require('./lib/renameImports')
-const prettify = require('./lib/prettify')
-
-module.exports = (file, api) => {
- const j = api.jscodeshift
- const ast = j(file.source)
-
- replaceImportSource(ast, j, 'primer-react', '@primer/components')
-
- renameImports(ast, j, '@primer/components', {
- DonutChart: 'Donut',
- DonutSlice: 'Donut.Slice',
- })
-
- return prettify(ast, file)
-}
diff --git a/packages/react/codemods/v36/__testfixtures__/rename-action-menu-button-props.input.tsx b/packages/react/codemods/v36/__testfixtures__/rename-action-menu-button-props.input.tsx
deleted file mode 100644
index 34de1942ed5..00000000000
--- a/packages/react/codemods/v36/__testfixtures__/rename-action-menu-button-props.input.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import {ActionMenu} from '@primer/react'
-import {TrashIcon} from '@primer/octicons-react'
-
-function LeadingVisual() {
- return Test
-}
-
-function TrailingVisual() {
- return Test
-}
-
-function OutlineVariant() {
- return Test
-}
diff --git a/packages/react/codemods/v36/__testfixtures__/rename-action-menu-button-props.output.tsx b/packages/react/codemods/v36/__testfixtures__/rename-action-menu-button-props.output.tsx
deleted file mode 100644
index 1d05e1c9755..00000000000
--- a/packages/react/codemods/v36/__testfixtures__/rename-action-menu-button-props.output.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import {ActionMenu} from '@primer/react'
-import {TrashIcon} from '@primer/octicons-react'
-
-function LeadingVisual() {
- return Test
-}
-
-function TrailingVisual() {
- return Test
-}
-
-function OutlineVariant() {
- return Test
-}
diff --git a/packages/react/codemods/v36/__testfixtures__/rename-button-props.input.tsx b/packages/react/codemods/v36/__testfixtures__/rename-button-props.input.tsx
deleted file mode 100644
index 69f213e5d09..00000000000
--- a/packages/react/codemods/v36/__testfixtures__/rename-button-props.input.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import {Button} from '@primer/react'
-import {TrashIcon} from '@primer/octicons-react'
-
-function LeadingVisual() {
- return
-}
-
-function TrailingVisual() {
- return
-}
-
-function OutlineVariant() {
- return
-}
diff --git a/packages/react/codemods/v36/__testfixtures__/rename-button-props.output.tsx b/packages/react/codemods/v36/__testfixtures__/rename-button-props.output.tsx
deleted file mode 100644
index 6331ed255d2..00000000000
--- a/packages/react/codemods/v36/__testfixtures__/rename-button-props.output.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import {Button} from '@primer/react'
-import {TrashIcon} from '@primer/octicons-react'
-
-function LeadingVisual() {
- return
-}
-
-function TrailingVisual() {
- return
-}
-
-function OutlineVariant() {
- return
-}
diff --git a/packages/react/codemods/v36/__testfixtures__/rename-link-button-props.input.tsx b/packages/react/codemods/v36/__testfixtures__/rename-link-button-props.input.tsx
deleted file mode 100644
index e9df1ad44ff..00000000000
--- a/packages/react/codemods/v36/__testfixtures__/rename-link-button-props.input.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import {LinkButton} from '@primer/react'
-import {TrashIcon} from '@primer/octicons-react'
-
-function LeadingVisual() {
- return Test
-}
-
-function TrailingVisual() {
- return Test
-}
-
-function OutlineVariant() {
- return Test
-}
diff --git a/packages/react/codemods/v36/__testfixtures__/rename-link-button-props.output.tsx b/packages/react/codemods/v36/__testfixtures__/rename-link-button-props.output.tsx
deleted file mode 100644
index 68d5f372427..00000000000
--- a/packages/react/codemods/v36/__testfixtures__/rename-link-button-props.output.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import {LinkButton} from '@primer/react'
-import {TrashIcon} from '@primer/octicons-react'
-
-function LeadingVisual() {
- return Test
-}
-
-function TrailingVisual() {
- return Test
-}
-
-function OutlineVariant() {
- return Test
-}
diff --git a/packages/react/codemods/v36/__testfixtures__/update-button-counter.input.tsx b/packages/react/codemods/v36/__testfixtures__/update-button-counter.input.tsx
deleted file mode 100644
index 8ee765fd4b8..00000000000
--- a/packages/react/codemods/v36/__testfixtures__/update-button-counter.input.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import {Button} from '@primer/react'
-
-function Example() {
- return (
-
- )
-}
-
-function WithCondition() {
- return (
-
- )
-}
-
-function WithTernaryCondition() {
- return (
-
- )
-}
diff --git a/packages/react/codemods/v36/__testfixtures__/update-button-counter.output.tsx b/packages/react/codemods/v36/__testfixtures__/update-button-counter.output.tsx
deleted file mode 100644
index bf4a6c6367a..00000000000
--- a/packages/react/codemods/v36/__testfixtures__/update-button-counter.output.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import {Button} from '@primer/react'
-
-function Example() {
- return
-}
-
-function WithCondition() {
- return
-}
-
-function WithTernaryCondition() {
- return
-}
diff --git a/packages/react/codemods/v36/__testfixtures__/update-imports.input.tsx b/packages/react/codemods/v36/__testfixtures__/update-imports.input.tsx
deleted file mode 100644
index d8368aace7f..00000000000
--- a/packages/react/codemods/v36/__testfixtures__/update-imports.input.tsx
+++ /dev/null
@@ -1,2 +0,0 @@
-import {SplitPageLayout, TreeView, UnderlineNav} from '@primer/react/drafts'
-import {FilteredList, FilteredSearch} from '@primer/react'
diff --git a/packages/react/codemods/v36/__testfixtures__/update-imports.output.tsx b/packages/react/codemods/v36/__testfixtures__/update-imports.output.tsx
deleted file mode 100644
index 1e3e83fc59c..00000000000
--- a/packages/react/codemods/v36/__testfixtures__/update-imports.output.tsx
+++ /dev/null
@@ -1,2 +0,0 @@
-import {SplitPageLayout, TreeView, UnderlineNav} from '@primer/react'
-import {FilteredList, FilteredSearch} from '@primer/react/deprecated'
diff --git a/packages/react/codemods/v36/__testfixtures__/update-underline-nav.input.tsx b/packages/react/codemods/v36/__testfixtures__/update-underline-nav.input.tsx
deleted file mode 100644
index 17e3295298d..00000000000
--- a/packages/react/codemods/v36/__testfixtures__/update-underline-nav.input.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import {UnderlineNav} from '@primer/react/drafts'
-
-function TransformsSelected() {
- return (
-
-
- Home
-
- Documentation
- Support
-
- )
-}
-
-function TransformsSelectedValue() {
- return (
-
-
- Home
-
- Documentation
- Support
-
- )
-}
-
-function RemovesFull() {
- return (
-
- Home
- Documentation
- Support
-
- )
-}
diff --git a/packages/react/codemods/v36/__testfixtures__/update-underline-nav.output.tsx b/packages/react/codemods/v36/__testfixtures__/update-underline-nav.output.tsx
deleted file mode 100644
index 154b8ad9915..00000000000
--- a/packages/react/codemods/v36/__testfixtures__/update-underline-nav.output.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import {UnderlineNav} from '@primer/react/drafts'
-
-function TransformsSelected() {
- return (
-
-
- Home
-
- Documentation
- Support
-
- )
-}
-
-function TransformsSelectedValue() {
- return (
-
-
- Home
-
- Documentation
- Support
-
- )
-}
-
-function RemovesFull() {
- return (
-
- Home
- Documentation
- Support
-
- )
-}
diff --git a/packages/react/codemods/v36/__tests__/rename-action-menu-button-props.test.js b/packages/react/codemods/v36/__tests__/rename-action-menu-button-props.test.js
deleted file mode 100644
index 7e82bd11bcf..00000000000
--- a/packages/react/codemods/v36/__tests__/rename-action-menu-button-props.test.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const {defineTest} = require('jscodeshift/dist/testUtils')
-
-defineTest(__dirname, 'rename-action-menu-button-props')
diff --git a/packages/react/codemods/v36/__tests__/rename-button-props.test.js b/packages/react/codemods/v36/__tests__/rename-button-props.test.js
deleted file mode 100644
index 260fac1caa1..00000000000
--- a/packages/react/codemods/v36/__tests__/rename-button-props.test.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const {defineTest} = require('jscodeshift/dist/testUtils')
-
-defineTest(__dirname, 'rename-button-props')
diff --git a/packages/react/codemods/v36/__tests__/rename-link-button-props.test.js b/packages/react/codemods/v36/__tests__/rename-link-button-props.test.js
deleted file mode 100644
index 324598b16a4..00000000000
--- a/packages/react/codemods/v36/__tests__/rename-link-button-props.test.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const {defineTest} = require('jscodeshift/dist/testUtils')
-
-defineTest(__dirname, 'rename-link-button-props')
diff --git a/packages/react/codemods/v36/__tests__/update-button-counter.test.js b/packages/react/codemods/v36/__tests__/update-button-counter.test.js
deleted file mode 100644
index b598268e624..00000000000
--- a/packages/react/codemods/v36/__tests__/update-button-counter.test.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const {defineTest} = require('jscodeshift/dist/testUtils')
-
-defineTest(__dirname, 'update-button-counter')
diff --git a/packages/react/codemods/v36/__tests__/update-imports.test.js b/packages/react/codemods/v36/__tests__/update-imports.test.js
deleted file mode 100644
index bfcbd77dd53..00000000000
--- a/packages/react/codemods/v36/__tests__/update-imports.test.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const {defineTest} = require('jscodeshift/dist/testUtils')
-
-defineTest(__dirname, 'update-imports')
diff --git a/packages/react/codemods/v36/__tests__/update-underline-nav.test.js b/packages/react/codemods/v36/__tests__/update-underline-nav.test.js
deleted file mode 100644
index 46bc0138ee9..00000000000
--- a/packages/react/codemods/v36/__tests__/update-underline-nav.test.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const {defineTest} = require('jscodeshift/dist/testUtils')
-
-defineTest(__dirname, 'update-underline-nav')
diff --git a/packages/react/codemods/v36/rename-action-menu-button-props.js b/packages/react/codemods/v36/rename-action-menu-button-props.js
deleted file mode 100644
index 2d1ec70dd2d..00000000000
--- a/packages/react/codemods/v36/rename-action-menu-button-props.js
+++ /dev/null
@@ -1,67 +0,0 @@
-'use strict'
-
-const {setupPreserveLeadingComments} = require('../lib/preserveLeadingComments')
-const {format} = require('../lib/format')
-
-function transform(file, api) {
- const j = api.jscodeshift
- const root = j(file.source)
- const preserveLeadingComments = setupPreserveLeadingComments(j, root)
- const jsxElements = root
- .find(j.ImportDeclaration, {
- source: {
- value: '@primer/react',
- },
- })
- .filter(path => {
- return path.value.specifiers.some(specifier => {
- return specifier.imported.name === 'ActionMenu'
- })
- })
- .map(path => {
- const importSpecifier = path.value.specifiers.find(specifier => {
- return specifier.imported.name === 'ActionMenu'
- })
- return j(path)
- .closestScope()
- .find(j.JSXOpeningElement, {
- name: {
- object: {
- name: importSpecifier.local.name,
- },
- property: {
- name: 'Button',
- },
- },
- })
- .paths()
- })
-
- jsxElements.forEach(path => {
- j(path)
- .find(j.JSXAttribute)
- .forEach(attributePath => {
- const jsxAttribute = attributePath.value
- const name = jsxAttribute.name.name
-
- if (name === 'leadingIcon') {
- j(attributePath.get('name')).replaceWith(j.jsxIdentifier('leadingVisual'))
- }
-
- if (name === 'trailingIcon') {
- j(attributePath.get('name')).replaceWith(j.jsxIdentifier('trailingVisual'))
- }
-
- if (name === 'variant' && jsxAttribute.value.value === 'outline') {
- j(attributePath.get('value')).replaceWith(j.stringLiteral('invisible'))
- }
- })
- })
-
- preserveLeadingComments()
-
- return format(file, root.toSource())
-}
-
-module.exports = transform
-module.exports.parser = 'tsx'
diff --git a/packages/react/codemods/v36/rename-button-props.js b/packages/react/codemods/v36/rename-button-props.js
deleted file mode 100644
index 74f2dcab6a4..00000000000
--- a/packages/react/codemods/v36/rename-button-props.js
+++ /dev/null
@@ -1,55 +0,0 @@
-'use strict'
-
-const {setupPreserveLeadingComments} = require('../lib/preserveLeadingComments')
-const {format} = require('../lib/format')
-
-function transform(file, api) {
- const j = api.jscodeshift
- const root = j(file.source)
- const preserveLeadingComments = setupPreserveLeadingComments(j, root)
- const jsxElements = root
- .find(j.ImportDeclaration, {
- source: {
- value: '@primer/react',
- },
- })
- .filter(path => {
- return path.value.specifiers.some(specifier => {
- return specifier.imported.name === 'Button'
- })
- })
- .map(path => {
- const importSpecifier = path.value.specifiers.find(specifier => {
- return specifier.imported.name === 'Button'
- })
- return j(path).closestScope().findJSXElements(importSpecifier.local.name).paths()
- })
-
- jsxElements.forEach(path => {
- j(path)
- .find(j.JSXAttribute)
- .forEach(attributePath => {
- const jsxAttribute = attributePath.value
- const name = jsxAttribute.name.name
-
- if (name === 'leadingIcon') {
- j(attributePath.get('name')).replaceWith(j.jsxIdentifier('leadingVisual'))
- }
-
- if (name === 'trailingIcon') {
- j(attributePath.get('name')).replaceWith(j.jsxIdentifier('trailingVisual'))
- }
-
- if (name === 'variant' && jsxAttribute.value.value === 'outline') {
- j(attributePath.get('value')).replaceWith(j.stringLiteral('invisible'))
- }
- })
- })
-
- preserveLeadingComments()
-
- return format(file, root.toSource())
-}
-
-module.exports = transform
-module.exports.parser = 'tsx'
diff --git a/packages/react/codemods/v36/rename-link-button-props.js b/packages/react/codemods/v36/rename-link-button-props.js
deleted file mode 100644
index bcf5d9ac146..00000000000
--- a/packages/react/codemods/v36/rename-link-button-props.js
+++ /dev/null
@@ -1,55 +0,0 @@
-'use strict'
-
-const {setupPreserveLeadingComments} = require('../lib/preserveLeadingComments')
-const {format} = require('../lib/format')
-
-function transform(file, api) {
- const j = api.jscodeshift
- const root = j(file.source)
- const preserveLeadingComments = setupPreserveLeadingComments(j, root)
- const jsxElements = root
- .find(j.ImportDeclaration, {
- source: {
- value: '@primer/react',
- },
- })
- .filter(path => {
- return path.value.specifiers.some(specifier => {
- return specifier.imported.name === 'LinkButton'
- })
- })
- .map(path => {
- const importSpecifier = path.value.specifiers.find(specifier => {
- return specifier.imported.name === 'LinkButton'
- })
- return j(path).closestScope().findJSXElements(importSpecifier.local.name).paths()
- })
-
- jsxElements.forEach(path => {
- j(path)
- .find(j.JSXAttribute)
- .forEach(attributePath => {
- const jsxAttribute = attributePath.value
- const name = jsxAttribute.name.name
-
- if (name === 'leadingIcon') {
- j(attributePath.get('name')).replaceWith(j.jsxIdentifier('leadingVisual'))
- }
-
- if (name === 'trailingIcon') {
- j(attributePath.get('name')).replaceWith(j.jsxIdentifier('trailingVisual'))
- }
-
- if (name === 'variant' && jsxAttribute.value.value === 'outline') {
- j(attributePath.get('value')).replaceWith(j.stringLiteral('invisible'))
- }
- })
- })
-
- preserveLeadingComments()
-
- return format(file, root.toSource())
-}
-
-module.exports = transform
-module.exports.parser = 'tsx'
diff --git a/packages/react/codemods/v36/update-button-counter.js b/packages/react/codemods/v36/update-button-counter.js
deleted file mode 100644
index cd344d972d1..00000000000
--- a/packages/react/codemods/v36/update-button-counter.js
+++ /dev/null
@@ -1,126 +0,0 @@
-'use strict'
-
-const {setupPreserveLeadingComments} = require('../lib/preserveLeadingComments')
-const {format} = require('../lib/format')
-
-function transform(file, api) {
- const j = api.jscodeshift
- const root = j(file.source)
- const preserveLeadingComments = setupPreserveLeadingComments(j, root)
-
- let identifier = null
- const imported = root.find(j.ImportDeclaration).filter(path => {
- if (!path.node.source.value.startsWith('@primer/react')) {
- return false
- }
-
- const specifier = path.node.specifiers.find(specifier => {
- return specifier.imported.name === 'Button'
- })
-
- if (specifier) {
- identifier = specifier.local.name
- return true
- }
-
- return false
- })
-
- if (!imported || identifier === null) {
- return
- }
-
- root
- .find(j.JSXElement, {
- openingElement: {
- name: {
- object: {
- name: identifier,
- },
- property: {
- name: 'Counter',
- },
- },
- },
- })
- .forEach(path => {
- const children = path.node.children
-
- // If there is more than one child we are unable to perform the transform
- if (children.length > 1) {
- return
- }
-
- const [firstChild] = children
- let value = null
-
- if (firstChild.type === 'JSXText') {
- const parsed = parseInt(firstChild.value, 10)
- // Try to parse the value as a number
- if (!isNaN(parsed)) {
- value = j.numericLiteral(parsed)
- }
- } else if (firstChild.type === 'JSXExpressionContainer') {
- value = firstChild.expression
- }
-
- // Unable to map the value of the child to a prop
- if (value === null) {
- return
- }
-
- const button = j(path).closest(j.JSXElement, {
- openingElement: {
- name: {
- name: identifier,
- },
- },
- })
-
- // Unable to find a parent