0.0.6 • Published 9 months ago

@freshheads/eslint-plugin-freshheads-analytics v0.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

eslint-plugin-freshheads-analytics

make sure we track all user events

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-freshheads-analytics:

npm install eslint-plugin-freshheads-analytics --save-dev

Usage

Default usage

add plugin:freshheads-analytics/recommended to te extends section of your .eslintrc configuration file.

{
    "extends": ["plugin:@freshheads/freshheads-analytics/recommended"]
}

custom usage

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

{
    "plugins": ["@freshheads/freshheads-analytics"]
}

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

{
    "rules": {
        "@freshheads/freshheads-analytics/element-has-required-eventprop": [
            "error",
            {
                "elementsToCheck": [
                    "a",
                    "button",
                    "input",
                    "select",
                    "textarea",
                    "Button",
                    "Link",
                    "ChakraLink",
                    "NextLink",
                    "IconButton"
                ],
                "alternativeTrackingMethodProps": [
                    "onClick",
                    "onMouseDown",
                    "onMouseUp",
                    "onSubmit",
                    "onDblClick",
                    "onDoubleClick",
                    "onDrag",
                    "onPause",
                    "onPlay",
                    "onKeyDown",
                    "onKeyPress",
                    "onKeyUp"
                ]
            }
        ],
        "@freshheads/freshheads-analytics/eventprop-has-tracking-event": [
            "error",
            {
                "eventsToTrack": [
                    "onClick",
                    "onMouseDown",
                    "onMouseUp",
                    "onSubmit",
                    "onDblClick",
                    "onDoubleClick",
                    "onDrag",
                    "onPause",
                    "onPlay",
                    "onKeyDown",
                    "onKeyPress",
                    "onKeyUp"
                ],
                "trackingFunctionName": "pushTrackingEvent"
            }
        ]
    }
}