@freshheads/eslint-plugin-freshheads-analytics
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

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"
            }
        ]
    }
}

Package Sidebar

Install

npm i @freshheads/eslint-plugin-freshheads-analytics

Weekly Downloads

0

Version

0.0.6

License

ISC

Unpacked Size

95.8 kB

Total Files

33

Last publish

Collaborators

  • tech-freshheads