Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jun 11, 2024
1 parent ddbb78c commit 06f21a1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export default {
// base/config.ts
export default {
colors: {
primary: 'base_primary'
primary: 'base_primary',
text: 'base_text'
}
}
Expand All @@ -225,7 +225,7 @@ export default {
The loaded configuration would look like this:

```js
{
const config = {
dev: true,
colors: {
primary: 'user_primary',
Expand All @@ -239,9 +239,9 @@ Layers:

```js
[
{ config: /* theme config */, configFile: /* path/to/theme/config.ts */, cwd: /* path/to/theme */ },
{ config: /* base config */, configFile: /* path/to/base/config.ts */, cwd: /* path/to/base */ },
{ config: /* dev config */, configFile: /* path/to/config.dev.ts */, cwd: /* path/ */ },
{ config: { /* theme config */ }, configFile: "/path/to/theme/config.ts", cwd: "/path/to/theme " },
{ config: { /* base config */ }, configFile: "/path/to/base/config.ts", cwd: "/path/to/base" },
{ config: { /* dev config */ }, configFile: "/path/to/config.dev.ts", cwd: "/path/" },
]
```

Expand Down Expand Up @@ -298,7 +298,7 @@ c12 tries to match [`envName`](#envname) and override environment config if spec
**Example:**

```js
{
export default {
// Default configuration
logLevel: 'info',

Expand Down
5 changes: 2 additions & 3 deletions src/dotenv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface DotenvOptions {
/**
* An object describing environment variables (key, value pairs).
*/
// eslint-disable-next-line no-undef

env?: NodeJS.ProcessEnv;
}

Expand Down Expand Up @@ -112,14 +112,13 @@ function interpolate(

if (prefix === "\\") {
replacePart = parts[0] || "";
value = replacePart.replace("\\$", "$");
value = replacePart.replace(String.raw`\$`, "$");
} else {
const key = parts[2];
replacePart = (parts[0] || "").slice(prefix.length);

// Avoid recursion
if (parents.includes(key)) {
// eslint-disable-next-line no-console
console.warn(
`Please avoid recursive environment variables ( loop: ${parents.join(
" > ",
Expand Down
8 changes: 5 additions & 3 deletions src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ async function extendConfig<
}
if (typeof extendSource !== "string") {
// TODO: Use error in next major versions
// eslint-disable-next-line no-console

console.warn(
`Cannot extend config from \`${JSON.stringify(
originalExtendSource,
Expand All @@ -227,7 +227,7 @@ async function extendConfig<
const _config = await resolveConfig(extendSource, options, sourceOptions);
if (!_config.config) {
// TODO: Use error in next major versions
// eslint-disable-next-line no-console

console.warn(
`Cannot extend config from \`${extendSource}\` in ${options.cwd}`,
);
Expand Down Expand Up @@ -314,7 +314,9 @@ async function resolveConfig<
const tryResolve = (id: string) => {
try {
return options.jiti!.resolve(id, { paths: [options.cwd!] });
} catch {}
} catch {
// Ignore errors
}
};

// Try resolving as npm package
Expand Down

0 comments on commit 06f21a1

Please sign in to comment.