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

Use JSX automatic import transform #227

Merged
merged 1 commit into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"no-var": 2,
"one-var": [2, "never"],
"quotes": [2, "single"],
"react/react-in-jsx-scope": 0,
"semi": 2,
"space-before-function-paren": 2,
"spaced-comment": 2,
Expand Down
9 changes: 8 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const serverBundle = {
'node:http',
'prop-types',
'react',
'react/jsx-runtime',
'react-bootstrap-typeahead',
'react-dom/server',
'react-helmet',
Expand All @@ -34,6 +35,7 @@ const serverBundle = {
},
plugins: [
esbuild({
jsx: 'automatic',
jsxFactory: 'React.createElement',
jsxFragment: 'React.Fragment'
}),
Expand Down Expand Up @@ -61,7 +63,12 @@ const clientScriptsBundle = {
}),
babel({
babelHelpers: 'bundled',
presets: ['@babel/preset-react'],
presets: [
[
'@babel/preset-react',
{ runtime: 'automatic' }
]
],
extensions: ['.js', '.jsx']
}),
commonjs(),
Expand Down
1 change: 0 additions & 1 deletion src/react/AppRoutes.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { Route, Routes, useLocation } from 'react-router-dom';

import Layout from './Layout.jsx';
Expand Down
2 changes: 1 addition & 1 deletion src/react/Layout.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React, { useEffect } from 'react';
import { useEffect } from 'react';
import { connect } from 'react-redux';
import { Helmet } from 'react-helmet';
import { useMatch } from 'react-router-dom';
Expand Down
1 change: 0 additions & 1 deletion src/react/client-mount.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { hydrateRoot } from 'react-dom/client';
import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom';
Expand Down
1 change: 0 additions & 1 deletion src/react/components/AppendedCoEntities.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

import { Entities } from './index.js';

Expand Down
1 change: 0 additions & 1 deletion src/react/components/AppendedDate.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

import { formatDate } from '../../lib/format-date.js';

Expand Down
6 changes: 3 additions & 3 deletions src/react/components/AppendedDepictions.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Fragment } from 'react';

