Socket
Book a DemoInstallSign in
Socket

@esatterwhite/eslint-config-reasonable

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@esatterwhite/eslint-config-reasonable

ESLint config with reasonable comma first settings

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

eslint-config-reasonable

eslint config with reasonable comma first settings for node.js projects

Features

  • accurate alignment of commas w/ comma first style
  • validation of error handling in callbacks
  • Require validation (required packages must be in package.js)

Installation

> npm install @esatterwhite/eslint-config-reasonable

Config Installation

Add a eslintConfig block to you package.json

{
  "eslintConfig": {
    "root": true,
    "extends": "@answerbook/eslint-config-reasonable",
    "ignorePatterns": [
      "node_modules/"
    ]
  }
}

Example

'use strict'

const path = require('path')
const fs = require('fs')
const {promisify} = require('util')
const crypto = require('crypto')

const readFile = promisify(fs.readFile)
const EXP = /\d+/
const SLEEP_MS = 150

const LONG_STRING = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'
  + 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'
  + 'abcdefghijklmnopqrstuvwxyz'

const OPTIONS = {
  FOO: 1
, BAR: 2
, TEST: 'fake'
, LONG: LONG_STRING
}

const isFoo = OPTIONS.FOO
  ? OPTIONS.BAR
  : OPTIONS.TEST

function getOptions() {
  return isFoo ? OPTIONS : null
}

function rand(bytes = 10, cb) {
  crypto.randomBytes(bytes, (err, buffer) => {
    if (err) return cb(err)
    cb(null, buffer.toString('hex'))
  })
}

async function doWork(opts) {
  const {x, y} = opts
  try {
    const file = await readFile(path.join(x, y))
    return file
  } catch (err) {
    console.error(err)
    return null
  }
}

;(async () => {
  await new Promise((resolve) => {
    setTimeout(resolve, SLEEP_MS)
  })
  console.log('ready', 11 + 33)
})()

function plugin(opts) {
  if (this.is_new) {
    this.id = Date.now()
  } else {
    this.updated = new Date()
  }
}

module.exports = {
  ...OPTIONS
, EXP
, rand
, getOptions
, doWork
, plugin
}

Keywords

eslint

FAQs

Package last updated on 12 Jul 2020

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.