Skip to content

FIX: CI Linting#41

Merged
ukch merged 4 commits intobm-developfrom
fix/ci-lint
Jan 14, 2026
Merged

FIX: CI Linting#41
ukch merged 4 commits intobm-developfrom
fix/ci-lint

Conversation

@ukch
Copy link

@ukch ukch commented Dec 23, 2025

  • delete an unused module
  • code to be run in the browser should now have a .browser.js extension, so it is linted correctly

@ukch ukch requested review from Fydon and alitokgonul December 23, 2025 20:43
@ukch ukch marked this pull request as ready for review December 23, 2025 21:45
Copy link

@Fydon Fydon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking the time to deal with all these issues.

widget_setup.js‎ must be available at scripts/widget_setup.js‎ for existing embeds of the ereader to continue to work.

util.dedup(
searchStr
.replace(/[- .,;–—"“”'‘’`~!()|\\{}\[\]:<>/?*]+/g, " ")
.replace(/[- .,;–—"“”'‘’`~!()|\\{}[\]:<>/?*]+/g, " ")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the escape for [ being removed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to eslint, it is not necessary to escape the [ character in this context.

const locale = language || req.idpLang || 'en'

const urlWithoutEditing = `${util.getProtocol({ req })}://${req.headers.host}${req.originalUrl.replace(/([\?&])editing=1&?/, '$1').replace(/iniframe=1&?/, '').replace(/[\?&]$/, '')}`
const urlWithoutEditing = `${util.getProtocol({ req })}://${req.headers.host}${req.originalUrl.replace(/([?&])editing=1&?/, '$1').replace(/iniframe=1&?/, '').replace(/[?&]$/, '')}`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the escapes for ? being removed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to eslint, it is not necessary to escape the ? character in this context.


// Split timestamp into [ Y, M, D, h, m, s, ms ]
var t = mysqlDatetime.split(/[- :\.]/)
var t = mysqlDatetime.split(/[- :.]/)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the escape for . being removed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to eslint, it is not necessary to escape the . character in this context.


isValidEmail: email => {
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the escapes for [ being removed?

@ukch
Copy link
Author

ukch commented Jan 7, 2026

widget_setup.js‎ must be available at scripts/widget_setup.js‎ for existing embeds of the ereader to continue to work.

Although this file has been renamed at source, it is still available at the same URL, that is "src/js/widget_setup.js". Any existing embed will still be able to find the file at the same URL as it was available in the past.

Edit: I was misunderstanding what this route was doing. I have since refactored it to be more sensible.

@Fydon
Copy link

Fydon commented Jan 7, 2026

The embed for staging is at https://stg.read.biblemesh.com/scripts/widget_setup.js

image

@ukch
Copy link
Author

ukch commented Jan 7, 2026

I'm seeing this stack trace when running the Docker image:

reader-1                | Error: Cannot find module '../utils/web-funcs'
reader-1                | Require stack:
reader-1                | - /app/src/routes/auth_routes.js
reader-1                | - /app/src/routes/routes.js
reader-1                | - /app/app.js
reader-1                |     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1028:15)
reader-1                |     at Function.Module._load (node:internal/modules/cjs/loader:873:27)
reader-1                |     at Module.require (node:internal/modules/cjs/loader:1100:19)
reader-1                |     at Module.patchedRequire (/app/node_modules/require-in-the-middle/index.js:233:34)
reader-1                |     at Module.Hook._require.Module.require (/app/node_modules/require-in-the-middle/index.js:181:27)
reader-1                |     at Module.patchedRequire (/app/node_modules/require-in-the-middle/index.js:233:34)
reader-1                |     at Module.Hook._require.Module.require (/app/node_modules/require-in-the-middle/index.js:181:27)
reader-1                |     at require (node:internal/modules/cjs/helpers:119:18)
reader-1                |     at Object.<anonymous> (/app/src/routes/auth_routes.js:5:39)
reader-1                |     at Module._compile (node:internal/modules/cjs/loader:1198:14) {
reader-1                |   code: 'MODULE_NOT_FOUND',
reader-1                |   requireStack: [
reader-1                |     '/app/src/routes/auth_routes.js',
reader-1                |     '/app/src/routes/routes.js',
reader-1                |     '/app/app.js'
reader-1                |   ]
reader-1                | }

To investigate

@ukch
Copy link
Author

ukch commented Jan 8, 2026

widget_setup.js‎ must be available at scripts/widget_setup.js‎ for existing embeds of the ereader to continue to work.

I fixed this and added a test. Please re-review.

@ukch ukch requested a review from Fydon January 8, 2026 03:21
Copy link

@Fydon Fydon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. If you've validated that the regex checks haven't changed, I'm happy with these changes

@ukch ukch merged commit e6440c7 into bm-develop Jan 14, 2026
6 checks passed
@ukch ukch deleted the fix/ci-lint branch January 14, 2026 14:59
@ukch ukch mentioned this pull request Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants