eslint-plugin-unicorn icon indicating copy to clipboard operation
eslint-plugin-unicorn copied to clipboard

`prefer-global-this` should also reject `self` in service workers

Open fregante opened this issue 4 months ago • 2 comments

Worker APIs should use self

I think self was chosen because there's no window, but globalThis should still be preferred there I think.

  • Service workers introduction: 2014
  • globalThis introduction: 2019

I think using self in service workers is more of a historical artifact rather than a necessity.

Originally posted by @fregante in https://github.com/sindresorhus/eslint-plugin-unicorn/pull/2410#discussion_r1779954389

fregante avatar Sep 29 '24 14:09 fregante