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-fallthrough: error
no-mixed-spaces-and-tabs: error no-mixed-spaces-and-tabs: error
no-multiple-empty-lines: ["error", {"max": 1, "maxEOF": 1}] no-multiple-empty-lines: ["error", {"max": 1, "maxEOF": 1}]
no-prototype-builtins: off
no-unused-vars: off no-unused-vars: off
no-use-before-define: error no-use-before-define: error
padded-blocks: ["error", "never"] padded-blocks: ["error", "never"]

View file

@ -9,22 +9,42 @@ on:
jobs: jobs:
eslint: eslint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: nextcloudci/eslint:eslint-1
name: eslint strategy:
matrix:
node-version: [16.x]
steps: steps:
- uses: actions/checkout@v2 - 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 - name: Lint
run: ./run-eslint.sh run: npm run lint
stylelint: stylelint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: nextcloudci/stylelint:stylelint-1
name: stylelint strategy:
matrix:
node-version: [16.x]
steps: steps:
- uses: actions/checkout@v2 - 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 - name: Lint
run: ./run-stylelint.sh run: npm run stylelint

View file

@ -1,7 +1,16 @@
{ {
"extends": ["stylelint-config-standard-scss"],
"rules": { "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-unknown": true,
"media-feature-name-no-vendor-prefix": null,
"property-no-unknown": true, "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-class-no-unknown": true,
"selector-pseudo-element-no-unknown": true, "selector-pseudo-element-no-unknown": true,
"selector-type-no-unknown": true, "selector-type-no-unknown": true,

View file

@ -27,58 +27,71 @@
user-select: none; /* Non-prefixed version, currently user-select: none; /* Non-prefixed version, currently
supported by Chrome and Opera */ supported by Chrome and Opera */
} }
.cursor { .cursor {
border: 1px solid #ccc; border: 1px solid #ccc;
padding: 4px; padding: 4px;
background-color: white; background-color: white;
z-index: 100; z-index: 100;
} }
#presentationMode, #openFile, #print, #download, #viewBookmark, #secondaryToolbarToggle, .verticalToolbarSeparator {
#presentationMode,
#openFile,
#print,
#download,
#viewBookmark,
#secondaryToolbarToggle,
.verticalToolbarSeparator {
display: none !important; display: none !important;
} }
.noneMode::before { .noneMode::before {
content: ""; content: "";
display: block; display: block;
width: 16px; width: 16px;
height: 16px; height: 16px;
background-size: 16px 16px; background-size: 16px 16px;
background-image: url(../img/icon-notool.svg); background-image: url("../img/icon-notool.svg");
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.selectMode::before { .selectMode::before {
content: ""; content: "";
display: block; display: block;
width: 16px; width: 16px;
height: 16px; height: 16px;
background-size: 16px 16px; background-size: 16px 16px;
background-image: url(../img/icon-select.svg); background-image: url("../img/icon-select.svg");
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.pointerMode::before { .pointerMode::before {
content: ""; content: "";
display: block; display: block;
width: 16px; width: 16px;
height: 16px; height: 16px;
background-size: 16px 16px; background-size: 16px 16px;
background-image: url(../img/icon-pointer.svg); background-image: url("../img/icon-pointer.svg");
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.freehandMode::before { .freehandMode::before {
content: ""; content: "";
display: block; display: block;
width: 16px; width: 16px;
height: 16px; height: 16px;
background-size: 16px 16px; background-size: 16px 16px;
background-image: url(../img/icon-freehand.svg); background-image: url("../img/icon-freehand.svg");
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.rectangleMode::before { .rectangleMode::before {
content: ""; content: "";
display: block; display: block;
width: 16px; width: 16px;
height: 16px; height: 16px;
background-size: 16px 16px; background-size: 16px 16px;
background-image: url(../img/icon-rectangle.svg); background-image: url("../img/icon-rectangle.svg");
background-repeat: no-repeat; background-repeat: no-repeat;
} }
@ -88,40 +101,41 @@
width: 16px; width: 16px;
height: 16px; height: 16px;
background-size: 16px 16px; background-size: 16px 16px;
background-image: url(../img/icon-ellipse.svg); background-image: url("../img/icon-ellipse.svg");
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.lineMode::before { .lineMode::before {
content: ""; content: "";
display: block; display: block;
width: 16px; width: 16px;
height: 16px; height: 16px;
background-size: 16px 16px; background-size: 16px 16px;
background-image: url(../img/icon-line.svg); background-image: url("../img/icon-line.svg");
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.toolbarButton.download::before { .toolbarButton.download::before {
content: ""; content: "";
display: block; display: block;
width: 16px; width: 16px;
height: 16px; height: 16px;
background-size: 16px 16px; background-size: 16px 16px;
background-image: url(../img/icon-download.svg); background-image: url("../img/icon-download.svg");
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.secondaryToolbar.drawMenuToolbar { .secondaryToolbar.drawMenuToolbar {
right: 105px !important; right: 105px !important;
}
.secondaryToolbar.drawMenuToolbar {
line-height: 0 !important; line-height: 0 !important;
} }
.secondaryToolbar.drawMenuToolbar .toolbarButton::before { .secondaryToolbar.drawMenuToolbar .toolbarButton::before {
position: relative !important; position: relative !important;
top: 1px !important; top: 1px !important;
left: 1px !important; left: 1px !important;
} }
.secondaryToolbar.drawMenuToolbar .toolbarButton { .secondaryToolbar.drawMenuToolbar .toolbarButton {
margin: 0 !important; margin: 0 !important;
} }
@ -141,15 +155,15 @@
.toolbarButton.close::before { .toolbarButton.close::before {
display: block; display: block;
content: ' '; content: " ";
background-image: url(../img/toolbarButton-secondaryToolbarClose.svg); background-image: url("../img/toolbarButton-secondaryToolbarClose.svg");
background-size: 16px 16px; background-size: 16px 16px;
height: 16px; height: 16px;
width: 16px; width: 16px;
} }
#drawModeToolbar .dropdown { #drawModeToolbar .dropdown {
background: url(../img/icon-dropdown.svg); background: url("../img/icon-dropdown.svg");
width: 16px; width: 16px;
height: 16px; height: 16px;
background-size: 16px 16px; background-size: 16px 16px;
@ -293,10 +307,11 @@
} }
.toolbarButton.selected { .toolbarButton.selected {
background-color: hsla(0,0%,0%,.12); background-color: hsla(0, 0%, 0%, 0.12);
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); background-image: linear-gradient(hsla(0, 0%, 100%, 0.05), hsla(0, 0%, 100%, 0));
background-clip: padding-box; background-clip: padding-box;
border: 1px solid hsla(0,0%,0%,.35); border: 1px solid hsla(0, 0%, 0%, 0.35);
border-color: hsla(0,0%,0%,.32) hsla(0,0%,0%,.38) hsla(0,0%,0%,.42); border-color: hsla(0, 0%, 0%, 0.32) hsla(0, 0%, 0%, 0.38) hsla(0, 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); /* 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>", "author": "struktur AG <opensource@struktur.de>",
"scripts": { "scripts": {
"build": "NODE_ENV=production webpack --progress --config webpack.js", "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": { "dependencies": {
"@jaames/iro": "5.5.2", "@jaames/iro": "5.5.2",
@ -18,6 +20,9 @@
}, },
"devDependencies": { "devDependencies": {
"copy-webpack-plugin": "6.4.1", "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": "4.46.0",
"webpack-cli": "4.9.1" "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/>. * 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) { (function(OC, OCP, OCA, $, _, Handlebars) {
'use strict'; 'use strict';

View file

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