Skip to content
Merged
Prev Previous commit
Next Next commit
chore(eslint): apply vue-related rules
- vue/no-boolean-default
- vue/no-required-prop-with-default
- vue/no-unused-properties

Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy committed Jun 16, 2025
commit 6513d49da69f426b4fddb5dda1f47f0d01a52ac6
3 changes: 0 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ export default [
{
rules: {
'no-console': 'off',
'vue/no-boolean-default': 'off',
'vue/no-required-prop-with-default': 'off',
'vue/no-unused-properties': 'off',
},
},
]
48 changes: 19 additions & 29 deletions src/Components/ActionButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
v-if="isWebLink"
variant="primary"
class="action-button pull-right"
:href="link"
:href="action.link"
@click="onClickActionButtonWeb">
{{ label }}
{{ action.label }}
</NcButton>
<NcButton
v-else
:variant="primary ? 'primary' : 'secondary'"
:variant="action.primary ? 'primary' : 'secondary'"
class="action-button pull-right"
@click="onClickActionButton">
{{ label }}
{{ action.label }}
</NcButton>
</template>

Expand All @@ -27,6 +27,14 @@ import { emit } from '@nextcloud/event-bus'
import { t } from '@nextcloud/l10n'
import NcButton from '@nextcloud/vue/components/NcButton'

/**
* @typedef {object} NotificationAction
* @property {string} label action label (required)
* @property {string} link action link (required)
* @property {string} type action type (required)
* @property {boolean} primary action primary (required)
*/

export default {
name: 'ActionButton',

Expand All @@ -35,27 +43,9 @@ export default {
},

props: {
label: {
type: String,
default: '',
required: true,
},

link: {
type: String,
default: '',
required: true,
},

type: {
type: String,
default: '',
required: true,
},

primary: {
type: Boolean,
default: false,
action: {
/** @type {ObjectConstructor<NotificationAction>} */
type: Object,
required: true,
},

Expand All @@ -77,7 +67,7 @@ export default {
},

typeWithDefault() {
return this.type || 'GET'
return this.action.type || 'GET'
},
},

Expand All @@ -88,7 +78,7 @@ export default {
cancelAction: false,
notification: this.$parent.$props,
action: {
url: this.link,
url: this.action.link,
type: this.typeWithDefault,
},
}
Expand All @@ -110,7 +100,7 @@ export default {
cancelAction: false,
notification: this.$parent.$props,
action: {
url: this.link,
url: this.action.link,
type: this.typeWithDefault,
},
}
Expand All @@ -124,7 +114,7 @@ export default {
// execute action
await axios({
method: this.typeWithDefault,
url: this.link,
url: this.action.link,
})

// emit event to current app
Expand Down
8 changes: 6 additions & 2 deletions src/Components/NotificationItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@

<div v-if="actions.length" class="notification-actions">
<ActionButton
v-for="(a, i) in actions"
v-for="(action, i) in actions"
:key="i"
v-bind="a"
:action="action"
:notification-index="index" />
</div>
<div v-else-if="externalLink" class="notification-actions">
Expand Down Expand Up @@ -146,6 +146,7 @@ export default {
default: '',
},

// eslint-disable-next-line vue/no-unused-properties
user: {
type: String,
default: '',
Expand Down Expand Up @@ -190,13 +191,16 @@ export default {
default: '',
},

// eslint-disable-next-line vue/no-unused-properties
objectId: {
type: String,
default: '',
},

// eslint-disable-next-line vue/no-unused-properties
shouldNotify: {
type: Boolean,
// eslint-disable-next-line vue/no-boolean-default
default: true,
},

Expand Down
1 change: 1 addition & 0 deletions src/Components/Parameters/DefaultParameter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default {
required: true,
},

// eslint-disable-next-line vue/no-unused-properties
id: {
type: [Number, String],
required: true,
Expand Down
2 changes: 2 additions & 0 deletions src/Components/Parameters/FileParameter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ export default {
name: 'FileParameter',

props: {
// eslint-disable-next-line vue/no-unused-properties
type: {
type: String,
required: true,
},

// eslint-disable-next-line vue/no-unused-properties
id: {
type: [Number, String],
required: true,
Expand Down
1 change: 1 addition & 0 deletions src/Components/Parameters/UserParameter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default {
},

props: {
// eslint-disable-next-line vue/no-unused-properties
type: {
type: String,
required: true,
Expand Down
Loading