@devil7softwares/eslint-plugin-axios-swagger
v1.0.0
Published
ESLint plugin to lint routes used in the app with axios using swagger spec.
Downloads
1
Maintainers
Readme
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
Install the package
npm install --save-dev @devil7softwares/eslint-plugin-axios-swagger
(or)
yarn add --dev @devil7softwares/eslint-plugin-axios-swagger
Add the plugin to the eslint configuration
{ "plugins": ["@devil7softwares/axios-swagger"] }
Add rules to the eslint configuratin
{ "rules": { "@devil7softwares/axios-swagger/no-unknown-route": "error", "@devil7softwares/axios-swagger/no-unsupported-method": "error" } }
Add paths to swagger spec to settings in the eslint configuration
{ "settings": { "axios-swagger": { "specs": ["./spec/swagger.json"] } } }
Available Settings
Available Rules
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')
oraxios.post('/users', data)
- The baseUrl can only be used globally i.e. you can't use different baseUrls for different places.