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

Skip traversal of null nodes #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jamiebuilds
Copy link
Contributor

Fixes #2

@AprilArcus
Copy link

Tested, LGTM

@alanorozco
Copy link

Would really appreciate it if this fix was released :)

@jamiebuilds
Copy link
Contributor Author

Sorry I'm not able to merge on this repo anymore

@treshugart
Copy link

For those needing a workaround without resorting to a local patch, you can attempt a try/catch:


import traverse from 'eslint-traverse';
import os from 'node:os';

// ...

try {
  traverse(context, program, ({ node }) => {
    // You should also guard here.
    if (!node) {
      return;
    }
  });
} catch (e) {
  const stack = e.stack.split(os.EOL).map(s => s.trim());
  const eslintTraverseBug = stack[1];
  if (
    !eslintTraverseBug.includes(
      'eslint-traverse/index.js:24:55'
    )
  ) {
    throw e;
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants