Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
env: {
browser: true,
commonjs: true,
es6: true,
node: true,
},
extends: "eslint:recommended",
ignorePatterns: ["dist/"],
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly",
},
parserOptions: {
ecmaVersion: 2018,
},
rules: {},
};
42 changes: 30 additions & 12 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,37 @@ on:
types: [opened, synchronize]
push:
branches:
- master
- main
workflow_dispatch:

jobs:
linting:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'

strategy:
matrix:
node-version: [22.16]

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Run npm ci
run: npm ci

- name: Run npm prettier
continue-on-error: true
run: |
./node_modules/.bin/prettier --check . || echo "::warning::Prettier found formatting issues. Fix it locally by running './node_modules/.bin/prettier --write .'"

- name: Run ESLint
run: ./node_modules/.bin/eslint --ext .js .

unit-tests:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -38,7 +65,8 @@ jobs:

browserstack:
runs-on: ubuntu-latest
needs: unit-tests
needs: [unit-tests, linting]
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch'

strategy:
matrix:
Expand All @@ -60,16 +88,6 @@ jobs:

- uses: actions/checkout@v4

- name: Prettier Action on PR
uses: creyD/[email protected]
with:
dry: true
prettier_options: "--write {**/*,*}.{js,hbs,html,json,md,yml,css,scss} !.github/workflows/**/* !dist/**/*"
commit_message: "Run prettier via GitHub Action"
file_pattern: "."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"playground": "./playground.sh",
"watch": "node_modules/.bin/nodemon compile.js --ignore dist",
"build": "node compile.js",
"lint": "./node_modules/.bin/eslint --ext .js .",
"pretest": "npm run build -- testing",
"test": "node -r dotenv/config ./test/index.js",
"posttest": "npm run build",
Expand Down
4 changes: 3 additions & 1 deletion src/auto-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
if (typeof optionsLink === "undefined")
log("options object not found, please specify", "warn");

window.saAutomatedLink = function saAutomatedLink(element, type) {
var saAutomatedLink = function saAutomatedLink(element, type) {
try {
if (!element) return log("no element found");
var sent = false;
Expand Down Expand Up @@ -146,6 +146,8 @@
}
};

window.saAutomatedLink = saAutomatedLink;

function collectLink(link, onclick) {
var collect = false;

Expand Down
Loading