Skip to content

Latest commit

 

History

History
45 lines (42 loc) · 652 Bytes

File metadata and controls

45 lines (42 loc) · 652 Bytes

eslint-plugin-annotation/sort

Sort array values if has @sort annotation

Before apply annotation

const names = [
  'Liam',
  'Noah',
  'Jackson',
  'Aiden',
  'Elijah',
  'Grayson',
  'Lucas',
  'Oliver',
]

After apply annotation (Autofix by lint)

// @sort
const names = [
  'Aiden',
  'Elijah',
  'Grayson',
  'Jackson',
  'Liam',
  'Lucas',
  'Noah',
  'Oliver',
 ]

My best case to use this rule that :

// @sort
const adminIds = [
  'Asher',
	'Heather',
  'James',
  'Luca',
  'Ron',
  'Zinna',
]

If array's values are irrelevant even if the order is changed, this rule can make it clear