Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hermes eslint: No sourceCode in context #1311

Closed
ayroblu opened this issue Feb 15, 2024 · 6 comments
Closed

hermes eslint: No sourceCode in context #1311

ayroblu opened this issue Feb 15, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@ayroblu
Copy link

ayroblu commented Feb 15, 2024

In ft-flow, there is this line:

node_modules/eslint-plugin-ft-flow/dist/rules/defineFlowType.js:75:44

      var newGetScope = context.sourceCode.getScope;

Which errors with:

TypeError: Cannot read properties of undefined (reading 'getScope')

Based on the error, it says while trying to lint this line:

import typeof Yargs from 'yargs';

If I switch to @babel/eslint-parser then it passes just fine, that's why I'm opening an issue in this repo, but it could also be a ft-flow issue

@pieterv
Copy link
Member

pieterv commented Feb 15, 2024

Looks like this issue was introduced in a recent change to ft-flow, i left a comment there flow-typed/eslint-plugin-ft-flow#50 but might be also worth opening a issue on that repo. No totally sure why @babel/eslint-parser doesn't have this issue, as far as i can tell hermes-eslint doesn't implement these API's, instead eslint does wrapped around the ScopeManager API which we return from parseForESLint. I'm not super familiar with the details though so happy to make changes if someone knows what the difference is cc @brianc118, but ill close for now since i believe there are no changes needed on the hermes eslint side.

@pieterv pieterv closed this as completed Feb 15, 2024
@brianc118
Copy link

@pieterv I'm guessing you meant to tag @Brianzchen?

@pieterv
Copy link
Member

pieterv commented Feb 15, 2024

yeah, sorry about that, i should have looked more closely at the autocomplete result.

@Brianzchen
Copy link

@ayroblu I'll make the fixes as recommended but just curious what version of eslint are you on?

@ayroblu
Copy link
Author

ayroblu commented Feb 15, 2024

We are on eslint 7.32.0.

@ayroblu
Copy link
Author

ayroblu commented Feb 15, 2024

New error, gonna make a new issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants