dillon1000/react

Commit

[Babel] Fix up eslint suppression logic

Babel doesn't attach Comment nodes to anything, so they dangle off of 

the Program node while only specifying a range. This meant that 

previously we first had to traverse all of the Program's comments to 

find an eslint suppression of the rules of React, then during traversal 

of the individual functions, we would check if there were any *global* 

eslint suppressions, then bailout all components. 

This PR updates our logic to determine if individual functions are 

affected by an eslint suppression range: 

- If an eslint suppression range falls within its body; or 

- If an eslint suppression wraps the function
Browse files
Changed paths10 files
First-parent comparison
A compiler/packages/babel-plugin-react-forget/src/Entrypoint/EslintSuppression.ts AddedM compiler/packages/babel-plugin-react-forget/src/Entrypoint/Program.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/Entrypoint/index.ts ModifiedD compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.bug-use-no-forget-multiple-with-eslint-suppression.expect.md DeletedM compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-sketchy-code-use-forget.expect.md ModifiedM compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-sketchy-code-use-forget.js ModifiedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-unclosed-eslint-suppression.expect.md AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-unclosed-eslint-suppression.js AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/use-no-forget-multiple-with-eslint-suppression.expect.md AddedR compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.bug-use-no-forget-multiple-with-eslint-suppression.js →compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/use-no-forget-multiple-with-eslint-suppression.js Renamed
Patch

Files changed

Rendering syntax-highlighted changes…