chore: Fix eslint issues in backend util

/puter/packages/backend/src/util/stdioutil.js
  26:24  error  Unexpected control character(s) in regular expression: \x1b  no-control-regex

/puter/packages/backend/src/util/streamutil.js
  368:1  error  'string_to_stream' is not defined  no-undef
  463:5  error  'string_to_stream' is not defined  no-undef

/puter/packages/backend/src/util/strutil.js
  42:1  error  'format_as_usd' is not defined  no-undef
  56:5  error  'format_as_usd' is not defined  no-undef
This commit is contained in:
Sam Atkins 2024-04-25 18:14:08 +01:00
parent 60523dc7a7
commit 9b3dd6b753
3 changed files with 3 additions and 2 deletions

View File

@ -23,6 +23,7 @@
* @param {*} str * @param {*} str
*/ */
const visible_length = (str) => { const visible_length = (str) => {
// eslint-disable-next-line no-control-regex
return str.replace(/\x1b\[[0-9;]*m/g, '').length; return str.replace(/\x1b\[[0-9;]*m/g, '').length;
}; };

View File

@ -365,7 +365,7 @@ const stuck_detector_stream = (source, {
return stream; return stream;
} }
string_to_stream = (str, chunk_size) => { const string_to_stream = (str, chunk_size) => {
const s = new Readable(); const s = new Readable();
s._read = () => {}; // redundant? see update below s._read = () => {}; // redundant? see update below
// split string into chunks // split string into chunks

View File

@ -39,7 +39,7 @@ const osclink = (url, text) => {
return `\x1B]8;;${url}\x1B\\${text}\x1B]8;;\x1B\\`; return `\x1B]8;;${url}\x1B\\${text}\x1B]8;;\x1B\\`;
} }
format_as_usd = (amount) => { const format_as_usd = (amount) => {
if ( amount < 0.01 ) { if ( amount < 0.01 ) {
if ( amount < 0.00001 ) { if ( amount < 0.00001 ) {
// scientific notation // scientific notation