Skip to content

Feature: Support ignoring objects by variable name in sort-objects #571

@Gajdascz

Description

@Gajdascz

What rule do you want to change?

sort-objects

Describe the problem

Currently, there does not seem to be a way to ignore objects by variable name when using sort-objects. This makes working with order-dependent objects difficult.

Code example

In oclif the args object is order-dependent. Sorting it ruins the positional input.

import { Command, Args } from '@oclif/core';

/**
 * The order of args is always intentional and should not be sorted.
 */
export default class MyCommand extends Command {
  static override args = {
    type: Args.string({
      name: 'type',
      options: [type1,type2,type3],
      required: true
    }),
    description: Args.string({
      name: 'description',
      required: true
    }),
    scope: Args.string({
      name: 'scope',
      required: false
    })
  }
}

Additional comments

This deprecated rule seems to state it's possible to ignore objects by it's name. But I was not able to get it to work and regardless it's deprecated.

The alternative to the deprecated rule according to the docs is useConfigurationIf with unsorted type. But its two rules allNamesMatchPattern and callingFunctionNamePattern don't solve this issue. allNamesMatchPattern only matches object keys and I'm not using functions in this context.

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions