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

Fix for filename -> js identifier conversion has broken conversion #167

Closed
RoystonS opened this issue Dec 19, 2018 · 1 comment
Closed

Comments

@RoystonS
Copy link
Contributor

RoystonS commented Dec 19, 2018

Pull #157 has broken the conversion of filenames that contain numbers in the middle. Previously the filename 'BodyText2' would have produced a component named 'BodyText2', but now the code incorrectly produces 'BodyText' instead because it's stripping numbers from the entire string.

The comment in the code states that identifiers must start with a letter, but the code beneath it doesn't only remove numbers at the start: they're stripped wherever they appear.

2dfb833#diff-6518fffc4e430fcc63cd30eb07131a95R848

Adding a new unit test shows the problem, as it fails:

it('does not remove non-leading non-letters', () => {
  const result = getDefaultExportForFile({ fileName: 'Body2Text' } as ts.SourceFile);
  assert.equal(result, 'Body2Text');
});

I'll raise a PR. (PR #168)

@pvasek
Copy link
Collaborator

pvasek commented Jan 6, 2019

It has been released in v1.12.3. Sorry, somehow overlooked your PR.

@pvasek pvasek closed this as completed Jan 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants