Socket
Socket
Sign inDemoInstall

eslint-plugin-sort-destructure-keys

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-sort-destructure-keys

require object destructure key to be sorted


Version published
Weekly downloads
203K
increased by6.01%
Maintainers
1
Weekly downloads
 
Created

What is eslint-plugin-sort-destructure-keys?

The eslint-plugin-sort-destructure-keys package is an ESLint plugin that enforces consistent sorting of keys in object destructuring assignments. This helps maintain a clean and readable codebase by ensuring that destructured keys are always in a specified order.

What are eslint-plugin-sort-destructure-keys's main functionalities?

Sort keys in object destructuring

This feature enforces that keys in object destructuring assignments are sorted alphabetically. If the keys are not in the correct order, ESLint will throw an error.

/* eslint sort-destructure-keys/sort-destructure-keys: 'error' */
const { b, a, c } = obj; // This will cause an ESLint error
const { a, b, c } = obj; // This is the correct order

Custom sorting order

This feature allows you to define a custom order for the keys in object destructuring assignments. If the keys are not in the specified custom order, ESLint will throw an error.

/* eslint sort-destructure-keys/sort-destructure-keys: ['error', { customOrder: ['c', 'a', 'b'] }] */
const { b, a, c } = obj; // This will cause an ESLint error
const { c, a, b } = obj; // This is the correct order

Other packages similar to eslint-plugin-sort-destructure-keys

Keywords

FAQs

Package last updated on 24 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc