Skip to content
Closed
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
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

65 changes: 0 additions & 65 deletions .eslintrc.cjs

This file was deleted.

11 changes: 5 additions & 6 deletions blocks/browse/da-sites/da-sites.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export default class DaSites extends LitElement {
}
const helixString = url.hostname.split('.')[0];
if (!helixString) return null;
// eslint-disable-next-line no-unused-vars
const [_, repo, org] = helixString.split('--');
if (!repo || !org) return null;
return `#/${sanitizeName(org, false)}/${sanitizeName(repo, false)}`;
Expand Down Expand Up @@ -136,12 +135,12 @@ export default class DaSites extends LitElement {
renderGo() {
return html`
<form @submit=${this.handleGo}>
<input
<input
@keydown="${() => { this._urlError = false; }}"
@change="${() => { this._urlError = false; }}"
type="text" name="siteUrl"
placeholder="https://main--site--org.aem.page"
class="${this._urlError ? 'error' : nothing}"
@change="${() => { this._urlError = false; }}"
type="text" name="siteUrl"
placeholder="https://main--site--org.aem.page"
class="${this._urlError ? 'error' : nothing}"
/>
<div class="da-form-btn-offset">
<button aria-label="Go to site">
Expand Down
3 changes: 1 addition & 2 deletions blocks/edit/da-library/da-library.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable indent */
import { DOMParser as proseDOMParser, TextSelection, DOMSerializer } from 'da-y-wrapper';
import {
LitElement,
Expand Down Expand Up @@ -252,7 +251,7 @@ class DaLibrary extends LitElement {

if (insertParagraphAfter) {
const paragraph = window.view.state.schema.nodes.paragraph.create();
newTr = tr.insert(insertPos, paragraph);
newTr = tr.insert(insertPos, paragraph);
}

newTr = (newTr || tr).replaceSelectionWith(item.parsed);
Expand Down
1 change: 0 additions & 1 deletion blocks/edit/da-library/helpers/helpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-unresolved
import { DOMParser } from 'da-y-wrapper';
import { getDaAdmin } from '../../../shared/constants.js';
import getPathDetails from '../../../shared/pathDetails.js';
Expand Down
1 change: 0 additions & 1 deletion blocks/edit/da-library/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ function isHeading(element) {
function decorateImages(element, path) {
if (!element || !path) return;
try {
// eslint-disable-next-line no-unused-vars
const url = new URL(path);
element.querySelectorAll('img').forEach((img) => {
if (img.getAttribute('src').startsWith('./')) {
Expand Down
1 change: 1 addition & 0 deletions blocks/edit/da-title/da-title.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export default class DaTitle extends LitElement {
}

handleError(json, action, icon) {
// eslint-disable-next-line no-console
console.log('handleError', json, action, icon);
this._status = { ...json.error, action };
icon.classList.remove('is-sending');
Expand Down
18 changes: 15 additions & 3 deletions blocks/edit/prose/diff/diff-actions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable max-len */
/* global view */
// User action handlers - only loaded when user actually clicks action buttons

Expand Down Expand Up @@ -188,7 +187,14 @@ export function handleDeleteSingleNode(view, getPos, isValidPosition, isLocNode)
}
}

export function handleKeepSingleNode(view, getPos, isValidPosition, isLocNode, filterNodeContent, dispatchContentTransaction) {
export function handleKeepSingleNode(
view,
getPos,
isValidPosition,
isLocNode,
filterNodeContent,
dispatchContentTransaction,
) {
try {
const currentPos = getPos();
if (!isValidPosition(currentPos)) {
Expand Down Expand Up @@ -295,7 +301,13 @@ function handleOperation(context, { acceptAdded, acceptDeleted, getContent }) {
dispatchContentTransaction,
} = context;

const currentPair = getCurrentLocNodePair(view, getPos, isValidPosition, isLocNode, canFormLocPair);
const currentPair = getCurrentLocNodePair(
view,
getPos,
isValidPosition,
isLocNode,
canFormLocPair,
);
if (!currentPair) {
// eslint-disable-next-line no-console
console.warn('Could not find current loc node pair');
Expand Down
1 change: 0 additions & 1 deletion blocks/edit/prose/diff/diff-global-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ function findProseMirrorContainer(view) {
return view.dom.closest('.da-prose-mirror');
}

// eslint-disable-next-line import/prefer-default-export
export function showGlobalDialog(view, activeViews, simpleFilterContent, isLocNode) {
if (globalDialog?.parentNode) return; // Dialog already shown

Expand Down
1 change: 0 additions & 1 deletion blocks/edit/prose/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable max-classes-per-file */
import {
EditorState,
EditorView,
Expand Down
4 changes: 2 additions & 2 deletions blocks/edit/prose/plugins/focalPointDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const loadFaceApi = async () => {
faceDetectorOptions = new window.faceapi.TinyFaceDetectorOptions();
faceApiLoaded = true;
return true;
} catch (error) {
} catch (e) {
return false;
}
})();
Expand All @@ -54,7 +54,7 @@ const detectFaceCenter = async (img) => {
x: Math.max(0, Math.min(100, centerX)),
y: Math.max(0, Math.min(100, centerY)),
};
} catch (error) {
} catch (e) {
return null;
}
};
Expand Down
1 change: 0 additions & 1 deletion blocks/edit/prose/plugins/imageDrop.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-unresolved
import { Plugin, TextSelection } from 'da-y-wrapper';
import getPathDetails from '../../../shared/pathDetails.js';
import { daFetch } from '../../../shared/utils.js';
Expand Down
1 change: 0 additions & 1 deletion blocks/edit/prose/plugins/linkConverter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-unresolved
import { Plugin } from 'da-y-wrapper';
import { isURL } from '../../utils/helpers.js';

Expand Down
1 change: 0 additions & 1 deletion blocks/edit/prose/plugins/linkMenu/linkMenuItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ function removeLink(state, dispatch) {
return true;
}

/* eslint-disable import/prefer-default-export */
export function getLinkMenuItems() {
return [
{
Expand Down
1 change: 0 additions & 1 deletion blocks/edit/prose/plugins/linkTextSync.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-unresolved
import { Plugin } from 'da-y-wrapper';
import { isURL } from '../../utils/helpers.js';

Expand Down
2 changes: 1 addition & 1 deletion blocks/edit/prose/plugins/menu/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
wrapInList,
liftListItem,
sinkListItem,
// eslint-disable-next-line import/no-unresolved

} from 'da-y-wrapper';

import openPrompt from '../../../da-palette/da-palette.js';
Expand Down
1 change: 0 additions & 1 deletion blocks/edit/prose/plugins/slashMenu/slash-menu.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable max-len */
import { html, nothing } from 'da-lit';
import InContextMenu from '../inContextMenu.js';
import getSheet from '../../../../shared/sheet.js';
Expand Down
1 change: 0 additions & 1 deletion blocks/edit/prose/plugins/slashMenu/slashMenu.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable max-len */
import { Plugin, PluginKey } from 'da-y-wrapper';
import { getKeyAutocomplete, normalizeForSlashMenu, createKeyMenuItems } from './keyAutocomplete.js';
import { getDefaultItems, getTableCellItems, getTableItems } from './slashMenuItems.js';
Expand Down
2 changes: 0 additions & 2 deletions blocks/edit/prose/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ const baseNodes = {
contentElement: (dom) => {
[...dom.children].forEach((child) => {
if (child.properties) {
// eslint-disable-next-line no-param-reassign
child.properties['da-diff-added'] = '';
}
});
Expand All @@ -212,7 +211,6 @@ const baseNodes = {
contentElement: (dom) => {
[...dom.children].forEach((child) => {
if (child.properties) {
// eslint-disable-next-line no-param-reassign
child.properties['da-diff-added'] = '';
}
});
Expand Down
1 change: 0 additions & 1 deletion blocks/edit/prose/table.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-unresolved
import { Fragment, DOMParser } from 'da-y-wrapper';

function getHeading(schema) {
Expand Down
10 changes: 5 additions & 5 deletions blocks/edit/utils/helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AEM_ORIGIN, DA_ORIGIN } from '../../shared/constants.js';
import { sanitizePathParts } from '../../../../scripts/utils.js';
import { sanitizePathParts } from '../../../scripts/utils.js';
import prose2aem from '../../shared/prose2aem.js';
import { daFetch } from '../../shared/utils.js';

Expand Down Expand Up @@ -138,16 +138,16 @@ export function aem2prose(doc) {
});
}

/* eslint-disable max-len */
/**
* [admin] Unable to preview '.../page.md': source contains large image: error fetching resource at http.../hello: Image 1 exceeds allowed limit of 10.00MB
* [admin] Unable to preview '.../page.md': source contains large image:
* error fetching resource at http.../hello: Image 1 exceeds allowed limit of 10.00MB
* [admin] Unable to preview '.../doc.pdf': PDF is larger than 10MB: 24.0MB
* [admin] Unable to preview '.../video.mp4': MP4 is longer than 2 minutes: 2m 44s
* [admin] Unable to preview '.../video.mp4': MP4 has a higher bitrate than 300 KB/s: 494 kilobytes
* [admin] not authenticated
* [admin] not authorized
*/
/* eslint-enable max-len */

function parseAemError(xError) {
if (xError.includes('PDF')) {
const [seg1, seg2] = xError.split(': ').slice(-2);
Expand Down Expand Up @@ -185,7 +185,7 @@ export async function saveToAem(path, action) {

const url = `${AEM_ORIGIN}/${action}/${owner}/${repo}/main/${aemPath}`;
const resp = await daFetch(url, { method: 'POST' });
// eslint-disable-next-line no-console

if (!resp.ok) {
const { status, headers } = resp;
const authErr = [401, 403].some((s) => s === status);
Expand Down
2 changes: 1 addition & 1 deletion blocks/media/da-media.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LitElement, html } from 'da-lit';
import { getNx } from '../../../scripts/utils.js';
import { getNx } from '../../scripts/utils.js';

// Styles
const { default: getStyle } = await import(`${getNx()}/utils/styles.js`);
Expand Down
2 changes: 1 addition & 1 deletion blocks/media/media.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import getPathDetails from '../shared/pathDetails.js';
import { getNx } from '../../../scripts/utils.js';
import { getNx } from '../../scripts/utils.js';

import '../edit/da-title/da-title.js';
import { daFetch } from '../shared/utils.js';
Expand Down
87 changes: 87 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { fileURLToPath } from 'url';
import { dirname } from 'path';
import { defineConfig, globalIgnores } from 'eslint/config';
import globals from 'globals';
import { recommended, source, test } from '@adobe/eslint-config-helix';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

export default defineConfig([
globalIgnores([
'eslint.config.js',
'**/deps',
'test/e2e/playwright.config.js',
]),
{
languageOptions: {
...recommended.languageOptions,
globals: {
...globals.serviceworker,
...globals.browser,
...globals.mocha,
...globals.es6,
__rootdir: true,
},
},
settings: {
'import/core-modules': [
'@playwright/test',
'da-lit',
'da-y-wrapper',
],
},
rules: {
'class-methods-use-this': 0,

// headers not required to keep file size down
'header/header': 0,

// TODO: Remove this after we fix the import cycle in edit.js and prose/index.js
'import/no-cycle': 'off',

'import/no-unresolved': ['error', {
ignore: ['^https?://']
}],

'import/prefer-default-export': 0,

'indent': ['error', 2, {
ignoredNodes: ['TemplateLiteral *'],
SwitchCase: 1,
}],

'max-statements-per-line': ['error', { max: 2 }],

'no-await-in-loop': 0,

'no-param-reassign': [2, { props: false }],

'no-unused-vars': ['error', {
argsIgnorePattern: '^_$|^e$',
caughtErrorsIgnorePattern: '^_$|^e$',
varsIgnorePattern: '^_$|^e$',
}],

'object-curly-newline': ['error', {
multiline: true,
minProperties: 6,
consistent: true,
}],
},
plugins: {
import: recommended.plugins.import,
},
extends: [recommended],
},
source,
test,
{
// Allow console in test files
files: ['test/**/*.js'],
rules: {
'no-console': 'off',
'no-unused-expressions': 0,
},
}
]);
Loading