question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sort-keys - include/exclude objects by name

See original GitHub issue

What rule do you want to change? sort-keys

Does this change cause the rule to produce more or fewer warnings? fewer potentially

How will the change be implemented? (New option, new default behavior, etc.)? new option

Please provide some example code that this change will affect:

/*eslint sort-keys: ["error", { includeObjects: ["includeMe"] }]*/

// Examples of incorrect code for this rule:
const includeMe = { b: 'b', a: 'a' }

// Exampes of correct code for this rule
const someObj = { b: 'b', a: 'a' }

/*eslint sort-keys: ["error", { excludeObjects: ["excludeMe"] }]*/

// Examples of incorrect code for this rule:
const foo = { b: 'b', a: 'a' }

// Exampes of correct code for this rule
const excludeMe = { b: 'b', a: 'a' }

What does the rule currently do for this code? Answered above

What will the rule do after it’s changed? Answered above

Are you willing to submit a pull request to implement this change? I will try with some guidance, I’ve never looked into eslint code.

Motivation The biggest use case for me is sorting JSS properties, while NOT linting the rest of the app.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
platinumazurecommented, Jun 10, 2019

Hi @goldylucks, thanks for the issue.

Have you tried using ESLint disable comments? I think that would be a pretty good fit for your use case, especially in the exclude case.

0reactions
goldyluckscommented, Jul 14, 2019

so I ended up including instead of excluding. Not very clean, but it works 😃

/* eslint sort-keys: "error" */
const styles = theme => ({
  root: {
    paddingTop: 100,
    paddingRight: theme.containerPadding,
    paddingLeft: theme.containerPadding,
  },
  title: {
    fontSize: 24,
    marginRight: theme.containerPadding,
    marginBottom: theme.spacing(4),
  },
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Sort Keys to Organize Data in Amazon DynamoDB - AWS
You use sort keys to not only group and organize data, but also to ... to include, exclude, and match items by their...
Read more >
How to access and sort keys in nested objects in Javascript?
I need to access keys in objects (name, age, position, experience) and sort them according to this string, so keys in the object...
Read more >
SortCriteria - Oracle Help Center
Constructs a new SortCriteria object with the specified display name and state for include/exclude ( true == include). Parameters: displayName - The desired ......
Read more >
PK Automation - Certara
Use one of the following to add a PK Automation object to a Workflow: ... Check/Uncheck the Standard box to include/exclude a table...
Read more >
Template and Listdef
I could also EXCLUDE some objects. There can be several INCLUDE/EXCLUDE clauses within a LISTDEF. TABLESPACES, LIST01 will contain table spaces. TABLESPACE.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found