Skip to content

Commit

Permalink
fix biome lint complaints
Browse files Browse the repository at this point in the history
- lint/performance/noDelete
- lint/style/useTemplate
  - added exceptions where it makes sense
- lint/suspicious/noRedundantUseStrict
  • Loading branch information
rivy committed Nov 27, 2023
1 parent 8dcb246 commit d213369
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
1 change: 0 additions & 1 deletion test/dist.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-env es6, node */
'use strict';

/* note: dynamic imports are used because 'dist' may not exist */

Expand Down
2 changes: 0 additions & 2 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

// spell-checker:ignore (names) Deno ; (vars) ESM ESMs vNodeJSMajor vNodeJSminor ; (words) cyclomatic

'use strict';

const fs = require('fs');
const path = require('path');
const util = require('util');
Expand Down
28 changes: 12 additions & 16 deletions test/unit.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable functional/immutable-data , functional/no-loop-statement , security-node/non-literal-reg-expr , security/detect-non-literal-regexp , security/detect-object-injection */
/* eslint-env es6, node */
// spell-checker:ignore (vars) ESM ESMs vNodeJSMajor vNodeJSminor
'use strict';

const path = require('path');

Expand All @@ -26,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 @@ -324,8 +324,8 @@ test('correct paths with only XDG_*_HOME set', (t) => {
data: 'XDG_DATA_HOME',
state: 'XDG_STATE_HOME',
};
delete process.env.XDG_CONFIG_DIRS;
delete process.env.XDG_DATA_DIRS;
process.env.XDG_CONFIG_DIRS = void 0;
process.env.XDG_DATA_DIRS = void 0;
Object.keys(envVars).forEach((key) => {
const env = envVars[key];
process.env[env] = path.join('.', env);
Expand Down Expand Up @@ -385,8 +385,8 @@ test('correct "isolated" paths with only XDG_*_HOME set', (t) => {
data: 'XDG_DATA_HOME',
state: 'XDG_STATE_HOME',
};
delete process.env.XDG_CONFIG_DIRS;
delete process.env.XDG_DATA_DIRS;
process.env.XDG_CONFIG_DIRS = void 0;
process.env.XDG_DATA_DIRS = void 0;
for (const key of Object.keys(envVars)) {
const env = envVars[key];
process.env[env] = path.join('.', env);
Expand Down Expand Up @@ -446,8 +446,8 @@ test('correct non-"isolated" paths with only XDG_*_HOME set', (t) => {
data: 'XDG_DATA_HOME',
state: 'XDG_STATE_HOME',
};
delete process.env.XDG_CONFIG_DIRS;
delete process.env.XDG_DATA_DIRS;
process.env.XDG_CONFIG_DIRS = void 0;
process.env.XDG_DATA_DIRS = void 0;
Object.keys(envVars).forEach((key) => {
const env = envVars[key];
process.env[env] = path.join('.', env);
Expand Down Expand Up @@ -685,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 @@ -705,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 @@ -728,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 @@ -751,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 d213369

Please sign in to comment.