sindresorhus/eslint-plugin-unicorn

Rule proposal: mistaken parentheses

クローズ

#1,796 opened on 2022/04/19

 (7 件のコメント) (2 件のリアクション) (0 人の担当者)JavaScript (468 件のフォーク)user submission
help wantednew rule

Repository metrics

Stars
 (5,022 個のスター)
PR merge metrics
 (平均マージ 4h 30m) (30d で 26 merged PRs)

説明

Description

There's a certain type of errors that can be hard to spot and will work fine. Since it's valid to do operations like || in this context is it even possible to have a rule that could notice when you might have meant the other one?

Fail

This is what you wrote

str.startsWith('str' || str.startsWith('str'))

Pass

This is what you meant

str.startsWith('str') || str.startsWith('str')

Additional Info

No response

コントリビューターガイド