Closed Bug 1365555 Opened 3 years ago Closed 2 years ago

eslint-plugin-mozilla fails when used with babel-eslint

Categories

(Firefox Build System :: Lint and Formatting, defect)

3 Branch
defect
Not set

Tracking

(firefox55 fixed)

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: standard8, Assigned: standard8)

Details

Attachments

(1 file)

I was looking at eslint-plugin-mozilla & the Normandy repository. It turns out that we using any part of "globals" for eslint-plugin-mozilla fails due to the babel-eslint module.

I think the failure is really in babel-eslint (https://github.com/babel/babel-eslint/issues/470), but we can easily work around that here by changing

    let scopeManager = escope.analyze(ast);

to

    let scopeManager = escope.analyze(ast, {});

This fixes the "TypeError: Cannot set property 'ecmaVersion' of undefined" currently being raised (and doesn't break non-babel-eslint usages).
Attachment #8868487 - Flags: review?(jaws) → review?(florian)
Comment on attachment 8868487 [details]
Bug 1365555 - eslint-plugin-mozilla fails when used with babel-eslint, provide an addition argument for the options.

https://reviewboard.mozilla.org/r/140100/#review144576

rs=me.

::: tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js:153
(Diff revision 2)
>  
>      // Parse the content into an AST
>      let ast = helpers.getAST(content);
>  
>      // Discover global declarations
> -    let scopeManager = escope.analyze(ast);
> +    let scopeManager = escope.analyze(ast, {});

Should we add a comment around here saying something like "The second parameter works around https://github.com/babel/babel-eslint/issues/470" ?
Attachment #8868487 - Flags: review?(florian) → review+
Comment on attachment 8868487 [details]
Bug 1365555 - eslint-plugin-mozilla fails when used with babel-eslint, provide an addition argument for the options.

https://reviewboard.mozilla.org/r/140100/#review144576

> Should we add a comment around here saying something like "The second parameter works around https://github.com/babel/babel-eslint/issues/470" ?

Good idea. I just added that.
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7c7ef2b6b548
eslint-plugin-mozilla fails when used with babel-eslint, provide an addition argument for the options. r=florian
https://hg.mozilla.org/mozilla-central/rev/7c7ef2b6b548
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Product: Testing → Firefox Build System
Version: Version 3 → 3 Branch
You need to log in before you can comment on or make changes to this bug.