Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix eslintrc rules #1045

Merged
merged 8 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 63 additions & 58 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,64 +24,69 @@ module.exports = {
'no-console': 'off',
'semi': 'off',

// override/add rules settings here
"vue/attributes-order": ["warn", {
"order": [
"GLOBAL",
"OTHER_ATTR",
"DEFINITION",
"TWO_WAY_BINDING",
"OTHER_DIRECTIVES",
"EVENTS",
"RENDER_MODIFIERS",
"CONTENT",
"CONDITIONALS",
],
"alphabetical": false
}],
"vue/order-in-components": ["warn", {
"order": [
["template", "render"],
"extends",
"el",
"name",
"key",
"parent",
"functional",
["delimiters", "comments"],
["components", "directives", "filters"],
"mixins",
["provide", "inject"],
"ROUTER_GUARDS",
"layout",
"middleware",
"validate",
"scrollToTop",
"transition",
"loading",
"inheritAttrs",
"model",
["props", "propsData"],
"emits",
"setup",
"asyncData",
"data",
"fetch",
"head",
"computed",
"watch",
"watchQuery",
"LIFECYCLE_HOOKS",
"methods",
"renderError"
]
}],
"vue/first-attribute-linebreak": ["warn", {
"singleline": "beside",
"multiline": "ignore"
}],
"vue/multi-word-component-names": ["warn"],
"vue/no-v-html": ["off"],
// override/add rules settings here
'vue/attributes-order': ['warn', {
'order': [
'GLOBAL',
'OTHER_ATTR',
'DEFINITION',
'TWO_WAY_BINDING',
'OTHER_DIRECTIVES',
'EVENTS',
'RENDER_MODIFIERS',
'CONTENT',
'CONDITIONALS',
],
'alphabetical': false
}],
'vue/first-attribute-linebreak': ['warn', {
'singleline': 'beside',
'multiline': 'ignore'
}],
'vue/html-indent': ['warn', 4],
'vue/multi-word-component-names': ['warn'],
'vue/no-mutating-props': ['warn'],
'vue/no-unused-components': ['warn'],
'vue/no-use-v-if-with-v-for': ['warn'],
'vue/no-v-html': ['off'],
'vue/order-in-components': ['warn', {
'order': [
['template', 'render'],
'extends',
'el',
'name',
'key',
'parent',
'functional',
['delimiters', 'comments'],
['components', 'directives', 'filters'],
'mixins',
['provide', 'inject'],
'ROUTER_GUARDS',
'layout',
'middleware',
'validate',
'scrollToTop',
'transition',
'loading',
'inheritAttrs',
'model',
['props', 'propsData'],
'emits',
'setup',
'asyncData',
'data',
'fetch',
'head',
'computed',
'watch',
'watchQuery',
'LIFECYCLE_HOOKS',
'methods',
'renderError'
]
}],
'vue/require-v-for-key': ['warn'],
},
parserOptions: {
ecmaVersion: 2021,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ jobs:
run: yarn build

- name: Run ESLint
run: yarn eslint resources/js/**/*.js
run: yarn eslint resources/js/**/*.js resources/js/**/*.vue
12 changes: 3 additions & 9 deletions resources/js/app/components/json-editor/json-editor.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<template>
<div class="json-editor" />
</template>
<script>
import { JSONEditor } from 'vanilla-jsoneditor';

export default {
name: 'json-editor',

components: {
JSONEditor,
},
name: 'JsonEditor',

props: {
target: {
Expand All @@ -33,10 +30,7 @@ export default {

mounted() {
const element = document.getElementById(this.target);
const options = Object.assign({
content: { text: this.text },
readOnly: true
}, this.options);
const options = {content: { text: this.text }, readOnly: true, ...this.options};
this.editor = new JSONEditor({
target: element,
props: options
Expand Down
31 changes: 21 additions & 10 deletions resources/js/app/components/object-property/object-properties.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<template>

<div class="properties-container">

<object-property v-for="(prop, index) in properties"
<object-property v-for="prop in properties"
:key="prop.id"
:prop="prop"
:type="type"
Expand All @@ -15,19 +13,32 @@
<p v-if="properties.length == 0">
{{ t('No properties') }}
</p>

</div>

</template>
<script>

export default {
props: {
initProperties: [],
type: '',
hidden: [],
translatable: [],
translationRules: [],
initProperties: {
type: Array,
default: () => ([]),
},
type: {
type: String,
default: '',
},
hidden: {
type: Array,
default: () => ([]),
},
translatable: {
type: Array,
default: () => ([]),
},
translationRules: {
type: Array,
default: () => ([]),
},
},

components: {
Expand Down
30 changes: 24 additions & 6 deletions resources/js/app/components/object-property/object-property.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,30 @@ import { t } from 'ttag';

export default {
props: {
prop: [],
nobuttonsfor: [],
type: '',
isHidden: false,
isNew: false,
isTranslatable: false,
prop: {
type: Object,
default: () => ({}),
},
nobuttonsfor: {
type: Array,
default: () => ([]),
},
type: {
type: String,
default: '',
},
isHidden: {
type: Boolean,
default: false,
},
isNew: {
type: Boolean,
default: false,
},
isTranslatable: {
type: Boolean,
default: false,
},
},

data() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<app-icon icon="carbon:content-view"></app-icon>
<i class="ml-05">{{ msgChange }}</i>
</span>
<template v-for="item,key in items">
<template v-for="item in items">
<span>{{ formatDate(item?.meta?.created) }}</span>
<span>
{{ msgAction }}
Expand Down Expand Up @@ -129,7 +129,7 @@ export default {
loadHistory(pageSize = 20, page = 1) {
this.loading = true;
this.getHistory(pageSize, page)
.catch(_error => { this.loading = false; return false;})
.catch(_error => { console.error(_error); this.loading = false; return false; })
.then(response => {
this.loading = false;
this.items = response.data || [];
Expand All @@ -138,7 +138,7 @@ export default {
const objectIds = this.items.map(item => item.meta.resource_id).filter((v, i, a) => a.indexOf(v) === i).map(i=>Number(i));
const ids = [...userIds, ...objectIds];
this.getObjects(ids)
.catch(_error => { return false;})
.catch(_error => { console.error(_error); return false; })
.then(response => {
const items = response.data || [];
const resourcesMap = items.reduce((map, obj) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default {
props: {
groups: {
type: Object,
default: {},
default: () => {},
},
relatedObjects: {
type: Array,
Expand Down
25 changes: 20 additions & 5 deletions resources/js/app/components/tag-picker/tag-picker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,27 @@ export default {
},

props: {
id: String,
id: {
type: String,
default: '',
},
disabled: Boolean,
label: String,
form: String,
initialTags: Array,
searchonly: false,
label: {
type: String,
default: '',
},
form: {
type: String,
default: '',
},
initialTags: {
type: Array,
default: () => ([]),
},
searchonly: {
type: Boolean,
default: false,
},
},

data() {
Expand Down
2 changes: 1 addition & 1 deletion resources/js/app/components/thumbnail/thumbnail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
props: {
related: {
type: Object,
default: {}
default: () => {},
},
},

Expand Down
4 changes: 2 additions & 2 deletions resources/js/app/components/user-accesses/user-accesses.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<app-icon icon="carbon:user"></app-icon>
<i class="ml-05">{{ msgUser }}</i>
</span>
<template v-for="user,key in accesses">
<template v-for="user in accesses">
<span>{{ formatDate(user?.meta?.last_login) }}</span>
<span>
<a class="tag has-background-module-users" :href="`/users/view/${user.id}`" target="_new">
Expand Down Expand Up @@ -84,7 +84,7 @@ export default {
loadAccesses(pageSize = 20, page = 1) {
this.loading = true;
this.getAccesses(pageSize, page)
.catch(_error => { this.loading = false; return false;})
.catch(_error => { console.error(_error); this.loading = false; return false; })
.then(response => {
this.loading = false;
this.accesses = response.data || [];
Expand Down
Loading