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

no-unused-expressions reported on {' '} #548

Open
4 tasks done
karlhorky opened this issue Aug 7, 2024 · 2 comments
Open
4 tasks done

no-unused-expressions reported on {' '} #548

karlhorky opened this issue Aug 7, 2024 · 2 comments

Comments

@karlhorky
Copy link

karlhorky commented Aug 7, 2024

Initial checklist

Affected packages and versions

eslint-plugin-mdx@3.1.5

Link to runnable example

No response

Steps to reproduce

  1. Set up eslint-plugin-mdx@3.1.5 using the recommended config
  2. Lint the following file

index.mdx

Before{' '}after

Observe that a problem is reported on the {' '}:

Screenshot 2024-08-07 at 18 28 31

Expected an assignment or function call and instead saw an expression. eslint no-unused-expressions

Possibly related

Expected behavior

No problem is reported

I'm assuming this should be accepted syntax because the MDX Playground shows that the {' '} will result in a space:

Screenshot 2024-08-07 at 18 28 47

Actual behavior

Problem is reported, as above

Runtime

No response

Package manager

No response

OS

macOS

Build and bundle tools

No response

@ChristianMurphy
Copy link
Member

@karlhorky the expression does indeed look like it isn't needed, it could be a space.
Is you concern with the word "unused"? Do you see this more as being a different rule, like "no-useless-expression"?

@karlhorky
Copy link
Author

My thought here is that this isn't actually invalid syntax - it's a valid style in case a user would want to use it (eg. for our projects, we would like to use a space in JSX expression interpolation to avoid formatting problems with Prettier, rather than taking the route of disabling Prettier)

Stylistically, I can see how this is arguably an interesting rule for some users, but I would suggest that it doesn't absolutely need to be default

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

No branches or pull requests

2 participants