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.

Rule enhancement: More granular control in space-unary-ops

See original GitHub issue

Current state

This rule allows us to configure whether we expect spaces between unary operators for either word operators (delete, void, typeof etc.) and non-word (+, -, ++, !, etc.).

Problem

Some might prefer different spacing rules for individual non-word operators. For me personally, I prefer to have the negation operator ! always separated from its operand, but I never separate ++ or -- from its operand.

Proposal

Extend the rule’s configuration so that we can configure the spacing rules for individual operators. One example might be to add an object as third argument where the object’s key would be the operator and the key’s value would be the rule to apply:

{
  'space-unary-ops': [1, {
    words: false,
    nonwords: false,
    '!': true  // Overrides spacing rule for ! to always have space
  }]
}

The configuration scheme above is just an idea. The goal is to allow more fine-grained control over where the spaces are expected and where they are not.

Thanks!

<bountysource-plugin>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
robertrossmanncommented, Mar 18, 2016

Thanks to everyone who worked on this! Great work!

0reactions
chiptoecommented, Jan 28, 2018

Hello, what if, we want to enforce usage:

typeof(foo) === 'blah';

instead of

typeof (foo) === 'blah';

my config

"space-unary-ops": [2, {
    "words": true,
    "overrides": {
        "typeof": false
    }
}]

Second case should end up with error. At least that is what I expected. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Six Ws of Granular Access Control | Core Security Blog
Granular access controls are sophisticated enough to establish rules based on not only role, but on the window of time that a group...
Read more >
Granular Role Based Access Controls per App - VMware Docs
Labels are applied to individual objects to support access control in a decentralized manner. The bubbles in the image represent different NSX ...
Read more >
Internal Framework Refactor/Improvement
having no control over who accesses what applications. This can violate privacy rules, exposing sensitive data to personnel who are not authorised to...
Read more >
Lightning Aura Components Developer Guide
Composing fine-grained components in a larger component enables you to build more interesting components and applications.
Read more >
git.viithiisys.com/sunny/meteor-projects/commit/db...
ESLint is completely pluggable, every single rule is a plugin and you can add more at runtime. - -## Installation - -You can...
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