support writing aspida api definition
npm install eslint-plugin-aspidasupport writing aspida api definition
You'll first need to install ESLint:
```
$ npm i eslint --save-dev
Next, install eslint-plugin-aspida:
``
$ npm install eslint-plugin-aspida --save-dev
Add aspida to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
`json`
{
"plugins": [
"aspida"
]
}
Then configure the rules you want to use under the rules section.
`json`
{
"rules": {
"aspida/rule-name": 2
}
}
We serve recommended configure. To use it:
`json`
{
"extends": [
"plugin:aspida/recommended"
]
}
exported.$3
Disallow unused member in each methods.$3
Disallow using literal or expression as interface key.$3
Disallow non-property-signature (like below)`typescript
interface Methods {
get: {
query: Type; // valid
[key: string]: Type; // invalid
}
}
`$3
Disallow old (aspida < 0.14) member name reqData and resData$3
Disallow Refer type in each methods.`typescript
interface Methods {
get: {
query: Type; // valid
};
post: PostDefinitionType; // invalid
}
`Ignoring this rule won't cause error but other rule won't work correctly
$3
Limit reqFormat type one of these:
- ArrayBuffer
- Blob
- string
- FormData$3
Make sure method name is one of valid HTTP method
- get
- head
- post
- put
- delete
- connect
- options
- trace
- patch$3
Disallow invalid type like below:`typescript
interface Methods {
get;
post: any;
put: {
query;
}
}
``