Closed Bug 1760286 Opened 2 years ago Closed 2 years ago

ESlint 8.11.0: Cannot read properties of undefined (reading 'type') caused by eslint-plugin-mozilla

Categories

(Developer Infrastructure :: Lint and Formatting, task, P3)

Tracking

(firefox100 fixed)

RESOLVED FIXED
100 Branch
Tracking Status
firefox100 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(4 files)

On a local project that also used eslint-plugin-mozilla, I've just tried upgrading to ESLint 8.11.0 and found there were failures caused:

TypeError: Cannot read properties of undefined (reading 'type')
Occurred while linting /Users/mark/dev/thunderbird-conversations/addon/content/modules/conversation.js:7
Rule: "no-unused-vars"
    at collectUnusedVariables (/Users/mark/dev/thunderbird-conversations/node_modules/eslint/lib/rules/no-unused-vars.js:606:49)

This is caused by our globals handling for XPCOM.* imports. I have a solution for this and will post a patch soon.

ESLint is only documenting the new module style of meta data and returning a create function.
Using this format allows us to easily specify extra meta data, e.g. documentation urls.
Hence, lets move all our rules across to the newer style so that any copy and paste will use
the new style, and we'll also be set up if ESLint requires it in the future.

This metadata is based on what I thik we should include. We don't need most
of the documentation section (category, description) since they are specific
to ESLint. The url is useful, as it will show up in VSCode and other editors
for developers wanting more information.

The type of rule probably isn't important, but is kept as a general guide.

Depends on D142285

Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/249dc5724ff8
Rework ESLint rules for eslint-plugin-mozilla to use the newer more descriptive rule format. r=Gijs
https://hg.mozilla.org/integration/autoland/rev/4b551467968d
Add missing docs for rules in eslint-plugin-mozilla. r=Gijs
https://hg.mozilla.org/integration/autoland/rev/026a3213aeff
Add metadata for all eslint-plugin-mozilla rules. r=Gijs
https://hg.mozilla.org/integration/autoland/rev/736dd080afc2
Fix issue in eslint-plugin-mozilla where it fails with ESLint v8.11.0 due to the processing of XPCOMUtils.* import functions. r=Gijs
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: