Skip to content

Commit 673d724

Browse files
committed
chore: setup eslint
1 parent 868af77 commit 673d724

12 files changed

+2759
-180
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.vscode/*
2+
coverage/*

.eslintrc.cjs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright 2021 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
12+
module.exports = {
13+
root: true,
14+
extends: '@adobe/helix',
15+
env: {
16+
browser: true,
17+
},
18+
};

consent.js

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
/*
2+
* Copyright 2024 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
112
const vendors = [
213
{
314
vendor: 'onetrust',

distiller.js

+19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
/*
2+
* Copyright 2024 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
112
/*
213
* This module is another service worker, which will handle the number crunching, i.e.
314
* filtering, aggregating, and summarizing the data.
@@ -638,8 +649,10 @@ export class DataChunks {
638649
if (Object.keys(this.seriesIn).length) return this.seriesIn;
639650
this.seriesIn = Object.entries(this.groupedIn)
640651
.reduce((accOuter, [groupName, bundles]) => {
652+
// eslint-disable-next-line no-param-reassign
641653
accOuter[groupName] = Object.entries(this.series)
642654
.reduce((accInner, [seriesName, valueFn]) => {
655+
// eslint-disable-next-line no-param-reassign
643656
accInner[seriesName] = bundles.reduce(
644657
aggregateFn(valueFn),
645658
// we reference the totals object here, so that we can
@@ -649,6 +662,7 @@ export class DataChunks {
649662
return accInner;
650663
}, {});
651664
// repeat, for interpolations
665+
// eslint-disable-next-line no-param-reassign
652666
accOuter[groupName] = Object.entries(this.interpolations)
653667
.reduce(
654668
(accInner, [seriesName, { sourceSeries, interpolationFn }]) => {
@@ -657,6 +671,7 @@ export class DataChunks {
657671
acc[sourceSeriesName] = accOuter[groupName][sourceSeriesName];
658672
return acc;
659673
}, {});
674+
// eslint-disable-next-line no-param-reassign
660675
accInner[seriesName] = new InterpolatedAggregate(interpolationFn, sourceAggregates);
661676
return accInner;
662677
},
@@ -722,7 +737,9 @@ export class DataChunks {
722737
// so that we can calculate metrics
723738
// later on
724739
facet.entries.push(bundle);
740+
// eslint-disable-next-line no-param-reassign
725741
facet.count += 1;
742+
// eslint-disable-next-line no-param-reassign
726743
facet.weight += bundle.weight;
727744
return facet;
728745
};
@@ -753,6 +770,8 @@ export class DataChunks {
753770
skipped,
754771
)
755772
.reduce(groupFn(facetValueFn), {});
773+
774+
// eslint-disable-next-line no-param-reassign
756775
accOuter[facetName] = Object.entries(groupedByFacetIn)
757776
.reduce((accInner, [facetValue, bundles]) => {
758777
accInner.push(bundles

index.js

+27-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
1+
/*
2+
* Copyright 2024 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
112
import { DataChunks } from './distiller.js';
2-
import { tTest, zTestTwoProportions, samplingError, linearRegression, roundToConfidenceInterval } from './stats.js';
3-
import { isKnownFacet, scoreCWV, toHumanReadable, toISOStringWithTimezone, scoreBundle, computeConversionRate, reclassifyConsent, reclassifyAcquisition, reclassifyEnter, addCalculatedProps } from './utils.js';
13+
import {
14+
tTest, zTestTwoProportions, samplingError, linearRegression, roundToConfidenceInterval,
15+
} from './stats.js';
16+
import {
17+
isKnownFacet,
18+
scoreCWV,
19+
toHumanReadable,
20+
toISOStringWithTimezone,
21+
scoreBundle,
22+
computeConversionRate,
23+
reclassifyConsent,
24+
reclassifyAcquisition,
25+
reclassifyEnter,
26+
addCalculatedProps,
27+
} from './utils.js';
428

529
const utils = {
630
isKnownFacet,
@@ -22,4 +46,4 @@ const stats = {
2246
samplingError,
2347
};
2448

25-
export { DataChunks, utils, stats };
49+
export { DataChunks, utils, stats };

0 commit comments

Comments
 (0)