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

7.18.2 regression: react/jsx-indent lots of false positives #2563

Closed
martinpitt opened this issue Feb 2, 2020 · 6 comments · Fixed by #2564
Closed

7.18.2 regression: react/jsx-indent lots of false positives #2563

martinpitt opened this issue Feb 2, 2020 · 6 comments · Fixed by #2564
Labels

Comments

@martinpitt
Copy link

Since the last version 7.18.2, eslinting cockpit gets tons of false positives like these:

/var/home/martin/upstream/cockpit/pkg/systemd/init.js
  1326:20  error  Expected indentation of 12 space characters but found 0  react/jsx-indent
  1327:23  error  Expected indentation of 12 space characters but found 0  react/jsx-indent
  1327:23  error  Expected indentation of 12 space characters but found 0  react/jsx-indent
  1328:21  error  Expected indentation of 12 space characters but found 0  react/jsx-indent
  1329:23  error  Expected indentation of 12 space characters but found 0  react/jsx-indent

on this code, which seems perfectly well indented:

    function create_timer_file() {
        var unit = "[Unit]\nDescription=";
        var service = "\n[Service]\nExecStart=";
        var timer = "\n[Timer]\n";
        var install = "[Install]\nWantedBy=timers.target\n";
        var service_file = unit + timer_unit.Description + service + timer_unit.Command + "\n";

The dozens of other errors are also wrong. Things were fine until 7.18.0, I haven't tested 7.18.1 yet.

martinpitt added a commit to martinpitt/cockpit that referenced this issue Feb 2, 2020
7.18.1 or .2 has a major regression with tons of false positives for
react/jsx-indent.

See jsx-eslint/eslint-plugin-react#2563
@martinpitt
Copy link
Author

More direct reproducer:

curl -O https://raw.githubusercontent.com/cockpit-project/cockpit/master/pkg/systemd/init.js
node_modules/.bin/eslint ./init.js

works fine with 7.18.0, fails with 7.18.2.

This file isn't that special, it affects a lot of other files in our tree. This smells like a rather generic parsing regression.

@ljharb ljharb added the bug label Feb 2, 2020
@ljharb
Copy link
Member

ljharb commented Feb 2, 2020

cc @toshi-toma

@ljharb
Copy link
Member

ljharb commented Feb 2, 2020

It should definitely only be matching jsxtext/literals inside jsx.

What version of eslint are you using?

@martinpitt
Copy link
Author

We currently use 6.8.0, matching package.json's "eslint": "^6.2.2".

That is the current version AFAICS.

I copied the complete package-lock.json here: https://piware.de/tmp/package-lock.json

@toshi-toma
Copy link
Contributor

@ljharb @martinpitt

I'm really sorry...
This bug is caused by my mistake.

Anyway, I created PR.(#2564 )
I'll under investigation for other cases.

@ljharb ljharb closed this as completed in 8b576be Feb 3, 2020
@martinpitt
Copy link
Author

@toshi-toma : Many thanks for the super-fast fix!

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

Successfully merging a pull request may close this issue.

3 participants