Merge pull request #47 from strukturag/lint-async-await

Run linters through npm
This commit is contained in:
Joachim Bauch 2021-11-11 14:15:12 +01:00 committed by GitHub
commit 8025dcc92d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 3451 additions and 52 deletions

View file

@ -27,6 +27,7 @@ rules:
no-fallthrough: error
no-mixed-spaces-and-tabs: error
no-multiple-empty-lines: ["error", {"max": 1, "maxEOF": 1}]
no-prototype-builtins: off
no-unused-vars: off
no-use-before-define: error
padded-blocks: ["error", "never"]

View file

@ -9,22 +9,42 @@ on:
jobs:
eslint:
runs-on: ubuntu-latest
container: nextcloudci/eslint:eslint-1
name: eslint
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Lint
run: ./run-eslint.sh
run: npm run lint
stylelint:
runs-on: ubuntu-latest
container: nextcloudci/stylelint:stylelint-1
name: stylelint
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Lint
run: ./run-stylelint.sh
run: npm run stylelint

View file

@ -1,7 +1,16 @@
{
"extends": ["stylelint-config-standard-scss"],
"rules": {
"alpha-value-notation": null,
"color-function-notation": null,
"hue-degree-notation": null,
"indentation": null,
"media-feature-name-no-unknown": true,
"media-feature-name-no-vendor-prefix": null,
"property-no-unknown": true,
"property-no-vendor-prefix": null,
"selector-class-pattern": null,
"selector-id-pattern": null,
"selector-pseudo-class-no-unknown": true,
"selector-pseudo-element-no-unknown": true,
"selector-type-no-unknown": true,

View file

@ -27,58 +27,71 @@
user-select: none; /* Non-prefixed version, currently
supported by Chrome and Opera */
}
.cursor {
border: 1px solid #ccc;
padding: 4px;
background-color: white;
z-index: 100;
}
#presentationMode, #openFile, #print, #download, #viewBookmark, #secondaryToolbarToggle, .verticalToolbarSeparator {
#presentationMode,
#openFile,
#print,
#download,
#viewBookmark,
#secondaryToolbarToggle,
.verticalToolbarSeparator {
display: none !important;
}
.noneMode::before {
content: "";
display: block;
width: 16px;
height: 16px;
background-size: 16px 16px;
background-image: url(../img/icon-notool.svg);
background-image: url("../img/icon-notool.svg");
background-repeat: no-repeat;
}
.selectMode::before {
content: "";
display: block;
width: 16px;
height: 16px;
background-size: 16px 16px;
background-image: url(../img/icon-select.svg);
background-image: url("../img/icon-select.svg");
background-repeat: no-repeat;
}
.pointerMode::before {
content: "";
display: block;
width: 16px;
height: 16px;
background-size: 16px 16px;
background-image: url(../img/icon-pointer.svg);
background-image: url("../img/icon-pointer.svg");
background-repeat: no-repeat;
}
.freehandMode::before {
content: "";
display: block;
width: 16px;
height: 16px;
background-size: 16px 16px;
background-image: url(../img/icon-freehand.svg);
background-image: url("../img/icon-freehand.svg");
background-repeat: no-repeat;
}
.rectangleMode::before {
content: "";
display: block;
width: 16px;
height: 16px;
background-size: 16px 16px;
background-image: url(../img/icon-rectangle.svg);
background-image: url("../img/icon-rectangle.svg");
background-repeat: no-repeat;
}
@ -88,40 +101,41 @@
width: 16px;
height: 16px;
background-size: 16px 16px;
background-image: url(../img/icon-ellipse.svg);
background-image: url("../img/icon-ellipse.svg");
background-repeat: no-repeat;
}
.lineMode::before {
content: "";
display: block;
width: 16px;
height: 16px;
background-size: 16px 16px;
background-image: url(../img/icon-line.svg);
background-image: url("../img/icon-line.svg");
background-repeat: no-repeat;
}
.toolbarButton.download::before {
content: "";
display: block;
width: 16px;
height: 16px;
background-size: 16px 16px;
background-image: url(../img/icon-download.svg);
background-image: url("../img/icon-download.svg");
background-repeat: no-repeat;
}
.secondaryToolbar.drawMenuToolbar {
right: 105px !important;
}
.secondaryToolbar.drawMenuToolbar {
line-height: 0 !important;
}
.secondaryToolbar.drawMenuToolbar .toolbarButton::before {
position: relative !important;
top: 1px !important;
left: 1px !important;
}
.secondaryToolbar.drawMenuToolbar .toolbarButton {
margin: 0 !important;
}
@ -141,15 +155,15 @@
.toolbarButton.close::before {
display: block;
content: ' ';
background-image: url(../img/toolbarButton-secondaryToolbarClose.svg);
content: " ";
background-image: url("../img/toolbarButton-secondaryToolbarClose.svg");
background-size: 16px 16px;
height: 16px;
width: 16px;
}
#drawModeToolbar .dropdown {
background: url(../img/icon-dropdown.svg);
background: url("../img/icon-dropdown.svg");
width: 16px;
height: 16px;
background-size: 16px 16px;
@ -293,10 +307,11 @@
}
.toolbarButton.selected {
background-color: hsla(0,0%,0%,.12);
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
background-color: hsla(0, 0%, 0%, 0.12);
background-image: linear-gradient(hsla(0, 0%, 100%, 0.05), hsla(0, 0%, 100%, 0));
background-clip: padding-box;
border: 1px solid hsla(0,0%,0%,.35);
border-color: hsla(0,0%,0%,.32) hsla(0,0%,0%,.38) hsla(0,0%,0%,.42);
box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset, 0 0 1px hsla(0,0%,100%,.15) inset, 0 1px 0 hsla(0,0%,100%,.05);
border: 1px solid hsla(0, 0%, 0%, 0.35);
border-color: hsla(0, 0%, 0%, 0.32) hsla(0, 0%, 0%, 0.38) hsla(0, 0%, 0%, 0.42);
/* stylelint-disable-next-line max-line-length */
box-shadow: 0 1px 0 hsla(0, 0%, 100%, 0.05) inset, 0 0 1px hsla(0, 0%, 100%, 0.15) inset, 0 1px 0 hsla(0, 0%, 100%, 0.05);
}

3371
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,9 @@
"author": "struktur AG <opensource@struktur.de>",
"scripts": {
"build": "NODE_ENV=production webpack --progress --config webpack.js",
"dev": "NODE_ENV=development webpack --config webpack.js"
"dev": "NODE_ENV=development webpack --config webpack.js",
"lint": "eslint src",
"stylelint": "stylelint css/*.css css/*.scss"
},
"dependencies": {
"@jaames/iro": "5.5.2",
@ -18,6 +20,9 @@
},
"devDependencies": {
"copy-webpack-plugin": "6.4.1",
"eslint": "8.2.0",
"stylelint": "14.0.1",
"stylelint-config-standard-scss": "^2.0.1",
"webpack": "4.46.0",
"webpack-cli": "4.9.1"
}

View file

@ -1,11 +0,0 @@
#!/bin/sh
set -e
ESLINT=$(which eslint || true)
if [ -z "$ESLINT" ]; then
echo "Can't find command \"eslint\" in $PATH"
exit 1
fi
echo Checking scripts with $ESLINT ...
find . -type d -name node_modules -prune -o -name "*.js" -print0 | xargs -0 $ESLINT

View file

@ -1,11 +0,0 @@
#!/bin/sh
set -e
STYLELINT=$(which stylelint || true)
if [ -z "$STYLELINT" ]; then
echo "Can't find command \"stylelint\" in $PATH"
exit 1
fi
echo Checking stylesheets with $STYLELINT ...
find . -name "*.*css" -print0 | xargs -0 $STYLELINT

View file

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* global OC, OCP, OCA, $, _, Handlebars */
/* global OCP, $, Handlebars */
(function(OC, OCP, OCA, $, _, Handlebars) {
'use strict';

View file

@ -1271,8 +1271,8 @@ Annotator.prototype.downloadPdf = function() {
var type = xhr.getResponseHeader('Content-Type');
var blob = typeof File === 'function'
? new File([this.response], filename, { type: type })
: new Blob([this.response], { type: type });
? new File([this.response], filename, { type: type })
: new Blob([this.response], { type: type });
if (typeof window.navigator.msSaveBlob !== 'undefined') {
// IE workaround for "HTML7007: One or more blob URLs were revoked by
// closing the blob for which they were created. These URLs will no