{"id":19720,"library":"eslint-plugin-de-morgan","title":"eslint-plugin-de-morgan","description":"ESLint plugin that enforces De Morgan's laws to transform negated boolean expressions into clearer equivalents. Current stable version 2.1.1, released monthly. Ships TypeScript types. Supports ESLint 8, 9, and 10. Key differentiator: auto-fixes negated conjunctions and disjunctions in code, reducing logical errors. ESM-only since v2.0.0, requires Node.js 20+ or 22+.","status":"active","version":"2.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/azat-io/eslint-plugin-de-morgan","tags":["javascript","eslint","eslint-plugin","de-morgan","typescript"],"install":[{"cmd":"npm install eslint-plugin-de-morgan","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-de-morgan","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-de-morgan","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for plugin to function","package":"eslint","optional":false}],"imports":[{"note":"ESM-only since v2.0.0; requires 'import' statement.","wrong":"const deMorgan = require('eslint-plugin-de-morgan')","symbol":"plugin","correct":"import deMorgan from 'eslint-plugin-de-morgan'"},{"note":"Flat config (eslint.config.js) uses deMorgan.configs.recommended; legacy config uses 'plugin:de-morgan/recommended-legacy'.","wrong":"module.exports = { extends: ['plugin:de-morgan/recommended'] }","symbol":"recommended config","correct":"import deMorgan from 'eslint-plugin-de-morgan'; export default [deMorgan.configs.recommended]"},{"note":"Individual rules access via deMorgan.rules. Legacy require pattern fails in ESM.","wrong":"const rules = require('eslint-plugin-de-morgan').rules.no-negated-conjunction","symbol":"rules","correct":"import deMorgan from 'eslint-plugin-de-morgan'; const rules = deMorgan.rules['no-negated-conjunction']"}],"quickstart":{"code":"import deMorgan from 'eslint-plugin-de-morgan';\n\nexport default [\n  deMorgan.configs.recommended,\n  {\n    plugins: {\n      'de-morgan': deMorgan\n    },\n    rules: {\n      'de-morgan/no-negated-conjunction': 'warn',\n      'de-morgan/no-negated-disjunction': 'error'\n    }\n  }\n];\n","lang":"typescript","description":"Shows how to use the plugin with flat config and enable both rules."},"warnings":[{"fix":"Use ESM imports (import deMorgan from 'eslint-plugin-de-morgan').","message":"v2.0.0 dropped CommonJS support; require() fails.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Upgrade to Node.js 20 or 22.","message":"v2.0.0 dropped Node.js 18 support.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use context.sourceCode or sourceCode property from rule context.","message":"v2.0.0 removed legacy getSourceCode() function.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use 'recommended-legacy' in .eslintrc.js extends array.","message":"Legacy config must use 'plugin:de-morgan/recommended-legacy' instead of 'plugin:de-morgan/recommended'.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Use deMorgan.configs.recommended in eslint.config.js.","message":"Flat config users must not mix legacy extends; only use deMorgan.configs.recommended.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Change to 'import deMorgan from 'eslint-plugin-de-morgan'' and ensure package.json has 'type': 'module'.","cause":"Using require() with plugin v2+ which is ESM-only.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Ensure rule is defined under 'rules' object: 'de-morgan/no-negated-conjunction': 'error'.","cause":"Misconfigured rule severity or options in legacy config.","error":"Configuration for rule 'de-morgan/no-negated-conjunction' is invalid"},{"fix":"Run 'npm install --save-dev eslint-plugin-de-morgan'.","cause":"Plugin not installed or missing from package.json.","error":"Cannot find module 'eslint-plugin-de-morgan'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}