{
  "root": true,
  "extends": "@domenic",
  "env": {
    "node": true
  },
  "plugins": [
    "jsdom-internal"
  ],
  "rules": {
    // Overrides for jsdom
    "array-element-newline": "off",
    "no-implied-eval": "off",
    "no-invalid-this": "off",
    "require-unicode-regexp": "off",
    "prefer-template": "off",
    "prefer-object-has-own": "off", // remove this once Node v16 is the minimum
    "logical-assignment-operators": "off", // remove this once Node v16 is the minimum
    "new-cap": ["error", { "capIsNewExceptions": ["ByteString", "USVString", "DOMString"] }],

    // Custom rules
    "jsdom-internal/hook-super-invocation": ["error",
      { "ancestor": "NodeImpl", "hook": "_attach" },
      { "ancestor": "NodeImpl", "hook": "_detach" },
      { "ancestor": "NodeImpl", "hook": "_descendantAdded" },
      { "ancestor": "NodeImpl", "hook": "_descendantRemoved" },
      { "ancestor": "NodeImpl", "hook": "_childTextContentChangeSteps" },
      { "ancestor": "ElementImpl", "hook": "_attrModified" }
    ]
  },

  // Rules limited to specific locations
  "overrides": [
    {
      "files": ["lib/**"],
      "rules": {
        "no-restricted-properties": ["error",
          { "property": "getAttribute", "message": "Use 'getAttributeNS' with null as the namespace to access attributes within jsdom" },
          { "property": "setAttribute", "message": "Use 'setAttributeNS' with null as the namespace to access attributes within jsdom" },
          { "property": "hasAttribute", "message": "Use 'hasAttributeNS' with null as the namespace to access attributes within jsdom" },
          { "property": "removeAttribute", "message": "Use 'removeAttributeNS' with null as the namespace to access attributes within jsdom" },
          { "property": "toggleAttribute", "message": "Use 'setAttributeNS' and 'removeAttributeNS' with null as the namespace to access attributes within jsdom" }
        ]
      }
    },
    {
      "files": ["test/api/**"],
      "rules": {
        "no-loop-func": "off" // interacts poorly with Mocha's before() and tests generated using loops
      }
    }
  ]
}
