{"id":19858,"library":"eslint-plugin-no-typeof-window-undefined","title":"ESLint Plugin: no-typeof-window-undefined","description":"ESLint rule (version 0.0.2) that flags typeof window === 'undefined' patterns used for SSR checks. Encourages using a helper like `import { isBrowser } from 'some-ssr-helper'` for cleaner and more maintainable code. No updates since initial release. Minimal, single-rule plugin with peer dependency on ESLint ^4-^8.","status":"active","version":"0.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/nirtamir2/eslint-plugin-no-typeof-window-undefined","tags":["javascript","eslint","eslintplugin","eslint-plugin"],"install":[{"cmd":"npm install eslint-plugin-no-typeof-window-undefined","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-no-typeof-window-undefined","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-no-typeof-window-undefined","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; the plugin operates as an ESLint rule","package":"eslint","optional":false}],"imports":[{"note":"Rule name is the full plugin name; you must prefix with the plugin name.","wrong":"module.exports = {\n  plugins: ['no-typeof-window-undefined'],\n  rules: { 'no-typeof-window-undefined': 'error' }\n};","symbol":"default","correct":"module.exports = {\n  plugins: ['no-typeof-window-undefined'],\n  rules: { 'no-typeof-window-undefined/no-typeof-window-undefined': 'error' }\n};"},{"note":"CommonJS; no default export, so destructure from module.exports.","wrong":"const { rules } = require('eslint-plugin-no-typeof-window-undefined');","symbol":"rules","correct":"const plugin = require('eslint-plugin-no-typeof-window-undefined');\n// then use plugin.rules['no-typeof-window-undefined']"},{"note":"ESLint 9+ flat config requires an object with plugin key, not array.","wrong":"import plugin from 'eslint-plugin-no-typeof-window-undefined';\nexport default [\n  { plugins: ['no-typeof-window-undefined'], ... }\n];","symbol":"flat config (ESLint 9+)","correct":"import noTypeofWindowUndefined from 'eslint-plugin-no-typeof-window-undefined';\nexport default [\n  { plugins: { 'no-typeof-window-undefined': noTypeofWindowUndefined },\n    rules: { 'no-typeof-window-undefined/no-typeof-window-undefined': 'error' } }\n];"}],"quickstart":{"code":"// .eslintrc.js (ESLint <=8)\nmodule.exports = {\n  plugins: ['no-typeof-window-undefined'],\n  rules: {\n    'no-typeof-window-undefined/no-typeof-window-undefined': 'error'\n  }\n};\n\n// Example of flagged code:\nif (typeof window === 'undefined') { /* server code */ }\n\n// Suggested fix:\nimport { isBrowser } from 'some-helper';\nif (!isBrowser) { /* server code */ }","lang":"javascript","description":"Shows how to install and configure the ESLint plugin to flag typeof window === 'undefined' and suggests using a helper function instead."},"warnings":[{"fix":"Use 'no-typeof-window-undefined/no-typeof-window-undefined': 'error' in rules.","message":"Rule name is 'no-typeof-window-undefined/no-typeof-window-undefined' – you must prefix with the plugin namespace.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Manually adapt plugin to flat config format or use legacy eslintrc.","message":"Does not support ESLint flat config (ESLint 9+). No updated version.","severity":"gotcha","affected_versions":">=9.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install --save-dev eslint-plugin-no-typeof-window-undefined and add to plugins: ['no-typeof-window-undefined']","cause":"Plugin not installed or not added to plugins array.","error":"ESLint couldn't find the plugin \"eslint-plugin-no-typeof-window-undefined\""},{"fix":"Use 'no-typeof-window-undefined/no-typeof-window-undefined': 'error'","cause":"Rule name used without plugin prefix in rules config.","error":"Definition for rule 'no-typeof-window-undefined' was not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}