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

Different linting behavior with lintText and lintFiles when using { fix: true, fixTypes: ["layout"] } as options #18732

Closed
1 task
dbaeumer opened this issue Jul 31, 2024 · 1 comment · Fixed by #18736
Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly repro:yes Issues with a reproducible example

Comments

@dbaeumer
Copy link

dbaeumer commented Jul 31, 2024

Environment

Node version: v20.13.1
npm version: v10.8.1
Local ESLint version: v9.8.0 (Currently used)
Global ESLint version: Not found
Operating System: linux 6.6.36.3-microsoft-standard-WSL2

What parser are you using?

Default (Espree)

What did you do?

This lints the file fixError.js both with lintText and with lintFiles. Interestingly they produce different results.

lintText

  • errorCount is 0
  • fixed the upper case comment rule

lintFiles

  • errorCount is 1
  • upper case comment rule is not fixed.

What did you expect to happen?

Both functions produce the same result.

What actually happened?

See above

Link to Minimal Reproducible Example

https://github.com/dbaeumer/eslint-bug.git

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

@dbaeumer dbaeumer added bug ESLint is working incorrectly repro:needed This issue should include a reproducible example labels Jul 31, 2024
@nzakas nzakas added accepted There is consensus among the team that this change meets the criteria for inclusion repro:yes Issues with a reproducible example and removed repro:needed This issue should include a reproducible example labels Jul 31, 2024
@nzakas
Copy link
Member

nzakas commented Jul 31, 2024

Thanks. Indeed, it looks like lintText() isn't apply the fixTypes option and so is just applying all of the fixes.

We'd just need to copy the logic over from lintFiles().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly repro:yes Issues with a reproducible example
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants