1.1.0 • Published 5 years ago

eslint-plugin-metrics v1.1.0

Weekly downloads
185
License
ISC
Repository
-
Last release
5 years ago

eslint-plugin-metrics

Build Status

Check metrics definition

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-metrics:

$ npm install eslint-plugin-metrics --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-metrics globally.

Usage

Add metrics to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "metrics"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "metrics/metrics-definition": 2,
        "metrics/metrics-documentation": 2,
    }
}

Supported Rules

  • metrics-definition: Check that a single argument is used to increment a metric and that its type is string or TemplateLitteral.
metrics.increment('server.started');
  • metrics-documentation: Check that any metrics.increment is documented with the appropriate format:
/**
 * @metric server.started Server has started
 */
metrics.increment('server.started');

// @metric server.started Server has started
metrics.increment('server.started');

Bin

A tool is also available to generate the metrics inventory in /docs/metrics.md:

The script is:

node ./node_modules/eslint-plugin-metrics/bin/metrics.js ./src

# Or in npm context:
metrics ./src
1.1.0

5 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago