feat(eslint): add jsdoc rules

This commit is contained in:
MrTimscampi 2020-09-06 21:29:05 +02:00
parent 47c45f5190
commit 1ef9d60159
5 changed files with 48 additions and 5 deletions

View File

@ -6,6 +6,7 @@ module.exports = {
},
extends: [
'eslint:recommended',
'plugin:jsdoc/recommended',
'plugin:@typescript-eslint/recommended',
'@nuxtjs/eslint-config-typescript',
'prettier',
@ -17,7 +18,7 @@ module.exports = {
'plugin:import/warnings',
'plugin:import/typescript'
],
plugins: ['prettier', 'promise', 'import'],
plugins: ['prettier', 'promise', 'import', 'jsdoc'],
// add your custom rules here
rules: {
'import/newline-after-import': 'error',

View File

@ -9,9 +9,10 @@ const imageHelper = Vue.extend({
methods: {
/**
* Get the URL of an item's image
* @param id itemId to get image for
* @param type type of image (primary/backdrop)
* @returns URL of the link to the image
*
* @param {string} id - itemId to get image for
* @param {string} type - type of image (primary/backdrop)
* @returns {string} URL of the link to the image
*/
getImageLink(id: string, type: string): string {
return `${this.$axios.defaults.baseURL}/Items/${id}/Images/${type}`;

View File

@ -54,6 +54,7 @@
"eslint-config-prettier": "^6.11.0",
"eslint-import-resolver-nuxt": "^1.0.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsdoc": "^30.3.2",
"eslint-plugin-nuxt": "^1.0.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",

View File

@ -1,3 +1,9 @@
/**
* Get the Material Design Icon name associated with a type of library
*
* @param {(string | undefined | null)} libraryType - Type of the library
* @returns {string} Name of the Material Design Icon associated with the type
*/
export function getLibraryIcon(libraryType: string | undefined | null): string {
switch (libraryType) {
case 'movies':
@ -25,6 +31,12 @@ export function getLibraryIcon(libraryType: string | undefined | null): string {
}
}
/**
* Get the card shape associated with a collection type
*
* @param {(string | null | undefined)} collectionType - Type of the collection
* @returns {string} CSS class to use as the shape of the card
*/
export function getShapeFromCollectionType(
collectionType: string | null | undefined
): string {

View File

@ -3854,6 +3854,11 @@ commander@^6.0.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-6.1.0.tgz#f8d722b78103141006b66f4c7ba1e97315ba75bc"
integrity sha512-wl7PNrYWd2y5mp1OK/LhTlv8Ff4kQJQRXXAvF+uU/TPNiVJUxZLRYGj/B0y/lPGAVcSbJqH2Za/cvHmrPMC8mA==
comment-parser@^0.7.6:
version "0.7.6"
resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-0.7.6.tgz#0e743a53c8e646c899a1323db31f6cd337b10f12"
integrity sha512-GKNxVA7/iuTnAqGADlTWX4tkhzxZKXp5fLJqKTlQLHkE65XDUKutZ3BHaJC5IGcper2tT3QRD1xr4o3jNpgXXg==
commitizen@^4.0.3:
version "4.2.1"
resolved "https://registry.yarnpkg.com/commitizen/-/commitizen-4.2.1.tgz#3b098b16c6b1a37f0d129018dff6751b20cd3103"
@ -5121,6 +5126,19 @@ eslint-plugin-jest@^23.18.2:
dependencies:
"@typescript-eslint/experimental-utils" "^2.5.0"
eslint-plugin-jsdoc@^30.3.2:
version "30.3.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.3.2.tgz#208b05a9700a1449cb5f562c4ffb97827b34e778"
integrity sha512-52p1xlKNm2Rodo51jUPIQ1ytKXH6Uj88mDJgmZ1znRKjynDQOO4ZS9cx5FqFoRXk/iqHv15QxHkQCBVeWViIog==
dependencies:
comment-parser "^0.7.6"
debug "^4.1.1"
jsdoctypeparser "^9.0.0"
lodash "^4.17.20"
regextras "^0.7.1"
semver "^7.3.2"
spdx-expression-parse "^3.0.1"
eslint-plugin-node@^11.1.0:
version "11.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz#c95544416ee4ada26740a30474eefc5402dc671d"
@ -7628,6 +7646,11 @@ jsbn@~0.1.0:
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM=
jsdoctypeparser@^9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/jsdoctypeparser/-/jsdoctypeparser-9.0.0.tgz#8c97e2fb69315eb274b0f01377eaa5c940bd7b26"
integrity sha512-jrTA2jJIL6/DAEILBEh2/w9QxCuwmvNXIry39Ay/HVfhE3o2yVV0U44blYkqdHA/OKloJEqvJy0xU+GSdE2SIw==
jsdom@^16.2.2:
version "16.4.0"
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.4.0.tgz#36005bde2d136f73eee1a830c6d45e55408edddb"
@ -10425,6 +10448,11 @@ regexpu-core@^4.7.0:
unicode-match-property-ecmascript "^1.0.4"
unicode-match-property-value-ecmascript "^1.2.0"
regextras@^0.7.1:
version "0.7.1"
resolved "https://registry.yarnpkg.com/regextras/-/regextras-0.7.1.tgz#be95719d5f43f9ef0b9fa07ad89b7c606995a3b2"
integrity sha512-9YXf6xtW+qzQ+hcMQXx95MOvfqXFgsKDZodX3qZB0x2n5Z94ioetIITsBtvJbiOyxa/6s9AtyweBLCdPmPko/w==
regjsgen@^0.5.1:
version "0.5.2"
resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.5.2.tgz#92ff295fb1deecbf6ecdab2543d207e91aa33733"
@ -11164,7 +11192,7 @@ spdx-exceptions@^2.1.0:
resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d"
integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==
spdx-expression-parse@^3.0.0:
spdx-expression-parse@^3.0.0, spdx-expression-parse@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679"
integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==