Skip to content

Commit 648e6d2

Browse files
authored
Merge pull request #5351 from NomicFoundation/no-relative-packages
Enable import/no-relative-packages and fix an instance of it
2 parents ca8de61 + 3c738bc commit 648e6d2

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

config-v-next/eslint.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ function createConfig(configFilePath, packageEntryPoints = []) {
278278
},
279279
],
280280
"import/no-duplicates": "error",
281+
"import/no-relative-packages": "error",
281282
"no-bitwise": "error",
282283
"no-caller": "error",
283284
"no-cond-assign": "error",

v-next/hardhat/src/internal/helpers/config-loading.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { HardhatError } from "@nomicfoundation/hardhat-errors";
55
import { findUp } from "@nomicfoundation/hardhat-utils/fs";
66
import { isObject } from "@nomicfoundation/hardhat-utils/lang";
77

8-
import { ERRORS } from "../../../../hardhat-errors/src/descriptors.js";
9-
108
async function findClosestHardhatConfig(): Promise<string> {
119
let hardhatConfigPath = await findUp("hardhat.config.ts");
1210

@@ -20,7 +18,7 @@ async function findClosestHardhatConfig(): Promise<string> {
2018
return hardhatConfigPath;
2119
}
2220

23-
throw new HardhatError(ERRORS.GENERAL.NO_CONFIG_FILE_FOUND);
21+
throw new HardhatError(HardhatError.ERRORS.GENERAL.NO_CONFIG_FILE_FOUND);
2422
}
2523

2624
export async function resolveConfigPath(): Promise<string> {
@@ -41,19 +39,23 @@ export async function importUserConfig(configPath: string) {
4139
const { exists } = await import("@nomicfoundation/hardhat-utils/fs");
4240

4341
if (!(await exists(normalizedPath))) {
44-
throw new HardhatError(ERRORS.GENERAL.INVALID_CONFIG_PATH, { configPath });
42+
throw new HardhatError(HardhatError.ERRORS.GENERAL.INVALID_CONFIG_PATH, {
43+
configPath,
44+
});
4545
}
4646

4747
const imported = await import(pathToFileURL(normalizedPath).href);
4848

4949
if (!("default" in imported)) {
50-
throw new HardhatError(ERRORS.GENERAL.NO_CONFIG_EXPORTED, { configPath });
50+
throw new HardhatError(HardhatError.ERRORS.GENERAL.NO_CONFIG_EXPORTED, {
51+
configPath,
52+
});
5153
}
5254

5355
const config = imported.default;
5456

5557
if (!isObject(config) || config === null) {
56-
throw new HardhatError(ERRORS.GENERAL.INVALID_CONFIG_OBJECT, {
58+
throw new HardhatError(HardhatError.ERRORS.GENERAL.INVALID_CONFIG_OBJECT, {
5759
configPath,
5860
});
5961
}

0 commit comments

Comments
 (0)