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

Bug: [prefer-includes] Autofix does not escape special characters #7145

Closed
4 tasks done
somebody1234 opened this issue Jun 28, 2023 · 0 comments · Fixed by #7161
Closed
4 tasks done

Bug: [prefer-includes] Autofix does not escape special characters #7145

somebody1234 opened this issue Jun 28, 2023 · 0 comments · Fixed by #7161
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@somebody1234
Copy link

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=4.9.3&jsx=true&sourceType=module&showAST=es&code=DYUwLgBAzhC8EHIEG4BQB6AOgO3QOjBCjAAooBKIA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Y6RAM0WlubLxYAExTooAdwCG0JpHBgAviEVA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA

Repro Code

as in plahyground:

let s = '';
/\n/.test(s)

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  rules: {
    "@typescript-eslint/prefer-includes": "warn"
  },
};

tsconfig

{
  "compilerOptions": {
  }
}

Expected Result

Autofix doesn't result in invalid code

Actual Result

Autofix changes the code to this:

let s = '';
s.includes('
')

Additional Info

No response

@somebody1234 somebody1234 added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Jun 28, 2023
@Josh-Cena Josh-Cena added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for maintainers to take a look labels Jun 28, 2023
Max10240 added a commit to Max10240/typescript-eslint that referenced this issue Jul 2, 2023
JoshuaKGoldberg pushed a commit that referenced this issue Jul 8, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants