Skip to content

Commit c6fda9d

Browse files
committed
fix: run lint script and fix errors
1 parent ce891a0 commit c6fda9d

10 files changed

Lines changed: 125 additions & 124 deletions

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"no-prototype-builtins": "off",
2525
"no-empty": "off",
2626
"no-useless-escape": "off",
27-
"no-unexpected-multiline": "off"
27+
"no-unexpected-multiline": "off",
28+
"no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }]
2829
}
2930
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"repository": "https://github.com/mparticle-integrations/mparticle-javascript-integration-rokt",
99
"scripts": {
1010
"build": "ENVIRONMENT=production rollup --config rollup.config.js",
11-
"build:test": "ENVIRONMENT=production rollup --config rollup.test.config.js",
11+
"build:test": "rollup --config rollup.test.config.js",
1212
"lint": "eslint src/ test/src/",
1313
"lint:fix": "eslint src/ test/src/ --fix",
1414
"watch": "ENVIRONMENT=production rollup --config rollup.config.js -w",

src/commerce-handler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function CommerceHandler(common) {
22
this.common = common || {};
33
}
44

5-
CommerceHandler.prototype.logCommerceEvent = function(event) {
5+
CommerceHandler.prototype.logCommerceEvent = function (_event) {
66
/*
77
Sample ecommerce event schema:
88
{

src/common.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ function Common() {}
22

33
Common.prototype.exampleMethod = function () {
44
return 'I am an example';
5-
}
5+
};
66

7-
module.exports = Common;
7+
module.exports = Common;

src/event-handler.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ A non-ecommerce event has the following schema:
1616
function EventHandler(common) {
1717
this.common = common || {};
1818
}
19-
EventHandler.prototype.logEvent = function(event) {};
20-
EventHandler.prototype.logError = function(event) {
19+
EventHandler.prototype.logEvent = function (_event) {};
20+
EventHandler.prototype.logError = function (_event) {
2121
// The schema for a logError event is the same, but noteworthy differences are as follows:
2222
// {
2323
// EventAttributes: {m: 'name of error passed into MP', s: "Error", t: 'stack trace in string form if applicable'},
2424
// EventName: "Error"
2525
// }
2626
};
27-
EventHandler.prototype.logPageView = function(event) {
27+
EventHandler.prototype.logPageView = function (_event) {
2828
/* The schema for a logPagView event is the same, but noteworthy differences are as follows:
2929
{
3030
EventAttributes: {hostname: "www.google.com", title: 'Test Page'}, // These are event attributes only if no additional event attributes are explicitly provided to mParticle.logPageView(...)
@@ -33,4 +33,3 @@ EventHandler.prototype.logPageView = function(event) {
3333
};
3434

3535
module.exports = EventHandler;
36-

src/identity-handler.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,32 @@ For more userIdentity types, see https://docs.mparticle.com/developers/sdk/web/i
2121
function IdentityHandler(common) {
2222
this.common = common || {};
2323
}
24-
IdentityHandler.prototype.onUserIdentified = function(mParticleUser) {};
25-
IdentityHandler.prototype.onIdentifyComplete = function(
26-
mParticleUser,
27-
identityApiRequest
24+
IdentityHandler.prototype.onUserIdentified = function (_mParticleUser) {};
25+
IdentityHandler.prototype.onIdentifyComplete = function (
26+
_mParticleUser,
27+
_identityApiRequest
2828
) {};
29-
IdentityHandler.prototype.onLoginComplete = function(
30-
mParticleUser,
31-
identityApiRequest
29+
IdentityHandler.prototype.onLoginComplete = function (
30+
_mParticleUser,
31+
_identityApiRequest
3232
) {};
33-
IdentityHandler.prototype.onLogoutComplete = function(
34-
mParticleUser,
35-
identityApiRequest
33+
IdentityHandler.prototype.onLogoutComplete = function (
34+
_mParticleUser,
35+
_identityApiRequest
3636
) {};
37-
IdentityHandler.prototype.onModifyComplete = function(
38-
mParticleUser,
39-
identityApiRequest
37+
IdentityHandler.prototype.onModifyComplete = function (
38+
_mParticleUser,
39+
_identityApiRequest
4040
) {};
4141

4242
/* In previous versions of the mParticle web SDK, setting user identities on
4343
kits is only reachable via the onSetUserIdentity method below. We recommend
4444
filling out `onSetUserIdentity` for maximum compatibility
4545
*/
46-
IdentityHandler.prototype.onSetUserIdentity = function(
47-
forwarderSettings,
48-
id,
49-
type
46+
IdentityHandler.prototype.onSetUserIdentity = function (
47+
_forwarderSettings,
48+
_id,
49+
_type
5050
) {};
5151

5252
module.exports = IdentityHandler;
53-

src/initialization.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var initialization = {
2525
_clientId
2626
) {
2727
if (!testMode) {
28-
if (!window.Rokt && !window.Rokt?.currentLauncher) {
28+
if (!window.Rokt || !(window.Rokt && window.Rokt.currentLauncher)) {
2929
var target = document.head || document.body;
3030
var script = document.createElement('script');
3131
script.type = 'text/javascript';
@@ -39,8 +39,8 @@ var initialization = {
3939
// Once the script loads, ensure the Rokt object is available
4040
if (
4141
window.Rokt &&
42-
typeof window.Rokt?.createLauncher === 'function'
43-
&& window.Rokt?.currentLauncher === undefined
42+
typeof window.Rokt.createLauncher === 'function' &&
43+
window.Rokt.currentLauncher === undefined
4444
) {
4545
window.Rokt.createLauncher({
4646
accountId: forwarderSettings.accountId,

src/session-handler.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
var sessionHandler = {
2-
onSessionStart: function(event) {
3-
4-
},
5-
onSessionEnd: function(event) {
6-
7-
}
2+
onSessionStart: function (_event) {},
3+
onSessionEnd: function (_event) {},
84
};
95

106
module.exports = sessionHandler;

src/user-attribute-handler.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@ For any additional methods, see http://docs.mparticle.com/developers/sdk/javascr
1010
function UserAttributeHandler(common) {
1111
this.common = common || {};
1212
}
13-
UserAttributeHandler.prototype.onRemoveUserAttribute = function(
14-
key,
15-
mParticleUser
13+
UserAttributeHandler.prototype.onRemoveUserAttribute = function (
14+
_key,
15+
_mParticleUser
1616
) {};
17-
UserAttributeHandler.prototype.onSetUserAttribute = function(
18-
key,
19-
value,
20-
mParticleUser
17+
UserAttributeHandler.prototype.onSetUserAttribute = function (
18+
_key,
19+
_value,
20+
_mParticleUser
2121
) {};
22-
UserAttributeHandler.prototype.onConsentStateUpdated = function(
23-
oldState,
24-
newState,
25-
mParticleUser
22+
UserAttributeHandler.prototype.onConsentStateUpdated = function (
23+
_oldState,
24+
_newState,
25+
_mParticleUser
2626
) {};
2727

2828
module.exports = UserAttributeHandler;
29-

0 commit comments

Comments
 (0)