eslint-plugin-destructuring

raw JSON →
2.2.1 verified Sat Apr 25 auth: no javascript

ESLint plugin providing destructuring-specific linting rules, currently at version 2.2.1. It focuses on enforcing consistency and best practices around object and array destructuring patterns, with rules like 'no-rename', 'in-params', and 'in-methods-params'. The plugin is maintained and integrates via ESLint's plugin system, supporting a recommended configuration. It requires ESLint as a peer dependency and is published under the MIT license. Notably, it is one of the few plugins dedicated solely to destructuring, offering targeted rules not found in ESLint core or popular configs like eslint-config-airbnb. Release cadence has slowed since 2019, but it remains functional for ESLint 5/6/7.

error Configuration for rule "destructuring/no-rename" is invalid: Value ["error",{"forbid":"all"}] is not a valid rule configuration.
cause Invalid option value for 'forbid' (should be an array or string, not 'all').
fix
Use 'destructuring/no-rename': ['error', { forbid: ['someName'] }] or remove the option.
error ESLint couldn't find the plugin "eslint-plugin-destructuring".
cause Plugin not installed or not in node_modules.
fix
Run 'npm install eslint-plugin-destructuring --save-dev'.
error Cannot find module 'eslint-plugin-destructuring'
cause Plugin not installed, or ESLint is running from a different directory.
fix
Ensure the plugin is installed locally: 'npm install eslint-plugin-destructuring --save-dev'.
deprecated The 'no-rename' rule's 'forbid' option with value 'all' is deprecated in favor of explicit 'allow' list.
fix Use 'no-rename': ['error', { allow: [] }] to forbid all renames.
breaking ESLint 8+ requires plugins to export a 'meta' object with 'name' and 'version'. This plugin may need update.
fix Check plugin compatibility; for ESLint 8+, consider using an alternative or patching the plugin.
gotcha The 'in-methods-params' rule may conflict with other plugins like '@typescript-eslint' if method parameters use destructuring.
fix Disable 'in-methods-params' if using TypeScript or other parameter-handling rules.
npm install eslint-plugin-destructuring
yarn add eslint-plugin-destructuring
pnpm add eslint-plugin-destructuring

Shows how to enable the plugin, extend the recommended config, and override individual rules.

// .eslintrc.js
module.exports = {
  plugins: ['destructuring'],
  extends: ['plugin:destructuring/recommended'],
  rules: {
    'destructuring/no-rename': 'error',
    'destructuring/in-params': ['error', { enforce: 'always' }],
  },
};