Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

build(deps): remove babel-plugin-transform-es2015-modules-commonjs #7114

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/MonorepoRoutes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ function MonorepoRoutes() {
MonorepoRoutes.createRouteFromReactElement = (element, parentRoute) => {
const monorepoRoutes = createRoutesFromReactChildren(
<Route path='projects'>
{SLUGS.map(slug => <MonorepoRoute path={slug} />)}
{SLUGS.map(slug => <MonorepoRoute key={slug} path={slug} />)}
<Route path=':locale'>
{SLUGS.map(slug => <MonorepoRoute path={slug} />)}
{SLUGS.map(slug => <MonorepoRoute key={slug} path={slug} />)}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really related to the other changes here, but the missing key warnings made real React errors harder to spot while I was chasing down a couple of bugs in this PR. So this makes the console a little bit less noisy.

Copy link
Contributor Author

@eatyourgreens eatyourgreens May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#7116 also got in the way of debugging React errors on this branch, so I might fix that here too.

</Route>
</Route>,
parentRoute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const taskNames = {

const DEFAULT_HANDLER = () => {};

function EditStepDialog({
function EditStepDialogWithRef({
allTasks = {},
deleteTask,
enforceLimitedBranchingRule,
Expand Down Expand Up @@ -117,6 +117,8 @@ function EditStepDialog({
);
}

const EditStepDialog = forwardRef(EditStepDialogWithRef);

EditStepDialog.propTypes = {
allTasks: PropTypes.object,
deleteTask: PropTypes.func,
Expand All @@ -134,4 +136,4 @@ function onSubmit(e) {
return false;
}

export default forwardRef(EditStepDialog);
export default EditStepDialog;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import TaskIcon from '../../../icons/TaskIcon.jsx';

const DEFAULT_HANDLER = () => {};

function NewTaskDialog({
function NewTaskDialogWithRef({
addTask = DEFAULT_HANDLER,
enforceLimitedBranchingRule,
openEditStepDialog = DEFAULT_HANDLER,
Expand Down Expand Up @@ -122,6 +122,8 @@ function NewTaskDialog({
);
}

const NewTaskDialog = forwardRef(NewTaskDialogWithRef);

NewTaskDialog.propTypes = {
addTask: PropTypes.func,
enforceLimitedBranchingRule: PropTypes.shape({
Expand All @@ -136,4 +138,4 @@ function onSubmit(e) {
return false;
}

export default forwardRef(NewTaskDialog);
export default NewTaskDialog;
2 changes: 1 addition & 1 deletion app/pages/lab/field-guide/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,4 @@ var actions = {
}
};

module.exports = actions;
export default actions;
2 changes: 1 addition & 1 deletion app/pages/lab/field-guide/index.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ createReactClass = require 'create-react-class'
ArticleList = require './article-list'
Dialog = require 'modal-form/dialog'
ArticleEditor = require './article-editor'
actions = require './actions'
actions = require('./actions').default
getAllLinked = require('../../../lib/get-all-linked').default

unless process.env.NODE_ENV is 'production'
Expand Down
2 changes: 1 addition & 1 deletion app/pages/project/stats/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ ProjectStatsPageController.propTypes = {
params: PropTypes.object
};

module.exports = ProjectStatsPageController;
export default ProjectStatsPageController;
5 changes: 3 additions & 2 deletions app/router.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import IIIFSubjectSet from './pages/lab/iiif'
import projectLab from './pages/lab/project.jsx'
import Collaborators from './pages/lab/collaborators.jsx'
import PagesEditor from './pages/lab-pages-editor'
import ProjectStatsPage from './pages/project/stats'

// <Redirect from="home" to="/" /> doesn't work.

Expand Down Expand Up @@ -192,7 +193,7 @@ export const routes = (
<Route path=":board" component={require('./talk/board')} />
<Route path=":board/:discussion" component={require('./talk/discussion')} />
</Route>
<Route path="stats" component={require('./pages/project/stats')} />
<Route path="stats" component={ProjectStatsPage} />
<Route path="favorites" component={require('./pages/collections/index')}>
<IndexRoute component={require('./pages/collections/favorites-list')} />
<Route path=":collection_owner" component={require('./pages/collections/favorites-list')} />
Expand Down Expand Up @@ -247,7 +248,7 @@ export const routes = (
<Route path=":board" component={require('./talk/board')} />
<Route path=":board/:discussion" component={require('./talk/discussion')} />
</Route>
<Route path="stats" component={require('./pages/project/stats')} />
<Route path="stats" component={ProjectStatsPage} />
<Route path="favorites" component={require('./pages/collections/index')}>
<IndexRoute component={require('./pages/collections/favorites-list')} />
<Route path=":collection_owner" component={require('./pages/collections/favorites-list')} />
Expand Down
25 changes: 1 addition & 24 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = function (api) {
api.cache(true);
return {
sourceType: 'module',
Copy link
Contributor Author

@eatyourgreens eatyourgreens May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://babeljs.io/docs/options#sourcetype. ESM is the default for Babel 7.

plugins: [
[
'@babel/plugin-transform-runtime',
Expand All @@ -14,34 +15,10 @@ module.exports = function (api) {
['@babel/preset-react', { runtime: 'automatic' }]
],
env: {
development: {
plugins: [
[
'transform-es2015-modules-commonjs'
]
]
},
staging: {
plugins: [
[
'transform-es2015-modules-commonjs'
]
]
},
production: {
plugins: [
[
'transform-es2015-modules-commonjs'
]
]
},
test: {
plugins: [
[
'babel-plugin-rewire'
],
[
'transform-es2015-modules-commonjs'
]
]
}
Expand Down
Loading
Loading