Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@andreaspizsa/eslint-config-xo

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@andreaspizsa/eslint-config-xo

a lightly customized `xo` config

npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

An opinionated xo config

Install

npm add -D @andreaspizsa/eslint-config-xo

Automatically adds the package to xo.extends using postinstaller.

Settings

{
  "semicolon": false,
  "space": true,
  "func-names": "off",
  "no-negated-condition": "warn",
  "operator-linebreak": [
    "error",
    "before",
    {
      "overrides": {
        "x?": "ignore",
        "x:": "ignore"
      }
    }
  ]
}

Allows Named Functions

function a() {
  return function namedFunction() { // standard xo would complain here
    return b
  }
}

Allows Negated Conditions

Negated conditions are fine if there’s a rather short block - often a one-liner - followed by a longer block. Getting the "short block" out of the way reduces cognitive load.

Good

function a(b) {
  if(!b) {
    log('b is empty')
  } else {
    // do
    // something
    // more complicated
    // in a longer
    // block
  }
}

By default, xo favors this:

Bad

function a(b) {
  if(b) {
    // do
    // something
    // more complicated
    // in a longer
    // block
  } else {
    log('b is empty')
  }
}

Operator Line Break

I prefer

Good

  const result = isThisConditionActuallyTrue()
    ? doThisOperation()
    : elseThisOperation()

over

Bad

  const result = isThisConditionActuallyTrue() ?
    doThisOperation() :
    elseThisOperation()

Keywords

xo

FAQs

Package last updated on 29 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts