Skip to content

Commit 43758c9

Browse files
committed
Add extensions to imports
1 parent 9be0f85 commit 43758c9

40 files changed

+120
-108
lines changed

eslint.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ const config = tsEslint.config([
133133
'jsx-a11y/anchor-is-valid': 'off',
134134
},
135135
},
136+
{
137+
files: ['node_package/**/*'],
138+
rules: {
139+
'import/extensions': ['error', 'ignorePackages'],
140+
},
141+
},
136142
{
137143
files: ['lib/generators/react_on_rails/templates/**/*'],
138144
rules: {

node_package/src/Authenticity.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { AuthenticityHeaders } from './types/index';
1+
import type { AuthenticityHeaders } from './types/index.ts';
22

33
export function authenticityToken(): string | null {
44
const token = document.querySelector('meta[name="csrf-token"]');

node_package/src/CallbackRegistry.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { ItemRegistrationCallback } from './types';
2-
import { onPageLoaded, onPageUnloaded } from './pageLifecycle';
3-
import { getRailsContext } from './context';
1+
import { ItemRegistrationCallback } from './types/index.ts';
2+
import { onPageLoaded, onPageUnloaded } from './pageLifecycle.ts';
3+
import { getRailsContext } from './context.ts';
44

55
/**
66
* Represents information about a registered item including its value,

node_package/src/ClientSideRenderer.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33

44
import * as ReactDOM from 'react-dom';
55
import type { ReactElement } from 'react';
6-
import type { RailsContext, RegisteredComponent, RenderFunction, Root } from './types';
7-
8-
import { getRailsContext, resetRailsContext } from './context';
9-
import createReactOutput from './createReactOutput';
10-
import { isServerRenderHash } from './isServerRenderResult';
11-
import reactHydrateOrRender from './reactHydrateOrRender';
12-
import { supportsRootApi } from './reactApis';
13-
import { debugTurbolinks } from './turbolinksUtils';
14-
import * as StoreRegistry from './StoreRegistry';
15-
import * as ComponentRegistry from './ComponentRegistry';
6+
import type { RailsContext, RegisteredComponent, RenderFunction, Root } from './types/index.ts';
7+
8+
import { getRailsContext, resetRailsContext } from './context.ts';
9+
import createReactOutput from './createReactOutput.ts';
10+
import { isServerRenderHash } from './isServerRenderResult.ts';
11+
import reactHydrateOrRender from './reactHydrateOrRender.ts';
12+
import { supportsRootApi } from './reactApis.ts';
13+
import { debugTurbolinks } from './turbolinksUtils.ts';
14+
import * as StoreRegistry from './StoreRegistry.ts';
15+
import * as ComponentRegistry from './ComponentRegistry.ts';
1616

1717
const REACT_ON_RAILS_STORE_ATTRIBUTE = 'data-js-react-on-rails-store';
1818

node_package/src/ComponentRegistry.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { type RegisteredComponent, type ReactComponentOrRenderFunction } from './types';
2-
import isRenderFunction from './isRenderFunction';
3-
import CallbackRegistry from './CallbackRegistry';
1+
import { type RegisteredComponent, type ReactComponentOrRenderFunction } from './types/index.ts';
2+
import isRenderFunction from './isRenderFunction.ts';
3+
import CallbackRegistry from './CallbackRegistry.ts';
44

55
const componentRegistry = new CallbackRegistry<RegisteredComponent>('component');
66

node_package/src/RSCClientRoot.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import * as React from 'react';
44
import * as ReactDOMClient from 'react-dom/client';
55
import { createFromReadableStream } from 'react-on-rails-rsc/client';
6-
import { fetch } from './utils';
7-
import transformRSCStreamAndReplayConsoleLogs from './transformRSCStreamAndReplayConsoleLogs';
8-
import { RailsContext, RenderFunction } from './types';
6+
import { fetch } from './utils.ts';
7+
import transformRSCStreamAndReplayConsoleLogs from './transformRSCStreamAndReplayConsoleLogs.ts';
8+
import { RailsContext, RenderFunction } from './types/index.ts';
99

1010
const { use } = React;
1111

node_package/src/ReactOnRails.client.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type { ReactElement } from 'react';
2-
import * as ClientStartup from './clientStartup';
3-
import { renderOrHydrateComponent, hydrateStore } from './ClientSideRenderer';
4-
import * as ComponentRegistry from './ComponentRegistry';
5-
import * as StoreRegistry from './StoreRegistry';
6-
import buildConsoleReplay from './buildConsoleReplay';
7-
import createReactOutput from './createReactOutput';
8-
import * as Authenticity from './Authenticity';
2+
import * as ClientStartup from './clientStartup.ts';
3+
import { renderOrHydrateComponent, hydrateStore } from './ClientSideRenderer.ts';
4+
import * as ComponentRegistry from './ComponentRegistry.ts';
5+
import * as StoreRegistry from './StoreRegistry.ts';
6+
import buildConsoleReplay from './buildConsoleReplay.ts';
7+
import createReactOutput from './createReactOutput.ts';
8+
import * as Authenticity from './Authenticity.ts';
99
import type {
1010
RegisteredComponent,
1111
RenderResult,
@@ -15,8 +15,8 @@ import type {
1515
Store,
1616
StoreGenerator,
1717
ReactOnRailsOptions,
18-
} from './types';
19-
import reactHydrateOrRender from './reactHydrateOrRender';
18+
} from './types/index.ts';
19+
import reactHydrateOrRender from './reactHydrateOrRender.ts';
2020

2121
if (globalThis.ReactOnRails !== undefined) {
2222
throw new Error(`\
@@ -194,5 +194,5 @@ globalThis.ReactOnRails.resetOptions();
194194

195195
ClientStartup.clientStartup();
196196

197-
export * from './types';
197+
export * from './types/index.ts';
198198
export default globalThis.ReactOnRails;

node_package/src/ReactOnRails.full.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import handleError from './handleError';
2-
import serverRenderReactComponent from './serverRenderReactComponent';
3-
import type { RenderParams, RenderResult, ErrorOptions } from './types';
1+
import handleError from './handleError.ts';
2+
import serverRenderReactComponent from './serverRenderReactComponent.ts';
3+
import type { RenderParams, RenderResult, ErrorOptions } from './types/index.ts';
44

5-
import Client from './ReactOnRails.client';
5+
import Client from './ReactOnRails.client.ts';
66

77
if (typeof window !== 'undefined') {
88
// warn to include a collapsed stack trace
@@ -16,5 +16,5 @@ Client.handleError = (options: ErrorOptions): string | undefined => handleError(
1616
Client.serverRenderReactComponent = (options: RenderParams): null | string | Promise<RenderResult> =>
1717
serverRenderReactComponent(options);
1818

19-
export * from './types';
19+
export * from './types/index.ts';
2020
export default Client;
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import ReactOnRails from './ReactOnRails.full';
2-
import streamServerRenderedReactComponent from './streamServerRenderedReactComponent';
1+
import ReactOnRails from './ReactOnRails.full.ts';
2+
import streamServerRenderedReactComponent from './streamServerRenderedReactComponent.ts';
33

44
ReactOnRails.streamServerRenderedReactComponent = streamServerRenderedReactComponent;
55

6-
export * from './ReactOnRails.full';
6+
export * from './ReactOnRails.full.ts';
77
// eslint-disable-next-line no-restricted-exports -- see https://github.com/eslint/eslint/issues/15617
8-
export { default } from './ReactOnRails.full';
8+
export { default } from './ReactOnRails.full.ts';

node_package/src/ReactOnRailsRSC.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { renderToPipeableStream } from 'react-on-rails-rsc/server.node';
22
import { PassThrough, Readable } from 'stream';
33

4-
import { RSCRenderParams, StreamRenderState, StreamableComponentResult } from './types';
5-
import ReactOnRails from './ReactOnRails.full';
6-
import buildConsoleReplay from './buildConsoleReplay';
7-
import handleError from './handleError';
8-
import { convertToError, createResultObject } from './serverRenderUtils';
4+
import { RSCRenderParams, StreamRenderState, StreamableComponentResult } from './types/index.ts';
5+
import ReactOnRails from './ReactOnRails.full.ts';
6+
import buildConsoleReplay from './buildConsoleReplay.ts';
7+
import handleError from './handleError.ts';
8+
import { convertToError, createResultObject } from './serverRenderUtils.ts';
99

1010
import {
1111
streamServerRenderedComponent,
1212
transformRenderStreamChunksToResultObject,
13-
} from './streamServerRenderedReactComponent';
14-
import loadReactClientManifest from './loadReactClientManifest';
13+
} from './streamServerRenderedReactComponent.ts';
14+
import loadReactClientManifest from './loadReactClientManifest.ts';
1515

1616
const stringToStream = (str: string) => {
1717
const stream = new PassThrough();
@@ -67,5 +67,5 @@ ReactOnRails.serverRenderRSCReactComponent = (options: RSCRenderParams) => {
6767
}
6868
};
6969

70-
export * from './types';
70+
export * from './types/index.ts';
7171
export default ReactOnRails;

0 commit comments

Comments
 (0)