Skip to content

Commit

Permalink
eslint & esm only update
Browse files Browse the repository at this point in the history
  • Loading branch information
arietrouw committed Aug 14, 2024
1 parent 8deed89 commit 5fef82d
Show file tree
Hide file tree
Showing 14 changed files with 3,111 additions and 6,244 deletions.
56 changes: 0 additions & 56 deletions .eslintrc.cjs

This file was deleted.

894 changes: 0 additions & 894 deletions .yarn/releases/yarn-4.3.1.cjs

This file was deleted.

925 changes: 925 additions & 0 deletions .yarn/releases/yarn-4.4.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-outdated.cjs
spec: "https://mskelton.dev/yarn-outdated/v3"

yarnPath: .yarn/releases/yarn-4.3.1.cjs
yarnPath: .yarn/releases/yarn-4.4.0.cjs
43 changes: 43 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// eslint.config.mjs

import { config as xylabsConfig, rulesConfig, importConfig } from '@xylabs/eslint-config-flat'

export default [
{
ignores: ['.yarn/**', 'jest.config.cjs', '**/dist/**', 'dist', 'build/**', 'node_modules/**'],
},
...xylabsConfig,
{
rules: {
'no-restricted-imports': [
'warn',
{
paths: [
...rulesConfig.rules['no-restricted-imports'][1].paths,
'@types/node',
'@xyo-network/archivist',
'@xyo-network/bridge',
'@xyo-network/core',
'@xyo-network/diviner',
'@xyo-network/module',
'@xyo-network/modules',
'@xyo-network/node',
'@xyo-network/sdk',
'@xyo-network/plugins',
'@xyo-network/protocol',
'@xyo-network/sentinel',
'@xyo-network/witness',
'@xyo-network/core-payload-plugins',
],
},
],
},
},
{
...importConfig,
rules: {
...importConfig.rules,
'import-x/no-cycle': ['warn', { maxDepth: 5 }]
}
}
]
71 changes: 24 additions & 47 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,74 +9,51 @@
"url": "https://github.com/xylabs/sdk-pixel-js/issues"
},
"dependencies": {
"@xylabs/assert": "^3.5.9",
"@xylabs/lodash": "^3.5.9",
"@xylabs/assert": "^4.0.1",
"async-mutex": "^0.5.0",
"axios": "^1.7.4",
"bowser": "^2.11.0",
"fast-deep-equal": "^3.1.3",
"js-cookie": "^3.0.5",
"lodash-es": "^4.17.21",
"md5": "^2.3.0"
},
"peerDependencies": {
"axios": "^1.2"
"spark-md5": "^3.0.2"
},
"description": "Event Client for xylabs ESB",
"devDependencies": {
"@types/jest": "^29.5.12",
"@types/js-cookie": "^3.0.6",
"@types/jsdom": "^21.1.7",
"@types/lodash-es": "^4.17.12",
"@types/md5": "^2.3.5",
"@types/node": "^20.14.10",
"@types/node": "^22.3.0",
"@types/randombytes": "^2.0.3",
"@xylabs/eslint-config": "^3.11.12",
"@xylabs/ts-scripts-yarn3": "^3.11.12",
"@xylabs/tsconfig-dom": "^3.11.12",
"@xylabs/tsconfig-dom-jest": "^3.11.12",
"@xylabs/tsconfig-jest": "^3.11.12",
"axios": "^1.7.2",
"eslint": "^9.6.0",
"@types/spark-md5": "^3.0.4",
"@xylabs/eslint-config-flat": "^4.0.0-rc.15",
"@xylabs/ts-scripts-yarn3": "^4.0.0-rc.15",
"@xylabs/tsconfig-dom": "^4.0.0-rc.15",
"@xylabs/tsconfig-dom-jest": "^4.0.0-rc.15",
"@xylabs/tsconfig-jest": "^4.0.0-rc.15",
"axios": "^1.7.4",
"dotenv": "^16.4.5",
"eslint": "^9.9.0",
"eslint-import-resolver-typescript": "^3.6.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jsdom": "^24.1.0",
"jsdom": "^24.1.1",
"npm-package-json-lint": "^8.0.0",
"reflect-metadata": "^0.2.2",
"ts-jest": "^29.2.2",
"ts-jest": "^29.2.4",
"ts-node": "^10.9.2",
"typescript": "^5.5.3"
},
"resolutions": {
"eslint": "^8"
"typescript": "^5.5.4",
"vitest": "^2.0.5"
},
"types": "dist/browser/index.d.ts",
"exports": {
".": {
"node": {
"import": {
"types": "./dist/node/index.d.mts",
"default": "./dist/node/index.js"
},
"require": {
"types": "./dist/node/index.d.cts",
"default": "./dist/node/index.cjs"
}
},
"browser": {
"import": {
"types": "./dist/browser/index.d.mts",
"default": "./dist/browser/index.js"
},
"require": {
"types": "./dist/browser/index.d.cts",
"default": "./dist/browser/index.cjs"
}
},
"default": "./dist/browser/index.js"
"types": "./dist/browser/index.d.ts",
"default": "./dist/browser/index.mjs"
},
"./package.json": "./package.json"
},
"main": "dist/browser/index.cjs",
"module": "dist/browser/index.js",
"module": "dist/browser/index.mjs",
"homepage": "https://xylabs.com",
"license": "LGPL-3.0-or-later",
"name": "@xylabs/pixel",
Expand All @@ -89,6 +66,6 @@
},
"sideEffects": false,
"version": "1.7.0",
"packageManager": "yarn@4.3.1",
"packageManager": "yarn@4.4.0",
"type": "module"
}
}
6 changes: 3 additions & 3 deletions src/Pixel.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { assertEx } from '@xylabs/assert'
import { Mutex } from 'async-mutex'
import Cookies from 'js-cookie'
import md5 from 'md5'
import md5 from 'spark-md5'

import { PixelApi, UserEvent } from './Api/index.js'
import { ExIds } from './ExIds.js'
Expand Down Expand Up @@ -55,7 +55,7 @@ export class XyPixel {

identify(email?: string) {
this.email = email
this.email_hash = email ? md5(email) : undefined
this.email_hash = email ? md5.hash(email, true) : undefined
if (this.email_hash) {
localStorage.setItem(emailHashLocalStorageName, this.email_hash)
}
Expand Down Expand Up @@ -94,7 +94,7 @@ export class XyPixel {
await api.trackEvents(events)
} catch (ex) {
if (events) {
//put it back since it failed
// put it back since it failed
this.queue = [...this.queue, ...events]
}
console.error(ex)
Expand Down
6 changes: 3 additions & 3 deletions src/UtmFields.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isEqual } from '@xylabs/lodash'
import isEqual from 'fast-deep-equal'

export class UtmFields {
private static localStorageId = '_coin_utm'
Expand All @@ -10,7 +10,7 @@ export class UtmFields {
} catch {
this.fields = []
}
//this clears the old object version if needed
// this clears the old object version if needed
if (!Array.isArray(this.fields)) {
this.fields = []
}
Expand All @@ -35,7 +35,7 @@ export class UtmFields {
return JSON.stringify(this.fields)
}

//check the query string and if there an new/updated utm values, add them to the fields
// check the query string and if there an new/updated utm values, add them to the fields
update() {
const record = this.getUtmRecord()
if (record && !isEqual(this.fields.at(-1), record)) {
Expand Down
4 changes: 4 additions & 0 deletions tsconfig-eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"exclude": [".yarn", "dist", "**/dist", "./**/docs"],
"extends": "@xylabs/tsconfig"
}
4 changes: 0 additions & 4 deletions tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true
},
"extends": "@xylabs/tsconfig-dom-jest",
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
12 changes: 12 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import dotenv from 'dotenv'
// eslint-disable-next-line import-x/no-internal-modules
import { defineConfig } from 'vitest/config'

dotenv.config()

export default defineConfig({
test: {
globals: true,
setupFiles: ['./vitest.startup.ts'],
},
})
8 changes: 8 additions & 0 deletions vitest.startup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as matchers from 'jest-extended'
import { expect, vi } from 'vitest'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
(globalThis as any).jest = vi // replace jest with vi

// Extend Vitest's expect with jest-extended matchers
expect.extend(matchers)
10 changes: 10 additions & 0 deletions xy.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
const config: XyTsupConfig = {
compile: {
browser: { src: true },
neutral: {},
node: {},
},
}

export default config
Loading

0 comments on commit 5fef82d

Please sign in to comment.