eslint-plugin-ssr-friendly
eslint-plugin-ssr-friendly copied to clipboard
[Feature request] A rule to disallow calling expressions in module scope
It will protect from:
Please note that we can't detect if you're still calling this function without properly checking upfront if
typeof window !== "undefined".
Not allowed example
function myFunction() {
// Doesn't matter what's inside
}
myFunction(); // Linting error
(() => { /* Doesn't matter what's inside */ })(); // Linting error
Allowed example
function myFunction() {
// Doesn't matter what's inside
}
// The library user will call it
export { myFunction };