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

using @visibleName with spaces does not work #1694

Closed
ThomasRoest opened this issue Sep 16, 2020 · 4 comments
Closed

using @visibleName with spaces does not work #1694

ThomasRoest opened this issue Sep 16, 2020 · 4 comments

Comments

@ThomasRoest
Copy link
Collaborator

ThomasRoest commented Sep 16, 2020

Current behavior

using @visibleName with spaces results in the following error SyntaxError: Missing initializer in const declaration

To reproduce

/**
 * @visibleName Input:  Password
 */

related #1675

@sapegin
Copy link
Member

sapegin commented Sep 21, 2020

Feel free to send a pull request with a fix 👾

@mitsuruog
Copy link
Contributor

React-Styleguidist-Example-Basic-Style-Guide

I can't reproduce it.

@ThomasRoest
could you make a minimum reproducible sample? I need more info.

@ThomasRoest
Copy link
Collaborator Author

ThomasRoest commented May 28, 2021

Can't really reproduce this in other repo's but this is what I found out so far

It seems to happen in evalInContext in https://github.com/styleguidist/react-styleguidist/blob/master/src/loaders/utils/client/evalInContext.ts

the extra spaces cause syntax errors in the body arg?

example body with

@visibleName Input: Text

const React$0 = require('react');
const React = React$0.default || (React$0['React'] || React$0);
// spaces not removed?
const Input  Text$0 = require('./InputText.tsx');
const Input  Text = Input  Text$0.default || (Input  Text$0['Input  Text'] || Input  Text$0);
{
			const react$0 = require('react');
const React = react$0.default || react$0;
const __InputText$0 = require('./InputText');
const InputText = __InputText$0.InputText;

var Example = function () {
	var ref = React.useState("example");
	var value = ref[0];
	var setValue = ref[1];
	return React.createElement( InputText, { value: value, setValue: setValue });
};
return (React.createElement( Example, null ));
		}

@hicotech
Copy link

hicotech commented Nov 9, 2022

I have just run into that with v.11.1.5. It seems that it can be reproduced when @visibleName contains two or more spaces.

Will be fine

/** @visibleName Lorem */
/** @visibleName Lorem ipsum */

Will trigger error

/** @visibleName Lorem ipsum dolor */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants