{"id":19725,"library":"eslint-plugin-detox","title":"eslint-plugin-detox","description":"ESLint environment plugin for Detox, an end-to-end testing framework for React Native applications. Version 1.0.0 is the latest stable release with no known release cadence. It provides a custom ESLint environment to enable global Detox variables (like `device`, `expect`, `element`, `by`, `waitFor`) in test files, preventing no-undef errors. Unlike generic ESLint settings, this plugin is tailored specifically for Detox's asynchronous UI testing helpers and should be combined with environments like mocha/jest. Statically releases with no frequent updates; works with ESLint 1.x+ and supports both npm and yarn.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/hammadj/eslint-plugin-detox","tags":["javascript","eslint","eslintplugin","eslint-plugin","eslint-plugin-detox","detox","react-native"],"install":[{"cmd":"npm install eslint-plugin-detox","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-detox","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-detox","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required by all ESLint plugins","package":"eslint","optional":false}],"imports":[{"note":"This is an ESLint plugin, not an imported module. It is activated via ESLint configuration. The plugin provides the 'detox/detox' environment.","symbol":"eslint-plugin-detox","correct":"// In .eslintrc: { \"plugins\": [\"detox\"] } or {\"env\":{\"detox/detox\":true}}"},{"note":"This exposes Detox globals (device, expect, element, by, waitFor). Must be combined with test runner env (e.g., mocha, jest).","symbol":"detox/detox environment","correct":"In .eslintrc: { \"env\": { \"detox/detox\": true } } or via /* eslint-env detox/detox */"}],"quickstart":{"code":"// Install dependencies\n// npm install eslint eslint-plugin-detox --save-dev\n\n// .eslintrc.json\n{\n  \"plugins\": [\"detox\"],\n  \"env\": {\n    \"detox/detox\": true,\n    \"mocha\": true\n  },\n  \"rules\": {\n    \"no-undef\": \"error\"\n  }\n}\n\n// Then in your test file:\n/* eslint-env detox/detox, mocha */\ndescribe('Example', () => {\n  beforeEach(async () => {\n    await device.reloadReactNative();\n  });\n\n  it('should show hello screen', async () => {\n    await expect(element(by.text('Hello'))).toBeVisible();\n  });\n});","lang":"javascript","description":"Shows how to install, configure ESLint with detox environment, and a sample Detox test using globals enabled by the plugin."},"warnings":[{"fix":"Use standard ESLint rules (e.g., 'no-undef') with the 'detox/detox' environment.","message":"The plugin only provides an environment; it does not include any custom rules. Developers might expect rules like 'detox/no-assertions' but they do not exist.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Combine 'detox/detox' with 'mocha':true or 'jest':true in the env block.","message":"The environment must be used alongside a test runner environment (mocha, jest, etc.) to avoid missing globals like 'describe', 'it', etc.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Add 'detox/detox' to the env section of .eslintrc or include comment: /* eslint-env detox/detox */","cause":"The 'detox/detox' environment is not enabled in ESLint config.","error":"'device' is not defined  no-undef"},{"fix":"Remove rule references prefixed with 'detox/'. The plugin only provides an environment.","cause":"User attempted to use a rule from the plugin, but the plugin does not define any rules.","error":"Definition for rule 'detox/no-assertions' was not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}