Closed Bug 1944976 Opened 10 months ago Closed 9 months ago

Several eslint rules throw when checking node.arguments

Categories

(Developer Infrastructure :: Lint and Formatting, defect)

defect

Tracking

(firefox137 fixed)

RESOLVED FIXED
137 Branch
Tracking Status
firefox137 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

Details

Attachments

(1 file)

Several eslint rules are assuming some methods have arguments and will throw if it's not the case. For instance:

https://searchfox.org/mozilla-central/rev/548b6981501f59e3c9f2f7851c013e7d53c4e72f/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/no-comparison-or-assignment-inside-ok.js#47-48

let firstArg = node.arguments[0];
if (!exprs.has(firstArg.type)) {

Will throw when writing an expression such as ok();. This can be slightly annoying while writing tests. At least in my editor (sublime text), a panel will popup showing the stacktrace, and in general it just prevents other linting rules from checking anything in the file.

Type: task → defect

Avoid some linter rules throwing during validation due to unexpected
argument lengths.
Arguably some of those cases should probably also be caught by other linting
rules.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f281a24bed72 Fix eslint rules to avoid throwing when arguments are missing r=frontend-codestyle-reviewers,Gijs
Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 137 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: