{"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,"search_vec":"'0.0.2':11 '4':55 '8':56 'check':21 'cleaner':35 'code':39 'depend':52 'encourag':22 'eslint':1,8,54,58,61 'eslint-plugin':60 'eslintplugin':59 'flag':13 'helper':25,33 'import':27 'initi':43 'isbrows':28 'javascript':57 'like':26 'maintain':38 'minim':45 'no-typeof-window-undefin':3 'pattern':17 'peer':51 'plugin':2,49,62 'releas':44 'rule':9,48 'sinc':42 'singl':47 'single-rul':46 'some-ssr-help':30 'ssr':20,32 'typeof':5,14 'undefin':7,16 'updat':41 'use':18,23 'version':10 'window':6,15","created_at":"2026-04-25T11:20:03.346478+00:00","updated_at":"2026-04-25T11:20:03.346478+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/nirtamir2/eslint-plugin-no-typeof-window-undefined","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/eslint-plugin-no-typeof-window-undefined","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}