2.0.0 • Published 1 year ago

eslint-plugin-sort-destructure-keys v2.0.0

Weekly downloads
43,057
License
ISC
Repository
github
Last release
1 year ago

eslint-plugin-sort-destructure-keys

require object destructure key to be sorted

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-sort-destructure-keys:

$ npm install eslint-plugin-sort-destructure-keys --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-sort-destructure-keys globally.

Usage

Add sort-destructure-keys to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["sort-destructure-keys"]
}

Then configure the rule under the rules section.

{
  "rules": {
    "sort-destructure-keys/sort-destructure-keys": 2
  }
}

Rule Options

{
  "sort-destructure-keys/sort-destructure-keys": [2, { "caseSensitive": false }]
}

caseSensitive

When true the rule will enforce properties to be in case-sensitive order. Default is true.

Example of incorrect code for the {"caseSensitive": false} option:

let { B, a, c } = obj;

Example of correct code for the {"caseSensitive": false} option:

let { a, B, c } = obj;

Example of incorrect code for the {"caseSensitive": true} option:

let { a, B, c } = obj;

Example of correct code for the {"caseSensitive": true} option:

let { B, a, c } = obj;

Changelog

2.0.0

  • Drop support for ESLint versions older than 5. (#269)

1.6.0

  • Add compatibility for ESLint 9. (#267, by ptb)

1.5.0

  • Allow sorting properties with defaults when the default doesn't reference other properties (#215, by ianobermiller).

1.4.0

  • Add compatibility with eslint 8. (#123)

1.3.5

  • Add ^7.0.0 to eslint peer dependency. (#53, by dsernst)

1.3.4

  • Fixes TypeError issue with multiple property expressions. (#20)

1.3.3

  • Add 6.0.0 to eslint peer dependency. (#21, by @7rulnik)

1.3.2

  • Fix bug where computed properties were causing the rule to throw errors. (#15, thanks @TSMMark!)

1.3.1

1.3.0

  • Add support for --fix eslint cli flag

1.2.0

  • Add peer dependency support for eslint ^5.0.0

1.1.0

@alfabank/eslint-config-siteeslint-config-tantalum@zentus/eslint-config-esmeslint-config-rbowereslint-config-sunrocketzeslint-config-sunrocketz-node@aldertv/eslint-config@infinitebrahmanuniverse/nolb-eslint-plugin-s@mafalda/eslint-config@cneuro/eslint-config-alphaeslint-config-sandbox@everything-registry/sub-chunk-1614@alt-research/dev@wonse/eslint-configwttj-configwttj-config-front@dkimura/eslint-config@cneuro/eslint-config-functional@colussi/eslint-config@digitalex/eslint-config@datacamp/eslint-config@rosinfo.tech/cli@rosinfo.tech/eslint-config-javascript@tantalum-config/eslint-configeslint-config-shaw996eslint-config-line@rrrrrrrrrrr/eslint-config-custom@aptos-labs/eslint-config-petra@asl-19/eslint-config@axia-js/dev@axiasolar-js/dev@b2x/eslint-config@big-whale-labs/eslint-config-bwl@big-whale-labs/bwl-eslint-backend@bitool/eslint-config@billomat/eslint-config-base@breadlee/eslint-config@busybox/eslint-config@byintera/eslint-config@15gifts/eslint-config@1pedro/eslint-config@abizzle/eslint-config-abizzle@5ire/dev@axiasolar/dev@axiacoin/dev@danielvaijk/eslint-config@dan28/eslint-config@dust-defi/dev@horse-racing/dev@hermeznetwork/eslint-config-react-ts@iden3/eslint-config-react-ts@ellreka/configs@garvae/eslint-config-garvae@functorfactory/eslint-config@eulerxyz/eslint-config@foxone/dev@ghadyani-eslint/eslint-config-core@gilbarbara/eslint-config@ghslp/eslint-config@grantheaslip/eslint-config@labforward/eslint-config-base@krypto-wealth/dev@kununu/eslint-config@liveauctioneers/eslint-config-hammer-ui@lastline/eslint-config-lastline-react@lottiefiles/eslint-plugin@itsjonq/zero@irvin93d/eslint-config-next@liferay/eslint-config@liferay/eslint-plugin@lympid/eslint-config-lympid@micheldever/eslint-config@mservicestech/eslint-config@mservicestech/eslint-config-react@myposter/eslint-config@matali/eslint-config@marcoappio/marco-config@new-black/eva-frontend-config@nimashoghi/eslint-config@nkzw/eslint-config@nolajs/eslint-config@ephys/eslint-config@mindedtech/eslint-config@mimirdev/dev@mimirjs/dev@keegan-lillo/eslint-config-base@jaz-dev/dev@kitnato/eslint-config-succinct@kitstigator/eslint-config-functional@dvukovic/eslint-config@dvukovic/style-guide@ptb/eslint-config@psdevs/eslint-config@racsys/eslint-config@reef-defi/dev@redspot/dev-cli@open-web3/dev-config@open-turo/eslint-config@open-turo/eslint-config-typescript@polkadot/dev
1.6.0

1 year ago

2.0.0

1 year ago

1.5.0

2 years ago

1.4.0

4 years ago

1.3.5

5 years ago

1.3.4

5 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago