eslint-plugin-sensible

3.1.0 • Public • Published

eslint-plugin-sesnible

Better comma first indent rules for eslint, and other sane defaults

Rules

  • redent: Fixes punctuation and operator indent to work better with comma first settings
  • check-require: Ensures that all packages that are required are installed in package.json or exist locally
'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)
})()

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.1.0
    376
    • latest

Version History

Package Sidebar

Install

npm i eslint-plugin-sensible

Weekly Downloads

600

Version

3.1.0

License

MIT

Unpacked Size

185 kB

Total Files

11

Last publish

Collaborators

  • esatterwhite
  • skyring