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
9 changes: 0 additions & 9 deletions .github/linters/.stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,21 @@
],
"color-function-notation": null,
"comment-empty-line-before": null,
"declaration-colon-newline-after": null,
"font-family-no-duplicate-names": [
true,
{
"ignoreFontFamilyNames": ["monospace"]
}
],
"length-zero-no-unit": null,
"max-line-length": null,
"media-feature-range-notation": "prefix",
"no-descending-specificity": null,
"no-eol-whitespace": [
true,
{
"ignore": ["empty-lines"]
}
],
"property-no-unknown": [
true,
{
"ignoreProperties": ["prince-pdf-display-doc-title","prince-pdf-tag-type"]
}
],
"selector-list-comma-newline-after": "always",
"selector-pseudo-element-no-unknown": [
true,
{
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code-static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: actions/checkout@v4
- name: Set up Python 3.12
if: ${{ matrix.language == 'python' }}
uses: actions/setup-python@v5
uses: actions/setup-python
with:
python-version: '3.12'
- name: Install dependencies
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Linter GitHub Actions ##
###########################
#
# Documentation: https://github.com/github/super-linter/
# Documentation: https://github.com/super-linter/super-linter/
#
# Exception config files are in the .github/linters directory
#
Expand All @@ -24,12 +24,11 @@ jobs:
# Only run the full workflow for manual runs or if upgrading the super linter
if: |
github.event_name != 'workflow_dispatch' &&
startsWith(github.event.pull_request.title,'Bump github/super-linter') != true
startsWith(github.event.pull_request.title,'Bump super-linter/super-linter') != true
run: |
echo "VALIDATE_ALL_CODEBASE=false" >> $GITHUB_ENV
- name: Lint Code Base
#uses: docker://github/super-linter:v3.15.3
uses: github/super-linter/slim@v4.10.1
uses: super-linter/super-linter/slim@v7
env:
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/predeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
with:
node-version: '20'
- name: Set up Python 3.12
uses: actions/setup-python@v5
uses: actions/setup-python
with:
python-version: '3.12'
- name: Run the website
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
with:
node-version: '20'
- name: Set up Python 3.12
uses: actions/setup-python@v5
uses: actions/setup-python
with:
python-version: '3.12'
- name: Run the website
Expand All @@ -35,7 +35,7 @@ jobs:
- name: Use more complete checks for generated HTML linting
run: cp -f .github/linters/.htmlhintrc_morechecks .github/linters/.htmlhintrc
- name: Lint Generated HTML
uses: github/super-linter/slim@v4.10.1
uses: super-linter/super-linter/slim@v7
env:
DEFAULT_BRANCH: main
FILTER_REGEX_INCLUDE: static/html/.*
Expand Down
2 changes: 1 addition & 1 deletion config/reports.json
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@
},
"progressive-web-apps": {
"name": "Progressive Web Apps",
"summary": "This report examines the state of [Progressive Web Apps (PWAs)](https://developers.google.com/web/progressive-web-apps/). PWAs are a new class of web applications, enabled by the [Service Worker APIs](https://developer.mozilla.org/en/docs/Web/API/Service_Worker_API). Service workers allow apps to support network-independent loading, to receive push notifications as well as to synchronize data in the background, and — together with [Web App Manifests](https://developer.mozilla.org/en-US/docs/Web/Manifest) — allow users to install PWAs.",
"summary": "This report examines the state of [Progressive Web Apps (PWAs)](https://developers.google.com/web/progressive-web-apps/). PWAs are a new class of web applications, enabled by the [Service Worker APIs](https://developer.mozilla.org/en/docs/Web/API/Service_Worker_API). Service workers allow apps to support network-independent loading, to receive push notifications as well as to synchronize data in the background, andtogether with [Web App Manifests](https://developer.mozilla.org/en-US/docs/Web/Manifest)allow users to install PWAs.",
"image": "/static/img/reports/progressive-web-apps-report.png",
"metrics": [
"pwaScores",
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class Filters {
updateCategory(event) {
// Get the techs associated with the selected category
const selectedCategory = this.categories.find(category => category.category === event.target.value);
let selectedTechs = selectedCategory?.technologies || [];
let selectedTechs = selectedCategory?.technologies || [];
if(event.target.value === 'ALL') {
selectedTechs = this.technologies.map(technology => technology.technology);
}
Expand Down
15 changes: 9 additions & 6 deletions src/js/histogram.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global Highcharts */

import { Colors } from './colors';
import debounce from './debounce';
import { Metric } from './metric';
Expand Down Expand Up @@ -38,13 +40,13 @@ function drawClientSummary(data, options, client) {
}

function getSummary(data, options) {
const summary = getPrimaryMetric(data, options);
const summary = getPrimaryMetric(data);
const metric = new Metric(options, summary);

return metric.toString();
}

function getPrimaryMetric(data, options) {
function getPrimaryMetric(data) {
data = data.filter(o => +o.cdf > 0.5);
if (!data.length) {
return '?';
Expand Down Expand Up @@ -110,12 +112,13 @@ class Bin {
format(property) {
switch(property) {
case 'pdf':
case 'cdf':
case 'cdf': {
let value = (Math.floor(this[property] * 10000) / 100).toFixed(2);
if (value < 10) {
value = '0' + value;
}
return value + '%';
}
case 'volume':
return this[property].toLocaleString();
default:
Expand Down Expand Up @@ -265,8 +268,8 @@ function drawHistogram(data, containerId, options) {
const chart = document.getElementById(`${options.metric}-chart`);
callOnceWhenVisible(chart, () => {
drawChart(series, containerId, options);
});
};
})
}

function drawChart(series, containerId, options) {
const chart = Highcharts.chart(containerId, {
Expand Down Expand Up @@ -326,7 +329,7 @@ function drawChart(series, containerId, options) {
borderColor: 'rgba(247,247,247,0.85)',
formatter: function() {
const metric = new Metric(options, Math.round(this.points[0].x * 100) / 100);
const tooltips = this.points.filter(p => !p.series.name.includes('CDF')).map((point, points) => {
const tooltips = this.points.filter(p => !p.series.name.includes('CDF')).map((point) => {
const cdf = this.points.find(p => p.series.name == `${point.series.name} CDF`);
return `<td>
<p style="text-transform: uppercase; font-size: 10px;">
Expand Down
6 changes: 3 additions & 3 deletions src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function renderBlogPosts() {
}

const blog = new BlogRenderer();
blog.renderPosts(blog_posts, template).then(_ => blog_section.classList.remove('hidden'));
blog.renderPosts(blog_posts, template).then(() => blog_section.classList.remove('hidden'));
}

function getDiscussTopics() {
Expand All @@ -27,12 +27,12 @@ function getDiscussTopics() {
const topics = r.topic_list.topics.slice(0, 2);
topics.forEach(topic => latestTopicIds.add(topic.id));
drawTopics(topics, r.users);
}).then(_ => {
}).then(() => {
return fetch(`${Discussion.ORIGIN}/top.json`);
}).then(r => r.json()).then(r => {
const topics = r.topic_list.topics.filter(topic => !latestTopicIds.has(topic.id)).slice(0, 3);
drawTopics(topics, r.users);
}).then(_ => discuss_section.classList.remove('hidden'));
}).then(() => discuss_section.classList.remove('hidden'));
}

function drawTopics(topics, rUsers) {
Expand Down
2 changes: 1 addition & 1 deletion src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const hamburger = document.querySelector('.hamburger');

if (mobileNav) {
if (hamburger) {
hamburger.addEventListener('click', (e) => {
hamburger.addEventListener('click', () => {
const expanded = hamburger.getAttribute('aria-expanded');
mobileNav.classList.toggle('active');
hamburger.ariaExpanded = expanded === 'true' ? 'false' : 'true';
Expand Down
14 changes: 8 additions & 6 deletions src/js/report.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global charts */

import { Colors } from './colors';
import { Metric } from './metric';
import { prettyDate, drawMetricSummary } from './utils';
Expand Down Expand Up @@ -32,21 +34,21 @@ class Report {
}

bindChangeListener(id) {
document.getElementById(id).addEventListener('change', e => {
document.getElementById(id).addEventListener('change', (e) => {
this[id] = e.target.value
this.updatePermalink();
});
}

bindUpdateListener() {
document.getElementById('update').addEventListener('click', _ => {
document.getElementById('update').addEventListener('click', () => {
// TODO: Consider using history.replaceState on field changes instead.
location.href = this.permalink.value;
});
}

bindTableVisibilityToggle() {
document.body.addEventListener('click', e => {
document.body.addEventListener('click', (e) => {
if (!e.target.classList.contains('show-hide')) {
return;
}
Expand Down Expand Up @@ -83,7 +85,7 @@ class Report {
}

bindPermalinkClick() {
this.permalink.addEventListener('click', _ => {
this.permalink.addEventListener('click', () => {
this.permalink.select();
});
}
Expand Down Expand Up @@ -180,7 +182,7 @@ class Report {
const gridExpanderSelector = '.grid-expansion, .metric-header a';
Array.from(document.querySelectorAll(gridExpanderSelector)).forEach(btn => {
const metricId = btn.dataset.metric;
btn.addEventListener('click', e => {
btn.addEventListener('click', () => {
this.toggleMetricExpansion(metricId);
});
});
Expand Down Expand Up @@ -208,7 +210,7 @@ class Report {

getWPT(wptId) {
const wpt = new WPT(wptId);
wpt.fetchResults().then(results => {
wpt.fetchResults().then(() => {
const metrics = wpt.getMetrics(this.report);
Object.entries(metrics).forEach(([metric, value]) => {
const options = this.report.metrics.find(m => m.id === metric);
Expand Down
5 changes: 4 additions & 1 deletion src/js/send-web-vitals.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global gtag, webVitals */

function sendWebVitals() {

function getLoafAttribution(attribution) {
Expand Down Expand Up @@ -80,7 +82,7 @@ function sendWebVitals() {
debug_target: attribution.loadState || '(not set)',
};
break;
case 'INP':
case 'INP': {
const loafAttribution = getLoafAttribution(attribution);
overrides = {
debug_event: attribution.interactionType,
Expand All @@ -93,6 +95,7 @@ function sendWebVitals() {
...loafAttribution
};
break;
}
case 'LCP':
overrides = {
debug_url: attribution.url,
Expand Down
7 changes: 5 additions & 2 deletions src/js/techreport/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global Section */

import Filters from '../components/filters';
import { Constants } from './utils/constants';
const { DrilldownHeader } = require("../components/drilldownHeader");
Expand Down Expand Up @@ -87,11 +89,12 @@ class TechReport {
this.getAllMetricData();
break;

case 'category':
const category = this.filters.category || 'CMS';
case 'category': {
const category = this.filters.category || 'CMS';
this.initializeReport();
this.getCategoryData(category);
break;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/js/techreport/section.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global Timeseries */

import SummaryCard from "./summaryCards";
import TableLinked from "./tableLinked";

Expand Down
4 changes: 2 additions & 2 deletions src/js/techreport/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function sortTableBy(dataset, key) {
}

function getColumnCell(columnConfig, data, date) {
const { config, column, client, app, subcategory, metric, endpoint } = columnConfig;
const { column, client, app, subcategory, endpoint } = columnConfig;

const _data = data[app]?.find(entry => entry.date === date);
const endpointData = _data?.[endpoint];
Expand All @@ -96,7 +96,7 @@ function getColumnCell(columnConfig, data, date) {
function getSubcategory(config) {
const urlParams = new URLSearchParams(window.location.search);
const urlSubcategory = urlParams.get(config.param);
const subcategory = urlSubcategory || config.default || '';
const subcategory = urlSubcategory || config.default || '';

return subcategory;
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/techreport/tableLinked.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class TableLinked {
checkbox.setAttribute('data-name', `table-${this.id}`);
checkbox.setAttribute('id', `${app}-table-${this.id}`);
checkbox.setAttribute('name', `${app}-table-${this.id}`);
checkbox.addEventListener('change', (e) => {
checkbox.addEventListener('change', () => {
const appLinks = document.querySelectorAll('[data-name="selected-apps"]');
const selectedApps = document.querySelectorAll(`[data-name="table-${this.id}"]:checked`);

Expand Down
10 changes: 6 additions & 4 deletions src/js/techreport/timeseries.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global Highcharts */

import { Table } from "./table";
import { DataUtils } from "./utils/data";
import { UIUtils } from "./utils/ui";
Expand Down Expand Up @@ -120,7 +122,7 @@ class Timeseries {
/* Get the currently selected subcategory based on the URL */
const urlParams = new URLSearchParams(window.location.search);
const urlSubcategory = urlParams.get(config.param);
const subcategory = urlSubcategory || config.default;
const subcategory = urlSubcategory || config.default;

/* Remove the previous content */
container.innerHTML = '';
Expand Down Expand Up @@ -182,7 +184,7 @@ class Timeseries {
/* Get the currently selected subcategory based on the URL */
const urlParams = new URLSearchParams(window.location.search);
const urlSubcategory = urlParams.get(config.param);
const subcategory = urlSubcategory || config.default;
const subcategory = urlSubcategory || config.default;

/* Get settings */
const metric = component.dataset.metric;
Expand Down Expand Up @@ -398,7 +400,7 @@ class Timeseries {
const config = this.pageConfig[this.id]?.viz;
const urlParams = new URLSearchParams(window.location.search);
const urlSubcategory = urlParams.get(config.param);
const subcategory = urlSubcategory || config.default;
const subcategory = urlSubcategory || config.default;

// Get default colors
const colors = this.defaults(config)?.chart?.colors;
Expand All @@ -412,7 +414,7 @@ class Timeseries {
const value = row?.[endpoint]?.find(row => row.name === subcategory)?.[client]?.[metric];
return {
x: new Date(row.date).getTime(),
y: value || 0,
y: value || 0,
};
});

Expand Down
Loading