Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
{
"$schema": "https://biomejs.dev/schemas/2.4.13/schema.json",
"files": {
"ignore": ["renovate.json"]
"includes": ["**", "!**/renovate.json"]
},
"linter": {
"rules": {
"all": true,
"recommended": true,
"correctness": {
"noUndeclaredVariables": "error",
"noNodejsModules": "off"
},
"suspicious": {
"noConsole": "off",
"noConsoleLog": "off"
"noTemplateCurlyInString": "off"
},
"performance": {
"useTopLevelRegex": "off"
},
"complexity": {
"noExcessiveCognitiveComplexity": {
"level": "error",
"options": {
"maxAllowedComplexity": 20
}
Expand All @@ -26,7 +28,7 @@
}
},
"formatter": {
"ignore": ["package.json", "license-checker-config.json"],
"includes": ["**", "!**/package.json", "!**/license-checker-config.json"],
"indentStyle": "space",
"lineWidth": 120
},
Expand All @@ -38,7 +40,7 @@
},
"overrides": [
{
"include": ["test/**/*.js"],
"includes": ["**/test/**/*.js"],
"javascript": {
"globals": ["afterEach", "afterAll", "beforeEach", "beforeAll", "describe", "it"]
},
Expand All @@ -51,7 +53,7 @@
}
},
{
"include": ["src/commands/*.js"],
"includes": ["**/src/commands/**/*.js"],
"linter": {
"rules": {
"style": {
Expand All @@ -61,7 +63,7 @@
}
},
{
"include": ["src/fastly/service.js"],
"includes": ["**/src/fastly/service.js"],
"linter": {
"rules": {
"style": {
Expand Down
73 changes: 36 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"yargs": "17.7.2"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@biomejs/biome": "2.4.13",
"@commitlint/cli": "19.8.1",
"@commitlint/config-conventional": "19.8.1",
"@semantic-release/changelog": "6.0.3",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/service/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import chalk from 'chalk';
import { FastlyServiceManager } from '../../fastly/service-mgr.js';
import { readService } from '../../fastly/store.js';
import { SHARED_OPTS, override } from '../../opts.js';
import { override, SHARED_OPTS } from '../../opts.js';

export default {
command: 'create',
Expand Down
2 changes: 1 addition & 1 deletion src/commands/service/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import chalk from 'chalk';
import { FastlyServiceManager } from '../../fastly/service-mgr.js';
import { writeService } from '../../fastly/store.js';
import { SHARED_OPTS, override } from '../../opts.js';
import { override, SHARED_OPTS } from '../../opts.js';
import { detectSecrets } from '../../secrets/secrets.js';

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/service/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { execSync } from 'node:child_process';
import chalk from 'chalk';
import { FastlyServiceManager } from '../../fastly/service-mgr.js';
import { readService } from '../../fastly/store.js';
import { SHARED_OPTS, override } from '../../opts.js';
import { override, SHARED_OPTS } from '../../opts.js';

function getLastGitCommit() {
try {
Expand Down
2 changes: 0 additions & 2 deletions src/fastly/api/fastly-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ export class FastlyApi {
// create dict
const body = toFormData({
name: dictName,
// biome-ignore lint/style/useNamingConvention: fastly json naming
write_only: String(writeOnly),
});
resp = await this.fetch(`POST /service/${serviceId}/version/${versionId}/dictionary`, { body });
Expand All @@ -289,7 +288,6 @@ export class FastlyApi {
}
const { id } = await resp.json();

// biome-ignore lint/style/useNamingConvention: fastly json naming
const items = Object.entries(entries).map(([key, value]) => ({ op: 'upsert', item_key: key, item_value: value }));

while (items.length > 0) {
Expand Down
10 changes: 2 additions & 8 deletions src/fastly/fiddle-mgr.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,13 @@ function tablesToDictionaries(init, service, opts) {

const dicts = [];

const tablesRegex = /table (\w+) \{[^\}]*\}/gm;
const tablesRegex = /table (\w+) \{[^}]*\}/gm;
const entriesRegex = /^\s*"([^"]*)"\s*:\s*"([^"]*)"\s*,.*$/gm;

for (const table of init.matchAll(tablesRegex)) {
const name = table[1];
const dict = {
name,
// biome-ignore lint/style/useNamingConvention: fastly json schema
write_only: currentDicts[name]?.write_only,
items: [],
info: {},
Expand All @@ -128,9 +127,7 @@ function tablesToDictionaries(init, service, opts) {
const entries = table[0].matchAll(entriesRegex);
for (const entry of entries) {
dict.items.push({
// biome-ignore lint/style/useNamingConvention: fastly json schema
item_key: entry[1],
// biome-ignore lint/style/useNamingConvention: fastly json schema
item_value: entry[2],
});
}
Expand Down Expand Up @@ -188,12 +185,9 @@ function fiddleOriginsToBackends(fiddle, service) {
name,
address: origin.hostname,
hostname: origin.hostname,
port: origin.port === '' ? (origin.protocol === 'https:' ? 443 : 80) : Number.parseInt(origin.port),
// biome-ignore lint/style/useNamingConvention: fastly json schema
port: origin.port === '' ? (origin.protocol === 'https:' ? 443 : 80) : Number.parseInt(origin.port, 10),
use_ssl: origin.protocol === 'https:',
// biome-ignore lint/style/useNamingConvention: fastly json schema
ssl_cert_hostname: origin.protocol === 'https:' ? origin.hostname : null,
// biome-ignore lint/style/useNamingConvention: fastly json schema
ssl_sni_hostname: origin.protocol === 'https:' ? origin.hostname : null,
});
}
Expand Down
3 changes: 0 additions & 3 deletions src/fastly/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ function writeDictionaries(dictionaries) {
}

function readDictionary(dictPath) {
// biome-ignore lint/style/useNamingConvention: fastly json naming
let write_only = false;
let filename = path.basename(dictPath, '.ini');
if (filename.startsWith(PRIVATE_DICT_PREFIX)) {
Expand All @@ -355,9 +354,7 @@ function readDictionary(dictPath) {
const keyValueMatch = line.match(/([^=]+)="(.*)"/);
if (keyValueMatch) {
dict.items.push({
// biome-ignore lint/style/useNamingConvention: fastly json naming
item_key: keyValueMatch[1],
// biome-ignore lint/style/useNamingConvention: fastly json naming
item_value: keyValueMatch[2],
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/secrets/secrets.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function findSecretsInString(input) {
matches.push(...findKnownSecretPatterns(input));

// 2. find high entropy strings. need to split into "words" first
for (const word of input.split(/[\s:\/\.,&#'"=;]+/)) {
for (const word of input.split(/[\s:/.,&#'"=;]+/)) {
// if (matches.length === 0) {
const match = findHighEntropy(word, cfg?.entropy_threshold);
if (match) {
Expand Down
1 change: 0 additions & 1 deletion src/test/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ export async function runTests(globs, tepiArgs = []) {
}

// if absolute path is used (eg. by tepi VS Code extension), make it relative
// biome-ignore lint/style/noParameterAssign: it's easier this way :)
globs = globs.map((g) => removePrefix(g, `${process.cwd()}/`));

try {
Expand Down
4 changes: 0 additions & 4 deletions src/yargs-ahoy.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function isFile(path) {
} catch (err) {
if (err.code === 'ENOENT') {
return false; // File doesn't exist
// biome-ignore lint/style/noUselessElse: mistakenly flagged
} else {
throw err; // Other errors
}
Expand All @@ -38,7 +37,6 @@ function isDirectory(path) {
} catch (err) {
if (err.code === 'ENOENT') {
return false; // Directory doesn't exist
// biome-ignore lint/style/noUselessElse: mistakenly flagged
} else {
throw err; // Other errors
}
Expand Down Expand Up @@ -97,7 +95,6 @@ function onFail(msg, err, yargs) {
} else {
// yargs validation errors (only message, no err)
for (const [newMsg, oldMsg] of Object.entries(BETTER_FAIL_MESSAGES)) {
// biome-ignore lint/style/noParameterAssign: it's easier this way :)
msg = msg.replace(oldMsg, newMsg);
}

Expand Down Expand Up @@ -155,7 +152,6 @@ function handleAdditionalTypes(_yargs, opt) {
* - exit with code 2 on application errors
* - TODO: document other stuff
*/
// biome-ignore lint/style/noDefaultExport: we mimic yargs here
export default function yargsAhoy(processArgs, cwd, parentRequire) {
const yargs = _yargs(processArgs, cwd, parentRequire);

Expand Down
2 changes: 1 addition & 1 deletion test/secrets.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import assert from 'node:assert/strict';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { LOG_SECRET_FIELDS, detectSecrets } from '../src/secrets/secrets.js';
import { detectSecrets, LOG_SECRET_FIELDS } from '../src/secrets/secrets.js';

// silence debug/warn output for these tests
console.debug = () => ({});
Expand Down
4 changes: 2 additions & 2 deletions test/test.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class StreamCatcher {
this.streamWrite = stream._write;

this.buffer = Buffer.alloc(0);
// biome-ignore lint/complexity/noUselessThisAlias: <explanation>
// biome-ignore lint/complexity/noUselessThisAlias: needed for arrow function closure below
const self = this;

stream._write = (chunk, encoding, callback) => {
Expand Down Expand Up @@ -50,7 +50,7 @@ class StreamCatcher {
class ExitCatcher {
constructor() {
this.processExit = process.exit;
// biome-ignore lint/complexity/noUselessThisAlias: <explanation>
// biome-ignore lint/complexity/noUselessThisAlias: needed for arrow function closure below
const self = this;
process.exit = (code) => {
self.code = code;
Expand Down
Loading