Skip to content

Commit

Permalink
fix biome lint . complaints (lint/style/useTemplate)
Browse files Browse the repository at this point in the history
- includes exceptions/suppression where needed for clarity
  • Loading branch information
rivy committed Nov 27, 2023
1 parent 2331d5d commit 0a29abd
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions test/unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ function typeOf(value) {

function xdgPathRegex(name) {
return new RegExp(
// biome-ignore lint/style/useTemplate: # better clarity with comment
'(^|' +
regexpEscape(path.sep) +
')' +
regexpEscape(name) +
'(' +
// for windows, `name` may be embedded within the generated paths (instead of always trailing as in MacOS/*nix)
(isWinOS ? regexpEscape(path.sep) + '|' : '') +
(isWinOS ? `${regexpEscape(path.sep)}|` : '') +
'$)',
);
}
Expand Down Expand Up @@ -684,8 +685,7 @@ test('correct non-"isolated" paths with XDG_* set', (t) => {
test('correctly derive anonymous (CJS)', (t) => {
const command = 'node';
process.env.TEST_MODULE_PATH = './build/lab/src/mod.cjs.js';
const script =
'"p = require(\'' + process.env.TEST_MODULE_PATH + '\'); console.log(p.$name({}));"';
const script = `"p = require('${process.env.TEST_MODULE_PATH}'); console.log(p.$name({}));"`;
const args = ['-e', isWinOS ? script : script.replace('$name', '\\$name')];
const options = { shell: true, encoding: 'utf-8' };

Expand All @@ -704,8 +704,7 @@ if (settledSupportForESMs) {
test('correctly derive anonymous (ESM/[import CJS])', (t) => {
const command = 'node';
process.env.TEST_MODULE_PATH = './build/lab/src/mod.cjs.js';
const script =
'"import p from \'' + process.env.TEST_MODULE_PATH + '\'; console.log(p.$name({}));"';
const script = `"import p from '${process.env.TEST_MODULE_PATH}'; console.log(p.$name({}));"`;
const args = [
'--input-type=module',
'-e',
Expand All @@ -727,8 +726,7 @@ if (settledSupportForESMs) {
test('correctly derive anonymous (ESM/[esm-wrapper])', (t) => {
const command = 'node';
process.env.TEST_MODULE_PATH = './build/lab/src/esm-wrapper/mod.esm.js';
const script =
'"import p from \'' + process.env.TEST_MODULE_PATH + '\'; console.log(p.$name({}));"';
const script = `"import p from '${process.env.TEST_MODULE_PATH}'; console.log(p.$name({}));"`;
const args = [
'--input-type=module',
'-e',
Expand All @@ -750,8 +748,7 @@ if (settledSupportForESMs) {
test('correctly derive anonymous (ESM)', (t) => {
const command = 'node';
process.env.TEST_MODULE_PATH = './build/esm/src/mod.esm.js';
const script =
'"import p from \'' + process.env.TEST_MODULE_PATH + '\'; console.log(p.$name({}));"';
const script = `"import p from '${process.env.TEST_MODULE_PATH}'; console.log(p.$name({}));"`;
const args = [
'--input-type=module',
'-e',
Expand Down

0 comments on commit 0a29abd

Please sign in to comment.