eslint-plugin-disallow-methods

raw JSON →
0.1.0 verified Sat Apr 25 auth: no javascript abandoned

An ESLint plugin that disallows specified method calls on given objects. Current version 0.1.0, released as an early prototype with unstable API (under active development). Key differentiator: allows custom configuration of blocked methods per object via ESLint rules, targeting method calls like `foo.bar()` rather than generic function calls. Alternative to no-restricted-syntax with a more declarative approach. Development appears stalled; no updates since initial release.

error Error: Cannot find module 'eslint-plugin-disallow-methods'
cause Plugin not installed or ESLint cannot resolve it.
fix
Run 'npm install eslint-plugin-disallow-methods --save-dev' and ensure node_modules is correct.
error Configuration for rule "disallow-methods" is invalid: Definition for rule 'disallow-methods' was not found.
cause Using wrong rule name without plugin scope prefix.
fix
Change rule name to 'disallow-methods/disallow-methods'.
breaking API may change at any time; do not rely on stable configuration.
fix Lock version to exact 0.1.0 or consider alternative plugins.
gotcha Rule name is 'disallow-methods/disallow-methods', not 'disallow-methods'.
fix Use full scoped rule name in rules configuration.
gotcha Method wildcard '*' disallows all methods on the object.
fix Use '*' as method value to block all method calls on that object.
npm install eslint-plugin-disallow-methods
yarn add eslint-plugin-disallow-methods
pnpm add eslint-plugin-disallow-methods

Shows basic ESLint configuration to disallow console.log and any method on eval.

{
  "plugins": ["disallow-methods"],
  "rules": {
    "disallow-methods/disallow-methods": ["error", [
      { "object": "console", "method": "log" },
      { "object": "eval", "method": "*" }
    ]]
  }
}