Add eslint

This commit is contained in:
Jake Howard 2022-08-03 20:55:09 +01:00
parent 512f9cd3b9
commit eae2953b89
Signed by: jake
GPG Key ID: 57AFB45680EDD477
7 changed files with 1972 additions and 5 deletions

1
.eslintignore Symbolic link
View File

@ -0,0 +1 @@
./.gitignore

12
.eslintrc Normal file
View File

@ -0,0 +1,12 @@
{
"extends": [
"eslint:recommended"
],
"parserOptions": {
"ecmaVersion": 6
},
"env": {
"browser": true,
"node": true
}
}

View File

@ -113,7 +113,7 @@ djhtml:
script: script:
- git ls-files '*.html' | xargs djhtml --check --tabwidth 2 - git ls-files '*.html' | xargs djhtml --check --tabwidth 2
prettier: npm_lint:
<<: *node_test_template <<: *node_test_template
script: script:
- npm run lint - npm run lint

1949
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,12 +9,17 @@
"build:css": "sass --style=compressed --load-path=$PWD/node_modules static/src/scss:static/build/css", "build:css": "sass --style=compressed --load-path=$PWD/node_modules static/src/scss:static/build/css",
"build:contrib": "./scripts/copy-npm-contrib.sh", "build:contrib": "./scripts/copy-npm-contrib.sh",
"build": "npm-run-all build:*", "build": "npm-run-all build:*",
"lint": "prettier --check static/src", "lint:eslint": "eslint --ext js --report-unused-disable-directives .",
"format": "prettier --write static/src" "lint:prettier": "prettier --check static/src",
"lint": "npm-run-all lint:*",
"format:prettier": "prettier --write static/src",
"format:eslint": "npm run lint:eslint -- --fix",
"format": "npm-run-all format:*"
}, },
"author": "Jake Howard", "author": "Jake Howard",
"devDependencies": { "devDependencies": {
"esbuild": "^0.14.43", "esbuild": "^0.14.43",
"eslint": "^8.21.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"prettier": "2.6.2", "prettier": "2.6.2",
"sass": "^1.52.3" "sass": "^1.52.3"

View File

@ -71,7 +71,7 @@ window.addEventListener("DOMContentLoaded", () => {
let scrollTarget = null; let scrollTarget = null;
try { try {
scrollTarget = document.getElementById(window.location.hash.slice(1)); scrollTarget = document.getElementById(window.location.hash.slice(1));
} catch { } catch (e) {
// Probably an invalid selector - just ignore it // Probably an invalid selector - just ignore it
} }

View File

@ -1,4 +1,4 @@
import * as DarkReader from "darkreader"; const DarkReader = require("darkreader");
const DARK_READER_OPTIONS = {}; const DARK_READER_OPTIONS = {};