npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eslint-plugin-logdna

v2.0.1

Published

ESlint plugin containing a collection of rules for enforcing code style at LogDNA

Downloads

2,446

Readme

eslint-plugin-logdna

All Contributors

ESlint plugin containing a collection of rules for enforcing code style at LogDNA

Installation

Requires eslint also

We do not use peer dependencies, so make sure that eslint is also installed as a dev dependency.

npm install eslint-plugin-logdna eslint --save-dev

Usage

Add logdna to the plugins section of your ESLint configuration. You can omit the eslint-plugin- prefix. Then you can configure the rules you want to use:

{
  "plugins": [
    "logdna"
  ],
  "rules": {
    "logdna/grouped-require": 2,
    "logdna/require-file-extension": 2,
    "logdna/tap-no-deprecated-aliases": 2,
    "logdna/tap-consistent-assertions": [2, {
      "preferredMap": {
        "error": "error",
        "equal": "strictEqual",
      }
    }]
  }
}

Rules

logdna/grouped-require

Enforce sorted require declarations within modules

// Bad
const foo = require('./lib/foo.js') //local
const http = require('http') // builtin
require('foo') // static
const logger = require('@logdna/logger') // scoped
const tap = require('tap') // contrib

// Good
require('foo') // static
const http = require('http') // builtin
const tap = require('tap') // contrib
const logger = require('@logdna/logger') // scoped
const foo = require('./lib/foo.js') //local

Options

  • typeOrder <Array> - sort order of require types (default: ['static', 'builtin', 'contrib', 'scoped', 'local'])

logdna/tap-no-deprecated-aliases

Prevent usage of deprecated tap aliases (>= [email protected])

Tap deprecated assertion aliases as of version 15.0.0. This rule supersedes logdna/tap-consistent-assertions and will enforce the use of unaliased assertion methods.

// Bad
test('foo', async (t) => {
  t.is_equal(1, 1)
  t.strictEqual(1, 1)
  t.identical(1, 1)
})

// Good
test('foo', async (t) => {
  t.equal(1, 1)
  t.equal(1, 1)
  t.equal(1, 1)
})

Options

  • calleePattern <String> - pattern to match for tap's Test object (default: /^t+$/)

[Deprecated] logdna/tap-consistent-assertions

Enforce consistent aliases for tap assertions

// {
//   "plugins": [
//     "logdna"
//   ],
//   "rules": {
//     "logdna/tap-consistent-assertions": {
//       "preferredMap": {
//         "equal": "strictEqual"
//       }
//     }
//   }
// }

// Bad
test('foo', async (t) => {
  t.is_equal(1, 1)
  t.equal(1, 1)
  t.identical(1, 1)
})

// Good
test('foo', async (t) => {
  t.strictEqual(1, 1)
  t.strictEqual(1, 1)
  t.strictEqual(1, 1)
})

Options

  • preferredMap <Object> - maps the "primary" assertion method to the preferred alias
  • calleePattern <String> - pattern to match for tap's Test object (default: /^t+$/)

logdna/require-file-extension

Enforce file extension for local modules/files

// Bad
const foo = require('./lib/foo')

// Good
const foo = require('./lib/foo.js')

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

License

Copyright © LogDNA, released under an MIT license. See the LICENSE file and https://opensource.org/licenses/MIT

Happy Logging!