Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-actions-on-google

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-actions-on-google

Linter for Actions on Google response generation.

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

eslint-plugin-actions-on-google

This repository provides implementation of rules to check for common errors in response generation inside of your webhook code on Actions on Google platform using the official Actions on Google Node.js client library.

NPM Version

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-actions-on-google:

$ npm install eslint-plugin-actions-on-google --save-dev

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

Usage

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

{
    "plugins": [
        "actions-on-google"
    ]
}

Then configure the rules you want to use under the rules section. In the snippet below, rule-name is a placeholder value for an actual name of a rule)

{
    "rules": {
        "actions-on-google/rule-name": "error"
    }
}

Supported Rules

  • always-return-promise
    • If intent handler uses a Promise, it must return it.
  • at-most-two-simple-responses
    • The response returned by Actions on Google fulfillment must have <=2 simple responses per turn.
  • first-item-simple-response-or-helper
    • The first item in webhook response must be a simple response, or a helper
  • must-return-response
    • The response returned by Actions on Google fulfillment must return a client library response.

For source code of the rules refer to lib/rules/

References & Issues

Make Contributions

Please read and follow the steps in the CONTRIBUTING.md.

Developer's Guide

The plugin was implemented using the official ESLint guide. Please refer to those docs on how to get started with writing new rules.

The rules were created based on:

  • The official Actions on Google Responses documentation.
  • The most common issues reported by developers

Most of the rules regarding the Actions on Google response generation has to do with:

  • How many of a kind the final response contains. For example, it's only allowed to have at most 2 simple responses, or at most 8 suggestions chips.
  • Was something returned or not. For example, suggestion chips are not allowed in a FinalResponse. Please refer for a full list of rules in the documentation.

As such, we implemented useful library modules to assist with those 2 tasks, located in count-scope-manager and presence-scope-manager. Additionally, we provide library for classifying simple and helper responses. Together those modules can be reused to create more rules.

Note

  • Performing robust checks is difficult on a dynamically typed language, such as JavaScript. As such, linter is not guaranteed to raise 100% of the issues in your code. However, we provide guarantees that those errors reported by the linter are valid.
  • Linter entirely relies on the Action code written using Actions on Google Node.js client library.

License

See LICENSE.

Terms

Your use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the Google APIs Terms of Service.

Keywords

FAQs

Package last updated on 15 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc