Skip to content

Commit b7dba4b

Browse files
committed
satisfy coding style rules & rebuild the JS dist
1 parent 83bf0ca commit b7dba4b

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/React/assets/dist/register_controller.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ function registerReactControllerComponents(context) {
1010
const component = reactControllers[`./${name}.jsx`] || reactControllers[`./${name}.tsx`];
1111
if (typeof component === 'undefined') {
1212
const possibleValues = Object.keys(reactControllers).map((key) => key.replace('./', '').replace('.jsx', '').replace('.tsx', ''));
13+
if (possibleValues.includes(name)) {
14+
throw new Error(`
15+
React controller "${name}" could not be resolved. Ensure the module exports the controller as a default export.`);
16+
}
1317
throw new Error(`React controller "${name}" does not exist. Possible values: ${possibleValues.join(', ')}`);
1418
}
1519
return component;

src/React/assets/src/register_controller.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ export function registerReactControllerComponents(context: __WebpackModuleApi.Re
3939
);
4040

4141
if (possibleValues.includes(name)) {
42-
throw new Error(
43-
`React controller "${name}" could not be resolved. Ensure the module exports the controller as default.`
44-
);
42+
throw new Error(`
43+
React controller "${name}" could not be resolved. Ensure the module exports the controller as a default export.`);
4544
}
4645

4746
throw new Error(`React controller "${name}" does not exist. Possible values: ${possibleValues.join(', ')}`);

src/React/assets/test/register_controller.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ describe('registerReactControllerComponents', () => {
5151
registerReactControllerComponents(createFakeFixturesContext());
5252
const resolveComponent = (window as any).resolveReactComponent;
5353

54-
expect(() => resolveComponent('NoDefaultExportComponent')).toThrow('React controller "NoDefaultExportComponent" could not be resolved. Ensure the module exports the controller as default.');
54+
expect(() => resolveComponent('NoDefaultExportComponent')).toThrow(
55+
'React controller "NoDefaultExportComponent" could not be resolved. Ensure the module exports the controller as a default export.'
56+
);
5557
});
5658
});

0 commit comments

Comments
 (0)