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

Add a global eslint command and run in CI

parent 5bc3110b
No related branches found
No related tags found
No related merge requests found
Showing
with 134 additions and 25 deletions
......@@ -16,6 +16,14 @@ test:
- yarn install
- yarn run test
linting:
stage: test
allow_failure: true
script:
- yarn config set cache-folder "$CI_PROJECT_DIR/_yarn_cache"
- yarn install
- yarn run lint
publish:
stage: deploy
only:
......
......@@ -10,6 +10,7 @@
"scripts": {
"test": "lerna run test",
"build": "lerna run build",
"lint": "lerna run lint",
"publish": "lerna publish from-package --yes"
},
"author": "",
......
/vendor/**
/dist/**
/*.js
\ No newline at end of file
{
"env": {
"browser": true,
"es6": true,
"mocha": true
},
"extends": ["eslint:recommended", "plugin:jsdoc/recommended"],
"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-param-type": 0
}
}
\ No newline at end of file
......@@ -31,7 +31,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/auth": "^0.1.0",
......@@ -53,6 +55,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 ."
}
}
import {findObjectInApiResults} from './utils.js';
import select2LangDe from './i18n/de/select2'
import select2LangEn from './i18n/en/select2'
import select2LangDe from './i18n/de/select2';
import select2LangEn from './i18n/en/select2';
import JSONLD from '@dbp-toolkit/common/jsonld';
import {css, html, LitElement} from 'lit-element';
import {ScopedElementsMixin} from '@open-wc/scoped-elements';
......@@ -124,6 +124,8 @@ export class CheckInPlaceSelect extends ScopedElementsMixin(LitElement) {
/**
* Initializes the Select2 selector
*
* @param ignorePreset
*/
initSelect2(ignorePreset = false) {
const that = this;
......
......@@ -17,6 +17,7 @@ export class CheckInPlaceSelectDemo extends ScopedElementsMixin(LitElement) {
return {
'dbp-login-button': LoginButton,
'dbp-check-in-place-select': CheckInPlaceSelect,
'dbp-auth-keycloak': AuthKeycloak,
};
}
......
......@@ -43,4 +43,4 @@ export default function () {
return 'Entferne alle Gegenstände';
}
};
};
}
......@@ -47,4 +47,4 @@ export default function () {
return 'Remove all items';
}
};
};
}
import {css, unsafeCSS, CSSResult} from 'lit-element';
import {css, unsafeCSS} from 'lit-element';
import {getIconSVGURL} from './src/icon.js';
/**
......
......@@ -212,7 +212,7 @@ export const getAssetURL = (pkg, path) => {
// assume it is a full path
fullPath = pkg;
} else {
fullPath = 'local/' + pkg + '/' + path
fullPath = 'local/' + pkg + '/' + path;
}
return new URL(fullPath, new URL('..', import.meta.url).href).href;
};
......@@ -298,21 +298,21 @@ export async function getMimeTypeOfFile(file) {
const getMimeType = (signature) => {
switch (signature) {
case '89504E47':
return 'image/png'
return 'image/png';
case '47494638':
return 'image/gif'
return 'image/gif';
case '25504446':
return 'application/pdf'
return 'application/pdf';
case 'FFD8FFDB':
case 'FFD8FFE0':
case 'FFD8FFE1':
return 'image/jpeg'
return 'image/jpeg';
case '504B0304':
return 'application/zip'
return 'application/zip';
default:
return 'Unknown filetype'
}
return 'Unknown filetype';
}
};
return await new Promise((resolve) => {
let fileReader = new FileReader();
......@@ -323,15 +323,15 @@ export async function getMimeTypeOfFile(file) {
let bytes = [];
uint.forEach((byte) => {
bytes.push(byte.toString(16))
})
bytes.push(byte.toString(16));
});
const hex = bytes.join('').toUpperCase();
const mimeType = getMimeType(hex);
resolve(mimeType);
}
}
};
fileReader.readAsArrayBuffer(file.slice(0, 4));
});
......
/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
......@@ -30,7 +30,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/auth": "^0.1.0",
......@@ -59,6 +61,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 ."
}
}
......@@ -227,12 +227,12 @@ export class DataTableView extends LitElement {
changedProperties.forEach((oldValue, propName) => {
if (propName === "lang") {
i18n.changeLanguage(this.lang).catch(e => { console.log(e)});
i18n.changeLanguage(this.lang).catch(e => { console.log(e);});
languageChange = true;
}
});
this.updateComplete.then(this.set_datatable(this.data, languageChange)).catch(e => { console.log(e)});
this.updateComplete.then(this.set_datatable(this.data, languageChange)).catch(e => { console.log(e);});
super.update(changedProperties);
}
......
/vendor/**
/dist/**
/*.js
\ No newline at end of file
{
"env": {
"browser": true,
"es6": true,
"mocha": true
},
"extends": ["eslint:recommended", "plugin:jsdoc/recommended"],
"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-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",
......@@ -48,6 +50,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 ."
}
}
......@@ -106,7 +106,7 @@ export class LanguageSelect extends LitElement {
}
onExternalChange(e) {
this.lang = e.detail.lang
this.lang = e.detail.lang;
}
connectedCallback() {
......
/vendor/**
/dist/**
/*.js
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment