Skip to content

Commit 8bfb9ec

Browse files
Merge pull request #67 from simpleanalytics/codex/create-agents.md-file
Run browserstack not every time, and add linting
2 parents d16c953 + 6bb5c0d commit 8bfb9ec

File tree

4 files changed

+52
-13
lines changed

4 files changed

+52
-13
lines changed

.eslintrc.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
commonjs: true,
5+
es6: true,
6+
node: true,
7+
},
8+
extends: "eslint:recommended",
9+
ignorePatterns: ["dist/"],
10+
globals: {
11+
Atomics: "readonly",
12+
SharedArrayBuffer: "readonly",
13+
},
14+
parserOptions: {
15+
ecmaVersion: 2018,
16+
},
17+
rules: {},
18+
};

.github/workflows/testing.yml

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,37 @@ on:
55
types: [opened, synchronize]
66
push:
77
branches:
8-
- master
98
- main
9+
workflow_dispatch:
1010

1111
jobs:
12+
linting:
13+
runs-on: ubuntu-latest
14+
if: github.event_name == 'pull_request'
15+
16+
strategy:
17+
matrix:
18+
node-version: [22.16]
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
28+
- name: Run npm ci
29+
run: npm ci
30+
31+
- name: Run npm prettier
32+
continue-on-error: true
33+
run: |
34+
./node_modules/.bin/prettier --check . || echo "::warning::Prettier found formatting issues. Fix it locally by running './node_modules/.bin/prettier --write .'"
35+
36+
- name: Run ESLint
37+
run: ./node_modules/.bin/eslint --ext .js .
38+
1239
unit-tests:
1340
runs-on: ubuntu-latest
1441

@@ -38,7 +65,8 @@ jobs:
3865

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

4371
strategy:
4472
matrix:
@@ -60,16 +88,6 @@ jobs:
6088

6189
- uses: actions/checkout@v4
6290

63-
- name: Prettier Action on PR
64-
uses: creyD/[email protected]
65-
with:
66-
dry: true
67-
prettier_options: "--write {**/*,*}.{js,hbs,html,json,md,yml,css,scss} !.github/workflows/**/* !dist/**/*"
68-
commit_message: "Run prettier via GitHub Action"
69-
file_pattern: "."
70-
env:
71-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72-
7391
- name: Use Node.js ${{ matrix.node-version }}
7492
uses: actions/setup-node@v4
7593
with:

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"playground": "./playground.sh",
1111
"watch": "node_modules/.bin/nodemon compile.js --ignore dist",
1212
"build": "node compile.js",
13+
"lint": "./node_modules/.bin/eslint --ext .js .",
1314
"pretest": "npm run build -- testing",
1415
"test": "node -r dotenv/config ./test/index.js",
1516
"posttest": "npm run build",

src/auto-events.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
if (typeof optionsLink === "undefined")
7474
log("options object not found, please specify", "warn");
7575

76-
window.saAutomatedLink = function saAutomatedLink(element, type) {
76+
var saAutomatedLink = function saAutomatedLink(element, type) {
7777
try {
7878
if (!element) return log("no element found");
7979
var sent = false;
@@ -146,6 +146,8 @@
146146
}
147147
};
148148

149+
window.saAutomatedLink = saAutomatedLink;
150+
149151
function collectLink(link, onclick) {
150152
var collect = false;
151153

0 commit comments

Comments
 (0)