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

TypeScript Lexer: JSX Node properties with dashes flagged as syntax errors #939

Closed
1 task done
jaller94 opened this issue Feb 27, 2024 · 1 comment · Fixed by #952
Closed
1 task done

TypeScript Lexer: JSX Node properties with dashes flagged as syntax errors #939

jaller94 opened this issue Feb 27, 2024 · 1 comment · Fixed by #952
Labels

Comments

@jaller94
Copy link

jaller94 commented Feb 27, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Custom JSX Node properties, like data-test-id are causing an error.

The lexer doesn't like the dashes.

import React from 'react';

export function Outro(): React.JSX.Element {
    return (
        <p
            data-test-id="outro"
        >Thanks for reading!</p>
    );
}

Screenshot 2024-02-27 at 21-03-53 JSX in TypeScript

To Reproduce

https://swapoff.org/chroma/playground/#eyJsYW5ndWFnZSI6IlR5cGVTY3JpcHQiLCJzdHlsZSI6Im1vbm9rYWlsaWdodCIsInRleHQiOiJpbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnO1xuXG5leHBvcnQgZnVuY3Rpb24gT3V0cm8oKTogUmVhY3QuSlNYLkVsZW1lbnQge1xuICAgIHJldHVybiAoXG4gICAgICAgIDxwXG4gICAgICAgICAgICBkYXRhLXRlc3QtaWQ9XCJvdXRyb1wiXG4gICAgICAgID5UaGFua3MgZm9yIHJlYWRpbmchPC9wPlxuICAgICk7XG59IiwiY2xhc3NlcyI6ZmFsc2V9

@jaller94 jaller94 added the bug label Feb 27, 2024
@jaller94
Copy link
Author

Most likely rules to be changed:

Gusted added a commit to Gusted/chroma that referenced this issue Apr 1, 2024
- Allow comments to be inside of tags.
- Fixes the lexing of `<!--` comments.
- Allow tag names to include `-`.
- Added tests.
- Resolves alecthomas#940
- Resolves alecthomas#939
Gusted added a commit to Gusted/chroma that referenced this issue Apr 2, 2024
- Allow comments to be inside of tags.
- Fixes the lexing of `<!--` comments.
- Allow tag names to include `-`.
- Modify module rule to be more strict which is to match `declare module
"Module name"`.
- Added tests.
- Resolves alecthomas#940
- Resolves alecthomas#939
- Resolves alecthomas#801
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant