Skip to content

tools: don't use global Buffer and add linter rule for it

This does a few things to the linter configuration:

  • instead of relying on the predefined node environment, specify all our globals manually and as read-only.
  • enable no-undef to error on undefined variable access.
  • add globalReturn which allows to return from the top scope. This was implied by the node option before.

A number of tests intentionally use undefined globals to trigger an error or set globals (in the vm tests). I had to exclude those tests with an eslint-disable comment. If these comments are too noisy, we could alternatively disable that rule for all tests.

I might have missed a few globals from the v8 environment. Object.keys(global) doesn't list many of them, presumably because they are unenumerable. Any better ideas on how to discover globals?

cc: @Fishrock123 @domenic

Merge request reports

Loading