quick-lint / quick-lint-js

quick-lint-js finds bugs in JavaScript programs
https://quick-lint-js.com
GNU General Public License v3.0
1.54k stars 192 forks source link

12$: incorrect precedence with `in` vs `? :` #1143

Open strager opened 10 months ago

strager commented 10 months ago

quick-lint-js falsely diagnoses this code: https://github.com/getsentry/sentry/blob/5d08d3d6f625a7c3d9352edc0fbef641f2d9a768/static/app/views/dashboards/widgetBuilder/buildSteps/filterResultsStep/index.tsx#L136-L138

              (DashboardFilterKeys.RELEASE in location.query
                ? decodeList(location.query[DashboardFilterKeys.RELEASE])
                : dashboardFilters?.[DashboardFilterKeys.RELEASE]) ?? []

I think the cause is quick-lint-js parsing location.query ? ... : ... as the right-hand side of in, rather than parsing DashboardFilterKeys.RELEASE in location.query as the condition for ? :.