diff --git a/.eslintignore b/.eslintignore index 1fa7b9ba..fe7c516f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,5 @@ /packages/*/build/ /packages/*/coverage/ /packages/*/node_modules/ -/packages/best-frontend/ +/packages/best-frontend/public/ +/packages/best-frontend/server/store-mocks diff --git a/packages/best-frontend/server/api_v1.js b/packages/best-frontend/server/api_v1.js index de97dea3..83fcb729 100644 --- a/packages/best-frontend/server/api_v1.js +++ b/packages/best-frontend/server/api_v1.js @@ -115,13 +115,16 @@ function addRoutes(router, store) { async function getLatestsCommits(gitRepo, size, retried = false) { const [owner, repo] = gitRepo.split('/'); try { + console.log('[GIT] getCommits() >> FETCH'); const { data } = await GIT_ORG_API.repos.getCommits({ owner, repo, per_page: size }); return data; } catch(err) { + console.log('[GIT] getCommits() >> RETRY'); if (err.code === 401 && !retried) { GIT_ORG_API = await getOrganizationInstallation(GIT_ORG); - return getLatestsCommits(gitRepo, true); + return getLatestsCommits(gitRepo, size, true); } + console.log('[GIT] getCommits() >> ERROR'); throw err; } } @@ -129,20 +132,23 @@ async function getLatestsCommits(gitRepo, size, retried = false) { async function getLastCommitStats(store, projectName, branch, size = 30) { const gitRepo = PROJECTS[projectName]; let gitLastCommits = []; + if (GIT_ORG_API && gitRepo) { const gitCommits = await getLatestsCommits(gitRepo, size); gitLastCommits = gitCommits.map(c => c.sha.slice(0, 7)); } - const commits = await store.getCommits(projectName, branch); - const lastCommits = gitLastCommits.length ? gitLastCommits.reverse().filter((i) => commits.indexOf(i) !== -1 ) : commits.slice(0, size); + return gitLastCommits; + + // const commits = await store.getCommits(projectName, branch); + // const lastCommits = gitLastCommits.length ? gitLastCommits.reverse().filter((i) => commits.indexOf(i) !== -1 ) : commits.slice(0, size); - const lastCommitBenchmarks = await Promise.all(lastCommits.map(async (commit) => { - let benchmarks = await memoizedGetBenchPerCommit(projectName, commit); - return { commit, benchmarks }; - })); + // const lastCommitBenchmarks = await Promise.all(lastCommits.map(async (commit) => { + // let benchmarks = await memoizedGetBenchPerCommit(projectName, commit); + // return { commit, benchmarks }; + // })); - return lastCommitBenchmarks; + // return lastCommitBenchmarks; } exports.addRoutes = addRoutes; diff --git a/packages/best-frontend/src/modules/one/app-nav-bar-menu-item/app-nav-bar-menu-item.js b/packages/best-frontend/src/modules/one/app-nav-bar-menu-item/app-nav-bar-menu-item.js index 29d15a92..bf176073 100644 --- a/packages/best-frontend/src/modules/one/app-nav-bar-menu-item/app-nav-bar-menu-item.js +++ b/packages/best-frontend/src/modules/one/app-nav-bar-menu-item/app-nav-bar-menu-item.js @@ -18,10 +18,6 @@ export default class LightningMenuItem extends Element { this.classList.add("slds-dropdown__item"); } - get i18n() { - return Labels; - } - get role() { return this.checked == null ? "menuitem" : "menuitemcheckbox"; } diff --git a/packages/best-frontend/src/modules/one/app/utils.js b/packages/best-frontend/src/modules/one/app/utils.js index f47043c8..99145f39 100644 --- a/packages/best-frontend/src/modules/one/app/utils.js +++ b/packages/best-frontend/src/modules/one/app/utils.js @@ -1,3 +1,4 @@ +/* eslint no-shadow: ["error", { "allow": ["state"] }] */ function buildSeparator(label) { return { label, @@ -65,6 +66,7 @@ export function initializeState(state, serverState) { const { action, stats, projects, branches, selectedProject, selectedBranch} = serverState; const navItems = projects.map(p => buildNavItem(p)); state.projects = projects; + // eslint-disable-next-line no-return-assign, no-sequences state.branches = projects.reduce((r, p) => (r[p] = ['master'], r), {}); projects.reduce((state, p) => { state.branches[p].forEach((b) => { diff --git a/packages/best-frontend/src/modules/one/page-project/normalize-benchmarks.js b/packages/best-frontend/src/modules/one/page-project/normalize-benchmarks.js index 93a532ca..94d53443 100644 --- a/packages/best-frontend/src/modules/one/page-project/normalize-benchmarks.js +++ b/packages/best-frontend/src/modules/one/page-project/normalize-benchmarks.js @@ -84,6 +84,7 @@ export function normalizeForComparison(benchmarks, finalBenchmarkName) { let benchName; const benchmark = {}; while ((benchName = benchNameParts.shift())) { + // eslint-disable-next-line no-loop-func const benchmarkNode = benchmarks.find(b => b.benchmarkName === benchName || b.name === benchName); if (benchmarkNode.environment) { diff --git a/packages/best-frontend/src/modules/one/page-project/plots.js b/packages/best-frontend/src/modules/one/page-project/plots.js index 676d3153..bbfe22e3 100644 --- a/packages/best-frontend/src/modules/one/page-project/plots.js +++ b/packages/best-frontend/src/modules/one/page-project/plots.js @@ -1,3 +1,5 @@ +/* global Plotly */ + let PLOTS = []; function buildPlottyLayout({ title }) { @@ -73,6 +75,7 @@ window.onresize = function() { if (!debounceResize) { debounceResize = true; setTimeout(() => { + // eslint-disable-next-line lwc/no-raf window.requestAnimationFrame(() => { PLOTS.forEach((plot) => { Plotly.Plots.resize(plot); diff --git a/packages/best-frontend/src/modules/one/tmp-button-menu/keyboard.js b/packages/best-frontend/src/modules/one/tmp-button-menu/keyboard.js index 017ef057..628f3f0a 100644 --- a/packages/best-frontend/src/modules/one/tmp-button-menu/keyboard.js +++ b/packages/best-frontend/src/modules/one/tmp-button-menu/keyboard.js @@ -125,7 +125,8 @@ export function handleKeyDownOnMenuTrigger(event, menuInterface) { // XXX: This won't work if the menu is lazy loaded and // takes while to load the items (e.g. if loading from // the server - // eslint-disable-next-line raptor/no-raf + + // eslint-disable-next-line lwc/no-raf window.requestAnimationFrame(() => { let focusOnIndex = 0; if (event.keyCode === keyCodes.up) { @@ -160,7 +161,7 @@ export function handleKeyDownOnMenuTrigger(event, menuInterface) { } else if (!isVisible) { break; } - // eslint-disable-next-line raptor/no-raf + // eslint-disable-next-line lwc/no-raf window.requestAnimationFrame(() => { moveFocusToTypedCharacters(event, menuInterface); }); diff --git a/packages/best-github-integration/src/git-app.js b/packages/best-github-integration/src/git-app.js index be8457f2..b3293269 100644 --- a/packages/best-github-integration/src/git-app.js +++ b/packages/best-github-integration/src/git-app.js @@ -25,7 +25,7 @@ const APP_CERT = GIT_APP_CERT_PATH ? fs.readFileSync(expandTilde(GIT_APP_CERT_PA function generateJwt(id, cert) { const payload = { iat: Math.floor(new Date() / 1000), // Issued at time - exp: Math.floor(new Date() / 1000) + 60, // JWT expiration time + exp: Math.floor(new Date() / 1000) - 1, // JWT expiration time iss: id, // Integration's GitHub id };