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

use eslint-config-apostrophe without override #4886

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
100 changes: 3 additions & 97 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,100 +1,6 @@
{
"extends": [
"apostrophe",
"plugin:vue/vue3-recommended"
],
"env": {
"mocha": true
},
"globals": {
"apos": true
},
"rules": {
"max-len": "off",
"no-var": "error",
"no-console": 0,
"vue/no-deprecated-v-on-native-modifier": 0,
"multiline-ternary": "off",
"no-unused-vars": [
"error",
{ "varsIgnorePattern": "^_.", "args": "none" }
],
"vue/no-deprecated-destroyed-lifecycle": 0,
"vue/v-on-event-hyphenation": 1,
"vue/custom-event-name-casing": ["warn", "kebab-case"],
"vue/component-tags-order": [
"warn",
{
"order": [
"template",
"script",
"style"
]
}
],
"vue/max-attributes-per-line": [
"warn",
{
"singleline": 2
}
],
"vue/singleline-html-element-content-newline": [
"warn",
{
"ignoreWhenNoAttributes": true,
"ignoreWhenEmpty": true,
"ignores": [
"h1",
"h2",
"h3",
"pre",
"textarea"
]
}
]
},
"overrides": [
{
"files": "*.vue",
"globals": {
"defineProps": "readonly",
"defineEmits": "readonly",
"defineExpose": "readonly",
"defineOptions": "readonly",
"defineModel": "readonly",
"defineSlots": "readonly"
}
},
{
"files": [
"**/ui/**/*.js"
],
"globals": {
"apos": true
},
"env": {
"browser": true
}
},
{
"files": [
"**/ui/public/*.js"
],
"globals": {
"apos": true
},
"env": {
"browser": true
},
"rules": {
"no-var": 0
}
}
],
"parser": "vue-eslint-parser",
"parserOptions": {
"parser": "@babel/eslint-parser",
"sourceType": "module",
"requireConfigFile": false
}
"plugin:vue/recommended",
"apostrophe"
]
}
5 changes: 4 additions & 1 deletion lib/moog.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ module.exports = function(options) {
} else {
// Extend the default base class by default, if any, unless
// we're it
if (self.options.defaultBaseClass && className !== self.options.defaultBaseClass) {
if (
self.options.defaultBaseClass &&
className !== self.options.defaultBaseClass
) {
definition.extend = self.options.defaultBaseClass;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
class="apos-admin-bar-wrapper"
:class="themeClass"
>
<div ref="spacer" class="apos-admin-bar-spacer" />
<div
ref="spacer"
class="apos-admin-bar-spacer"
/>
<nav
ref="adminBar"
class="apos-admin-bar"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<template>
<ol class="apos-admin-bar__items" role="menu">
<li v-if="pageTree" class="apos-admin-bar__item">
<ol
class="apos-admin-bar__items"
role="menu"
>
<li
v-if="pageTree"
class="apos-admin-bar__item"
>
<AposButton
type="subtle"
label="apostrophe:pages"
Expand Down Expand Up @@ -39,7 +45,10 @@
@click="emitEvent(item.action)"
/>
</li>
<li v-if="createMenu.length > 0" class="apos-admin-bar__item">
<li
v-if="createMenu.length > 0"
class="apos-admin-bar__item"
>
<AposContextMenu
class="apos-admin-bar__create"
:menu="createMenu"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@
mixins: [ AposPublishMixin, AposAdvisoryLockMixin ],
emits: [ 'visibility-changed' ],
data() {
const query = apos.http.parseQuery(location.search);

Check failure on line 62 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (22, 8)

'location' is not defined

Check failure on line 62 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (22, 7)

'location' is not defined

Check failure on line 62 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (20, 7)

'location' is not defined

Check failure on line 62 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (20, 6)

'location' is not defined

Check failure on line 62 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (18, 8)

'location' is not defined

Check failure on line 62 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (22, 6)

'location' is not defined

Check failure on line 62 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (18, 7)

'location' is not defined

Check failure on line 62 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (18, 6)

'location' is not defined
// If the URL references a draft, go into draft mode but then clean up the URL
const draftMode = query.aposMode || 'published';
if (draftMode === 'draft') {
const newQuery = { ...query };
delete newQuery.aposMode;
history.replaceState(null, '', apos.http.addQueryToUrl(location.href, newQuery));

Check failure on line 68 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (22, 8)

'history' is not defined

Check failure on line 68 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (22, 8)

'location' is not defined

Check failure on line 68 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (22, 7)

'history' is not defined

Check failure on line 68 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (22, 7)

'location' is not defined

Check failure on line 68 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (20, 7)

'history' is not defined

Check failure on line 68 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (20, 7)

'location' is not defined

Check failure on line 68 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (20, 6)

'history' is not defined

Check failure on line 68 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (20, 6)

'location' is not defined

Check failure on line 68 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (18, 8)

'history' is not defined

Check failure on line 68 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (18, 8)

'location' is not defined

Check failure on line 68 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (22, 6)

'history' is not defined

Check failure on line 68 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (22, 6)

'location' is not defined

Check failure on line 68 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (18, 7)

'history' is not defined

Check failure on line 68 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (18, 7)

'location' is not defined

Check failure on line 68 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (18, 6)

'history' is not defined

Check failure on line 68 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (18, 6)

'location' is not defined
}
return {
patchesSinceLoaded: [],
Expand All @@ -82,9 +82,11 @@
saved: false,
savingTimeout: null,
published: null,
context: window.apos.adminBar.context ? {
...window.apos.adminBar.context
} : {},
context: window.apos.adminBar.context
? {
...window.apos.adminBar.context
}
: {},
contextStack: [],
// If a published context doc itself is not editable this will contain a hint
// that the draft version is editable, when appropriate. It should only be
Expand Down Expand Up @@ -181,10 +183,10 @@
window.addEventListener('storage', this.onStorage);

// sessionStorage because it is deliberately browser-tab specific
let tabId = sessionStorage.getItem('aposTabId');

Check failure on line 186 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (22, 8)

'sessionStorage' is not defined

Check failure on line 186 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (22, 7)

'sessionStorage' is not defined

Check failure on line 186 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (20, 7)

'sessionStorage' is not defined

Check failure on line 186 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (20, 6)

'sessionStorage' is not defined

Check failure on line 186 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (18, 8)

'sessionStorage' is not defined

Check failure on line 186 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (22, 6)

'sessionStorage' is not defined

Check failure on line 186 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (18, 7)

'sessionStorage' is not defined

Check failure on line 186 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (18, 6)

'sessionStorage' is not defined
if (!tabId) {
tabId = createId();
sessionStorage.setItem('aposTabId', tabId);

Check failure on line 189 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (22, 8)

'sessionStorage' is not defined

Check failure on line 189 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (22, 7)

'sessionStorage' is not defined

Check failure on line 189 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (20, 7)

'sessionStorage' is not defined

Check failure on line 189 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (20, 6)

'sessionStorage' is not defined

Check failure on line 189 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (18, 8)

'sessionStorage' is not defined

Check failure on line 189 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (22, 6)

'sessionStorage' is not defined

Check failure on line 189 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (18, 7)

'sessionStorage' is not defined

Check failure on line 189 in modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue

View workflow job for this annotation

GitHub Actions / build (18, 6)

'sessionStorage' is not defined
}
window.apos.adminBar.tabId = tabId;
window.apos.adminBar.editMode = false;
Expand Down Expand Up @@ -582,9 +584,11 @@
...apos.http.parseQuery(window.location.search),
aposRefresh: '1',
aposMode: this.draftMode,
...(this.editMode ? {
aposEdit: '1'
} : {})
...(this.editMode
? {
aposEdit: '1'
}
: {})
};

if (doc._url) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
v-bind="savingIndicator.options"
class="apos-admin-bar__status__icon"
/>
<div ref="statusLabel" class="apos-admin-bar__status__label">
<div
ref="statusLabel"
class="apos-admin-bar__status__label"
>
{{ $t(savingLabel) }}
</div>
</span>
Expand Down
8 changes: 4 additions & 4 deletions modules/@apostrophecms/admin-bar/ui/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* If the page delivers a logged-out content but we know from session storage that a user is logged-in,
* we force-refresh the page to bypass the cache, in order to get the logged-in content (with admin UI).
*/
// If the page delivers a logged-out content but we know from session storage
// that a user is logged-in, we force-refresh the page to bypass the cache,
// in order to get the logged-in content (with admin UI).
export default function() {
const isLoggedOutPageContent = !(apos.login && apos.login.user);
const isLoggedInCookie = apos.util.getCookie(`${self.apos.shortName}.loggedIn`) === 'true';
Expand All @@ -19,6 +18,7 @@ export default function() {
refreshedPages[location.href] = true;
sessionStorage.setItem('aposRefreshedPages', JSON.stringify(refreshedPages));

// eslint-disable-next-line no-console
console.info('Received logged-out content from cache while logged-in, refreshing the page');

location.reload();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template>
<div class="apos-area-menu" :class="{'apos-is-focused': groupIsFocused}">
<div
class="apos-area-menu"
:class="{'apos-is-focused': groupIsFocused}"
>
<AposContextMenu
v-bind="extendedContextMenuOptions"
ref="contextMenu"
Expand All @@ -16,7 +19,10 @@
class="apos-area-menu__item"
:class="{'apos-has-group': item.items}"
>
<dl v-if="item.items" class="apos-area-menu__group">
<dl
v-if="item.items"
class="apos-area-menu__group"
>
<dt>
<button
v-if="item.items"
Expand Down Expand Up @@ -44,7 +50,10 @@
/>
</button>
</dt>
<dd class="apos-area-menu__group-list" role="region">
<dd
class="apos-area-menu__group-list"
role="region"
>
<ul
:id="`${menuId}-group-${itemIndex}`"
class="apos-area-menu__items apos-area-menu__items--accordion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
:key="groupIndex"
class="apos-widget-group"
>
<h2 v-if="group.label" class="apos-widget-group__label">{{ $t(group.label) }}</h2>
<h2
v-if="group.label"
class="apos-widget-group__label"
>
{{ $t(group.label) }}
</h2>
<div
:class="[
`apos-widget-group--${group.columns}-column${
Expand Down Expand Up @@ -52,7 +57,10 @@
<p class="apos-widget__label">
{{ $t(item.label) }}
</p>
<p v-if="item.description" class="apos-widget__help">
<p
v-if="item.description"
class="apos-widget__help"
>
{{ $t(item.description) }}
</p>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
>
<ol class="apos-area-widget__breadcrumbs">
<li class="apos-area-widget__breadcrumb apos-area-widget__breadcrumb--widget-icon">
<AposIndicator :icon="widgetIcon" :icon-size="13" />
<AposIndicator
:icon="widgetIcon"
:icon-size="13"
/>
</li>
<li
v-for="(item, index) in breadcrumbs.list"
Expand All @@ -45,7 +48,10 @@
@click="getFocus($event, item.id)"
/>
</li>
<li class="apos-area-widget__breadcrumb" data-apos-widget-breadcrumb="0">
<li
class="apos-area-widget__breadcrumb"
data-apos-widget-breadcrumb="0"
>
<AposButton
type="quiet"
:label="foreign ? {
Expand Down
Loading
Loading