const AppendedDepictions = props => {

Expand All @@ -11,7 +11,7 @@ const AppendedDepictions = props => {
{
depictions
.map((depiction, index) =>
<React.Fragment key={index}>
<Fragment key={index}>

{
depiction.displayName && (
Expand All @@ -33,7 +33,7 @@ const AppendedDepictions = props => {
)
}

</React.Fragment>
</Fragment>
)
.reduce((accumulator, currentValue) => [accumulator, ' /', currentValue])
}
Expand Down
1 change: 0 additions & 1 deletion src/react/components/AppendedEmployerCompany.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

import { CommaSeparatedInstanceLinks, InstanceLink } from './index.js';

Expand Down
1 change: 0 additions & 1 deletion src/react/components/AppendedEntities.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

import { Entities } from './index.js';

Expand Down
1 change: 0 additions & 1 deletion src/react/components/AppendedFormatAndYear.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

const AppendedFormatAndYear = props => {

Expand Down
1 change: 0 additions & 1 deletion src/react/components/AppendedMembers.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

import { CommaSeparatedInstanceLinks } from './index.js';

Expand Down
6 changes: 3 additions & 3 deletions src/react/components/AppendedPerformers.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Fragment } from 'react';

import { InstanceLink, JoinedRoles } from './index.js';

Expand All @@ -15,7 +15,7 @@ const AppendedPerformers = props => {
{
performers
.map((performer, index) =>
<React.Fragment key={index}>
<Fragment key={index}>

<InstanceLink instance={performer} />

Expand Down Expand Up @@ -53,7 +53,7 @@ const AppendedPerformers = props => {
)
}

</React.Fragment>
</Fragment>
)
.reduce((accumulator, currentValue) => [accumulator, ' / ', currentValue])
}
Expand Down
1 change: 0 additions & 1 deletion src/react/components/AppendedProductionDates.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

import { formatDate } from '../../lib/format-date.js';

Expand Down
6 changes: 3 additions & 3 deletions src/react/components/AppendedProductionTeamCredits.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Fragment } from 'react';

import { AppendedCoEntities, AppendedEmployerCompany, AppendedMembers } from './index.js';

Expand All @@ -15,7 +15,7 @@ const AppendedProductionTeamCredits = props => {
{
credits
.map((credit, index) =>
<React.Fragment key={index}>
<Fragment key={index}>

<>{ credit.name }</>

Expand All @@ -37,7 +37,7 @@ const AppendedProductionTeamCredits = props => {
)
}

</React.Fragment>
</Fragment>
)
.reduce((accumulator, currentValue) => [accumulator, '; ', currentValue])
}
Expand Down
1 change: 0 additions & 1 deletion src/react/components/AppendedQualifier.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

const AppendedQualifier = props => {

Expand Down
1 change: 0 additions & 1 deletion src/react/components/AppendedRoles.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

import { JoinedRoles } from './index.js';

Expand Down
1 change: 0 additions & 1 deletion src/react/components/AppendedVenue.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

import { VenueLinkWithContext } from './index.js';

Expand Down
1 change: 0 additions & 1 deletion src/react/components/CharactersList.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

import { AppendedQualifier, InstanceLink, ListWrapper } from './index.js';

Expand Down
6 changes: 3 additions & 3 deletions src/react/components/CommaSeparatedInstanceLinks.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Fragment } from 'react';

import { InstanceLink } from './index.js';

Expand All @@ -13,11 +13,11 @@ const CommaSeparatedInstanceLinks = props => {
{
instances
.map((instance, index) =>
<React.Fragment key={index}>
<Fragment key={index}>

<InstanceLink key={index} instance={instance} />

</React.Fragment>
</Fragment>
)
.reduce((accumulator, currentValue) => [accumulator, ', ', currentValue])
}
Expand Down
6 changes: 3 additions & 3 deletions src/react/components/CommaSeparatedMaterials.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Fragment } from 'react';

import { MaterialLinkWithContext } from './index.js';

Expand All @@ -13,11 +13,11 @@ const CommaSeparatedMaterials = props => {
{
materials
.map((material, index) =>
<React.Fragment key={index}>
<Fragment key={index}>

<MaterialLinkWithContext material={material} />

</React.Fragment>
</Fragment>
)
.reduce((accumulator, currentValue) => [accumulator, ', ', currentValue])
}
Expand Down
6 changes: 3 additions & 3 deletions src/react/components/CommaSeparatedProductions.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Fragment } from 'react';

import { ProductionLinkWithContext } from './index.js';

Expand All @@ -13,11 +13,11 @@ const CommaSeparatedProductions = props => {
{
productions
.map((production, index) =>
<React.Fragment key={index}>
<Fragment key={index}>

<ProductionLinkWithContext production={production} />

</React.Fragment>
</Fragment>
)
.reduce((accumulator, currentValue) => [accumulator, ', ', currentValue])
}
Expand Down
1 change: 0 additions & 1 deletion src/react/components/CreativeProductionsList.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

import { AppendedProductionTeamCredits, ProductionLinkWithContext, ListWrapper } from './index.js';

Expand Down
1 change: 0 additions & 1 deletion src/react/components/CrewProductionsList.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

import { AppendedProductionTeamCredits, ProductionLinkWithContext, ListWrapper } from './index.js';

Expand Down
6 changes: 3 additions & 3 deletions src/react/components/Entities.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Fragment } from 'react';

import { AppendedMembers, InstanceLink } from './index.js';

Expand All @@ -13,7 +13,7 @@ const Entities = props => {
{
entities
.map((entity, index) =>
<React.Fragment key={index}>
<Fragment key={index}>

<InstanceLink instance={entity} />

Expand All @@ -23,7 +23,7 @@ const Entities = props => {
)
}

</React.Fragment>
</Fragment>
)
.reduce((accumulator, currentValue) => [accumulator, ', ', currentValue])
}
Expand Down
1 change: 0 additions & 1 deletion src/react/components/ErrorMessage.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Helmet } from 'react-helmet';

import { PageTitle } from './index.js';
Expand Down
1 change: 0 additions & 1 deletion src/react/components/FestivalLinkWithContext.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

import { InstanceLink, PrependedSurInstance } from './index.js';

Expand Down
2 changes: 0 additions & 2 deletions src/react/components/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

const Footer = () => {

return (
Expand Down
1 change: 0 additions & 1 deletion src/react/components/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { Link } from 'react-router-dom';

import { SearchBar } from './index.js';
Expand Down
1 change: 0 additions & 1 deletion src/react/components/InstanceDocumentTitle.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Helmet } from 'react-helmet';

import { MODEL_TO_DISPLAY_NAME_MAP } from '../../utils/constants.js';
Expand Down
1 change: 0 additions & 1 deletion src/react/components/InstanceFacet.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

const InstanceFacet = props => {

Expand Down
1 change: 0 additions & 1 deletion src/react/components/InstanceLabel.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

import { MODEL_TO_DISPLAY_NAME_MAP } from '../../utils/constants.js';

Expand Down
1 change: 0 additions & 1 deletion src/react/components/InstanceLink.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';
import { NavLink } from 'react-router-dom';

import { MODEL_TO_ROUTE_MAP } from '../../utils/constants.js';
Expand Down
1 change: 0 additions & 1 deletion src/react/components/InstanceLinksList.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

import { InstanceLink, ListWrapper } from './index.js';

Expand Down
6 changes: 3 additions & 3 deletions src/react/components/JoinedRoles.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Fragment } from 'react';

import { AppendedQualifier, InstanceLink } from './index.js';

Expand All @@ -13,7 +13,7 @@ const JoinedRoles = props => {
{
instances
.map((instance, index) =>
<React.Fragment key={index}>
<Fragment key={index}>

<span className="fictional-name-text">

Expand All @@ -37,7 +37,7 @@ const JoinedRoles = props => {
)
}

</React.Fragment>
</Fragment>
)
.reduce((accumulator, currentValue) => [accumulator, ' / ', currentValue])
}
Expand Down
1 change: 0 additions & 1 deletion src/react/components/ListWrapper.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

const ListWrapper = props => {

Expand Down
1 change: 0 additions & 1 deletion src/react/components/MaterialLinkWithContext.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

import { AppendedFormatAndYear, InstanceLink, PrependedSurInstance, WritingCredits } from './index.js';

Expand Down
1 change: 0 additions & 1 deletion src/react/components/MaterialsList.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types';
import React from 'react';

import { ListWrapper, MaterialLinkWithContext } from './index.js';

Expand Down
1 change: 0 additions & 1 deletion src/react/components/Navigation.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { Link } from 'react-router-dom';

const Navigation = () => {
Expand Down
Loading