Skip to content
Snippets Groups Projects
Commit fe67c4b1 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

file-handling: add eslint support

parent 418cec5e
No related branches found
No related tags found
No related merge requests found
/vendor/**
/dist/**
*.conf.js
*.config.js
\ No newline at end of file
{
"env": {
"browser": true,
"es6": true,
"mocha": true
},
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"no-unused-vars": ["error", { "args": "none" }],
"semi": [2, "always"],
"jsdoc/require-jsdoc": 0,
"jsdoc/require-param-description": 0,
"jsdoc/require-returns": 0,
"jsdoc/require-returns-description": 0,
"jsdoc/require-param-type": 0
}
}
\ No newline at end of file
......@@ -29,7 +29,9 @@
"rollup-plugin-copy": "^3.1.0",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-serve": "^1.0.1",
"rollup-plugin-terser": "^7.0.2"
"rollup-plugin-terser": "^7.0.2",
"eslint": "^7.3.1",
"eslint-plugin-jsdoc": "^30.6.4"
},
"dependencies": {
"@dbp-toolkit/common": "^0.1.0",
......@@ -55,6 +57,7 @@
"watch": "npm run watch-local",
"watch-local": "rollup -c --watch",
"watch-dev": "rollup -c --watch --environment BUILD:development",
"test": "npm run build-test && karma start --singleRun"
"test": "npm run build-test && karma start --singleRun",
"lint": "eslint ."
}
}
......@@ -140,7 +140,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
if (typeof cell.getValue() === 'undefined') {
return "";
}
const [fileMainType, fileSubType] = cell.getValue().split('/');
const [, fileSubType] = cell.getValue().split('/');
return fileSubType;
}},
{title: i18n.t('nextcloud-file-picker.last-modified'), responsive: 3, widthGrow:1, minWidth: 100, field: "lastmod",sorter: (a, b, aRow, bRow, column, dir, sorterParams) => {
......@@ -404,7 +404,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
this.activeDirectoryACL = '';
}
} else {
this.activeDirectoryRights = 'SGDNVCK'
this.activeDirectoryRights = 'SGDNVCK';
}
this.loadDirectory(file.filename);
event.preventDefault();
......@@ -483,7 +483,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
this.statusText = i18n.t('nextcloud-file-picker.upload-to', {path: directory});
this.fileList = files;
this.forAll = false;
this.setRepeatForAllConflicts()
this.setRepeatForAllConflicts();
this.uploadFile(directory);
}
......@@ -510,7 +510,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
let that = this;
this.loading = true;
this.statusText = i18n.t('nextcloud-file-picker.upload-to', {path: path});
let contents = await this.webDavClient
await this.webDavClient
.putFileContents(path, file, { overwrite: false, onUploadProgress: progress => {
/* console.log(`Uploaded ${progress.loaded} bytes of ${progress.total}`);*/
}}).then(function() {
......@@ -591,7 +591,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
let that = this;
// https://github.com/perry-mitchell/webdav-client#putfilecontents
let contents = await this.webDavClient
await this.webDavClient
.putFileContents(path, file, {
overwrite: overwrite, onUploadProgress: progress => {
/*console.log(`Uploaded ${progress.loaded} bytes of ${progress.total}`);*/
......@@ -845,8 +845,6 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
this._('#add-folder-button').setAttribute("title", i18n.t('nextcloud-file-picker.add-folder-close'));
this._('#new-folder').focus();
}
let that = this;
}
/**
......@@ -1515,7 +1513,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
<span style="word-break: break-all;">${this.replaceFilename}</span>
${i18n.t('nextcloud-file-picker.replace-title-2')}.
</h2>
<button title="${i18n.t('file-sink.modal-close')}" class="modal-close" aria-label="Close modal" @click="${() => {this.closeDialog()}}">
<button title="${i18n.t('file-sink.modal-close')}" class="modal-close" aria-label="Close modal" @click="${() => {this.closeDialog();}}">
<dbp-icon title="${i18n.t('file-sink.modal-close')}" name="close" class="close-icon"></dbp-icon>
</button>
</header>
......
......@@ -208,7 +208,7 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) {
</div>
</nav>
<div class="modal-header">
<button title="${i18n.t('file-sink.modal-close')}" class="modal-close" aria-label="Close modal" @click="${() => { this.closeDialog()}}">
<button title="${i18n.t('file-sink.modal-close')}" class="modal-close" aria-label="Close modal" @click="${() => { this.closeDialog();}}">
<dbp-icon title="${i18n.t('file-sink.modal-close')}" name="close" class="close-icon"></dbp-icon>
</button>
<p class="modal-context"> ${this.context}</p>
......
......@@ -7,7 +7,7 @@ import {Icon, MiniSpinner} from '@dbp-toolkit/common';
import * as commonStyles from '@dbp-toolkit/common/styles';
import {NextcloudFilePicker} from "./dbp-nextcloud-file-picker";
import {classMap} from 'lit-html/directives/class-map.js';
import MicroModal from './micromodal.es'
import MicroModal from './micromodal.es';
import * as fileHandlingStyles from './styles';
function mimeTypesToAccept(mimeTypes) {
......@@ -113,13 +113,13 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
this.updateComplete.then(() => {
this.dropArea = this._('#dropArea');
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
this.dropArea.addEventListener(eventName, this.preventDefaults, false)
this.dropArea.addEventListener(eventName, this.preventDefaults, false);
});
['dragenter', 'dragover'].forEach(eventName => {
this.dropArea.addEventListener(eventName, this.highlight.bind(this), false)
this.dropArea.addEventListener(eventName, this.highlight.bind(this), false);
});
['dragleave', 'drop'].forEach(eventName => {
this.dropArea.addEventListener(eventName, this.unhighlight.bind(this), false)
this.dropArea.addEventListener(eventName, this.unhighlight.bind(this), false);
});
this.dropArea.addEventListener('drop', this.handleDrop.bind(this), false);
this._('#fileElem').addEventListener('change', this.handleChange.bind(this));
......@@ -132,11 +132,11 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
}
highlight(e) {
this.dropArea.classList.add('highlight')
this.dropArea.classList.add('highlight');
}
unhighlight(e) {
this.dropArea.classList.remove('highlight')
this.dropArea.classList.remove('highlight');
}
handleDrop(e) {
......@@ -177,7 +177,7 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
await commonUtils.asyncArrayForEach(files, async (file) => {
if (file.size === 0) {
console.log('file \'' + file.name + '\' has size=0 and is denied!')
console.log('file \'' + file.name + '\' has size=0 and is denied!');
return;
}
......@@ -422,7 +422,7 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
</nav>
<div class="modal-header">
<button title="${i18n.t('file-source.modal-close')}" class="modal-close" aria-label="Close modal" @click="${() => {this.closeDialog()}}">
<button title="${i18n.t('file-source.modal-close')}" class="modal-close" aria-label="Close modal" @click="${() => {this.closeDialog();}}">
<dbp-icon name="close" class="close-icon"></dbp-icon>
</button>
......
import {css, unsafeCSS, CSSResult} from 'lit-element';
import {css} from 'lit-element';
export function getFileHandlingCss() {
// language=css
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment