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

@devil7softwares/eslint-plugin-axios-swagger

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devil7softwares/eslint-plugin-axios-swagger

ESLint plugin to lint routes used in the app with axios using swagger spec.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

eslint-plugin-axios-swagger

ESLint plugin to lint routes used in the app with axios using swagger spec.

This plugin takes your swagger spec json files and checks whether the method and routes you use with axios exists.

Getting Started

  1. Install the package

    npm install --save-dev @devil7softwares/eslint-plugin-axios-swagger
    

    (or)

    yarn add --dev @devil7softwares/eslint-plugin-axios-swagger
    
  2. Add the plugin to the eslint configuration

    {
        "plugins": ["@devil7softwares/axios-swagger"]
    }
    
  3. Add rules to the eslint configuratin

    {
        "rules": {
            "@devil7softwares/axios-swagger/no-unknown-route": "error",
            "@devil7softwares/axios-swagger/no-unsupported-method": "error"
        }
    }
    
  4. Add paths to swagger spec to settings in the eslint configuration

    {
        "settings": {
            "axios-swagger": {
                "specs": ["./spec/swagger.json"]
            }
        }
    }
    

Available Settings

KeyTypeRequiredDescription
specsArray<string>Paths of swagger specification files. Paths should be relative to the package root where the plugin is installed.
basePathstringBase path for URL.

Available Rules

RuleDescription
@devil7softwares/axios-swagger/no-unknown-routeEnforces that no routes that are not specified in the swagger spec can be used
@devil7softwares/axios-swagger/no-unsupported-methodEnforces that the matched routes are used only with methods specified in the swagger spec

Cavets

NOTE: I wrote this plugin for using in my own projects. So, I handled all the scenarios I encountered. I have listed some of the scenarios where this plugin might not work. Feel free to make a pull request to fit your needs or let me know, maybe I'll look into it when I have the time.

  • Only JSON format of swagger spec is supported
  • The plugin only checks the routes of axios calls made using get, post, put, delete methods. e.g. axios.get('/users') or axios.post('/users', data)
  • The baseUrl can only be used globally i.e. you can't use different baseUrls for different places.

Keywords

FAQs

Package last updated on 12 Feb 2022

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