From ec5295bfe6035acbadda3e0454db78f1c4fa6941 Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Thu, 13 Jun 2024 17:47:23 -0400 Subject: [PATCH] Add lint support. --- .eslintrc.cjs | 12 ++++++++++++ .github/workflows/main.yaml | 20 ++++++++++++++++++++ index.js | 2 +- package.json | 6 +++++- 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 .eslintrc.cjs create mode 100644 .github/workflows/main.yaml diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..b5358f0 --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,12 @@ +module.exports = { + root: true, + env: { + browser: true, + node: true + }, + extends: [ + 'digitalbazaar', + 'digitalbazaar/jsdoc' + ], + ignorePatterns: ['dist/'] +}; diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..3cc6e45 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,20 @@ +name: Main CI + +on: [push] + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20.x] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - name: Install + run: npm install + - name: Run eslint + run: npm run lint diff --git a/index.js b/index.js index d942926..9d15cd0 100644 --- a/index.js +++ b/index.js @@ -117,6 +117,6 @@ export async function load(options = { function _assertSecureContext() { if(!window.isSecureContext) { - throw new DOMException('SecurityError', 'The operation is insecure.') + throw new DOMException('SecurityError', 'The operation is insecure.'); } } diff --git a/package.json b/package.json index 0e77377..e897e8b 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,9 @@ ] }, "devDependencies": { + "eslint": "^8.57.0", + "eslint-config-digitalbazaar": "^5.2.0", + "eslint-plugin-jsdoc": "^48.2.11", "webpack": "^4.10.2", "webpack-cli": "^3.3.9" }, @@ -39,6 +42,7 @@ ], "scripts": { "prepublish": "npm run build", - "build": "webpack --mode development" + "build": "webpack --mode development", + "lint": "eslint --ext .cjs,.js ." } }