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

Support react / JSXText selector? #5

Closed
mnahkies opened this issue Feb 22, 2021 · 2 comments
Closed

Support react / JSXText selector? #5

mnahkies opened this issue Feb 22, 2021 · 2 comments

Comments

@mnahkies
Copy link
Contributor

As far as I can tell the rule fails to find smart quotes that are embedded in JSX expressions.

From poking around at the code it seems like it would have to also match JSXText in addition to Literal here: https://github.com/seleb/eslint-plugin-no-smart-quotes/blob/master/lib/rules/no-smart-quotes.js#L47

Additionally I think it would need to handle auto-fixing differently (the detection part appeared to work fine)

Example component:

import React from 'react';

export const component = () => {
  const found = "We found this '’' one though "
  return (
    <div>
      <h1>We couldn’t find this smart quote</h1>
    </div>
  );
};
@seleb seleb closed this as completed in 874ac64 Feb 23, 2021
@seleb
Copy link
Owner

seleb commented Feb 23, 2021

added support for this in v1.2.0; thanks for the feedback!

@mnahkies
Copy link
Contributor Author

@seleb thanks for the prompt response! I tested it this morning in the project that I was originally having issues with this, and found that the autofix was not working correctly. After a bit of messing around I was able to solve this and have opened a PR here #6

seleb pushed a commit that referenced this issue Feb 23, 2021
- in some project setups node.start / node.end is undefined,
  and results in the auto fix outputing invalid code
github-actions bot pushed a commit that referenced this issue Feb 27, 2021
# 1.0.0 (2021-02-27)

### Features

* add support for `JSXText` ([874ac64](874ac64)), closes [#5](#5)
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