From 623ed23fab42fd4fa494d9765787b81fed6ac95e Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Fri, 28 Jun 2024 14:33:09 +0000 Subject: [PATCH] Remove the rules from the config and source code --- config-v-next/eslint.cjs | 22 +------------------ v-next/core/.eslintrc.cjs | 2 +- v-next/hardhat-build-system/.eslintrc.cjs | 2 +- .../src/internal/solidity/parse.ts | 1 - .../src/internal/solidity/resolver.ts | 2 -- .../src/internal/tasks.ts | 3 --- .../src/internal/utils/artifacts.ts | 2 -- .../src/internal/utils/fs-utils.ts | 10 --------- .../src/internal/utils/source-names.ts | 2 -- v-next/hardhat-errors/.eslintrc.cjs | 2 +- .../hardhat-node-test-reporter/.eslintrc.cjs | 2 +- v-next/hardhat-utils/.eslintrc.cjs | 2 +- v-next/hardhat-zod-utils/.eslintrc.cjs | 2 +- v-next/hardhat/.eslintrc.cjs | 2 +- v-next/template-package/.eslintrc.cjs | 5 +---- 15 files changed, 9 insertions(+), 52 deletions(-) diff --git a/config-v-next/eslint.cjs b/config-v-next/eslint.cjs index 7b609ae3b7..d7c4c94f41 100644 --- a/config-v-next/eslint.cjs +++ b/config-v-next/eslint.cjs @@ -10,10 +10,9 @@ const path = require("path"); * The only packages that should not use this config are our own eslint plugins/rules. * * @param {string} configFilePath The path to the config file that is using this function. - * @param {string[]} [packageEntryPoints=[]] The entry points of the package, expressed as relative paths from the config file. * @returns {import("eslint").Linter.Config} */ -function createConfig(configFilePath, packageEntryPoints = []) { +function createConfig(configFilePath) { /** * @type {import("eslint").Linter.Config} */ @@ -23,7 +22,6 @@ function createConfig(configFilePath, packageEntryPoints = []) { es2022: true, node: true, }, - extends: ["plugin:@nomicfoundation/slow-imports/recommended"], settings: { "import/resolver": { typescript: true, @@ -36,11 +34,9 @@ function createConfig(configFilePath, packageEntryPoints = []) { tsconfigRootDir: path.dirname(configFilePath), }, plugins: [ - "@nomicfoundation/hardhat-internal-rules", "import", "no-only-tests", "@typescript-eslint", - "@nomicfoundation/slow-imports", "@eslint-community/eslint-comments", ], rules: { @@ -392,22 +388,6 @@ function createConfig(configFilePath, packageEntryPoints = []) { ], }; - // TODO: Maybe re-enable it once we have a more stable project structure - // if (packageEntryPoints.length > 0) { - // const acceptableTopLevelImports = []; - // config.overrides?.push({ - // files: packageEntryPoints, - // rules: { - // "@nomicfoundation/slow-imports/no-top-level-external-import": [ - // "error", - // { - // ignoreModules: [...acceptableTopLevelImports], - // }, - // ], - // }, - // }); - // } - return config; } diff --git a/v-next/core/.eslintrc.cjs b/v-next/core/.eslintrc.cjs index acf97c3303..939317ab1c 100644 --- a/v-next/core/.eslintrc.cjs +++ b/v-next/core/.eslintrc.cjs @@ -1,3 +1,3 @@ const { createConfig } = require("../../config-v-next/eslint.cjs"); -module.exports = createConfig(__filename, ["src/index.ts"]); +module.exports = createConfig(__filename); diff --git a/v-next/hardhat-build-system/.eslintrc.cjs b/v-next/hardhat-build-system/.eslintrc.cjs index acf97c3303..939317ab1c 100644 --- a/v-next/hardhat-build-system/.eslintrc.cjs +++ b/v-next/hardhat-build-system/.eslintrc.cjs @@ -1,3 +1,3 @@ const { createConfig } = require("../../config-v-next/eslint.cjs"); -module.exports = createConfig(__filename, ["src/index.ts"]); +module.exports = createConfig(__filename); diff --git a/v-next/hardhat-build-system/src/internal/solidity/parse.ts b/v-next/hardhat-build-system/src/internal/solidity/parse.ts index 2c7e0a81c6..57b8fb22ee 100644 --- a/v-next/hardhat-build-system/src/internal/solidity/parse.ts +++ b/v-next/hardhat-build-system/src/internal/solidity/parse.ts @@ -46,7 +46,6 @@ export class Parser { throw new HardhatError(HardhatError.ERRORS.GENERAL.CORRUPTED_LOCKFILE); } - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw e; } } diff --git a/v-next/hardhat-build-system/src/internal/solidity/resolver.ts b/v-next/hardhat-build-system/src/internal/solidity/resolver.ts index c572650978..783990bfb7 100644 --- a/v-next/hardhat-build-system/src/internal/solidity/resolver.ts +++ b/v-next/hardhat-build-system/src/internal/solidity/resolver.ts @@ -298,7 +298,6 @@ export class Resolver { ); } - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw error; } } @@ -579,7 +578,6 @@ export class Resolver { ); } - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw error; } } diff --git a/v-next/hardhat-build-system/src/internal/tasks.ts b/v-next/hardhat-build-system/src/internal/tasks.ts index e668d8a29c..223fb2653d 100644 --- a/v-next/hardhat-build-system/src/internal/tasks.ts +++ b/v-next/hardhat-build-system/src/internal/tasks.ts @@ -125,7 +125,6 @@ export async function taskCompileSolidityReadFile( ); } - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw e; } } @@ -1102,7 +1101,6 @@ export async function taskCompileSolidityCompileJobs( return { artifactsEmittedPerJob }; } catch (e) { if (!(e instanceof AggregateError)) { - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw e; } @@ -1113,7 +1111,6 @@ export async function taskCompileSolidityCompileJobs( HardhatError.ERRORS.BUILTIN_TASKS.COMPILE_FAILURE, ) ) { - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw error; } } diff --git a/v-next/hardhat-build-system/src/internal/utils/artifacts.ts b/v-next/hardhat-build-system/src/internal/utils/artifacts.ts index 391be39084..d1090be908 100644 --- a/v-next/hardhat-build-system/src/internal/utils/artifacts.ts +++ b/v-next/hardhat-build-system/src/internal/utils/artifacts.ts @@ -94,7 +94,6 @@ export class Artifacts implements IArtifacts { return false; } - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw e; } @@ -590,7 +589,6 @@ export class Artifacts implements IArtifacts { ); } - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw e; } } diff --git a/v-next/hardhat-build-system/src/internal/utils/fs-utils.ts b/v-next/hardhat-build-system/src/internal/utils/fs-utils.ts index b90ec029f9..0c29a0ecff 100644 --- a/v-next/hardhat-build-system/src/internal/utils/fs-utils.ts +++ b/v-next/hardhat-build-system/src/internal/utils/fs-utils.ts @@ -52,11 +52,9 @@ async function readdir(absolutePathToDir: string) { } if (e.code === "ENOTDIR") { - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw new InvalidDirectoryError(absolutePathToDir, e); } - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw new FileSystemAccessError(e.message, e); } } @@ -106,7 +104,6 @@ export async function getFileTrueCase( } } - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw new FileNotFoundError(path.join(from, relativePath)); } @@ -156,11 +153,9 @@ function readdirSync(absolutePathToDir: string) { } if (e.code === "ENOTDIR") { - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw new InvalidDirectoryError(absolutePathToDir, e); } - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw new FileSystemAccessError(e.message, e); } } @@ -201,7 +196,6 @@ export function getFileTrueCaseSync( } } - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw new FileNotFoundError(path.join(from, relativePath)); } @@ -222,11 +216,9 @@ export async function getRealPath(absolutePath: string): Promise { } if (e.code === "ENOENT") { - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw new FileNotFoundError(absolutePath, e); } - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw new FileSystemAccessError(e.message, e); } } @@ -248,11 +240,9 @@ export function getRealPathSync(absolutePath: string): string { } if (e.code === "ENOENT") { - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw new FileNotFoundError(absolutePath, e); } - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw new FileSystemAccessError(e.message, e); } } diff --git a/v-next/hardhat-build-system/src/internal/utils/source-names.ts b/v-next/hardhat-build-system/src/internal/utils/source-names.ts index da09b41179..925fe1de3b 100644 --- a/v-next/hardhat-build-system/src/internal/utils/source-names.ts +++ b/v-next/hardhat-build-system/src/internal/utils/source-names.ts @@ -70,7 +70,6 @@ async function getSourceNameTrueCase( ); } - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw error; } } @@ -157,7 +156,6 @@ export async function isLocalSourceName( return false; } - // eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error throw error; } diff --git a/v-next/hardhat-errors/.eslintrc.cjs b/v-next/hardhat-errors/.eslintrc.cjs index acf97c3303..939317ab1c 100644 --- a/v-next/hardhat-errors/.eslintrc.cjs +++ b/v-next/hardhat-errors/.eslintrc.cjs @@ -1,3 +1,3 @@ const { createConfig } = require("../../config-v-next/eslint.cjs"); -module.exports = createConfig(__filename, ["src/index.ts"]); +module.exports = createConfig(__filename); diff --git a/v-next/hardhat-node-test-reporter/.eslintrc.cjs b/v-next/hardhat-node-test-reporter/.eslintrc.cjs index 86d70ad01c..f7e5ff4aa6 100644 --- a/v-next/hardhat-node-test-reporter/.eslintrc.cjs +++ b/v-next/hardhat-node-test-reporter/.eslintrc.cjs @@ -1,6 +1,6 @@ const { createConfig } = require("../../config-v-next/eslint.cjs"); -module.exports = createConfig(__filename, ["src/reporter.ts"]); +module.exports = createConfig(__filename); module.exports.overrides.push({ files: ["integration-tests/**/*.ts"], diff --git a/v-next/hardhat-utils/.eslintrc.cjs b/v-next/hardhat-utils/.eslintrc.cjs index acf97c3303..939317ab1c 100644 --- a/v-next/hardhat-utils/.eslintrc.cjs +++ b/v-next/hardhat-utils/.eslintrc.cjs @@ -1,3 +1,3 @@ const { createConfig } = require("../../config-v-next/eslint.cjs"); -module.exports = createConfig(__filename, ["src/index.ts"]); +module.exports = createConfig(__filename); diff --git a/v-next/hardhat-zod-utils/.eslintrc.cjs b/v-next/hardhat-zod-utils/.eslintrc.cjs index acf97c3303..939317ab1c 100644 --- a/v-next/hardhat-zod-utils/.eslintrc.cjs +++ b/v-next/hardhat-zod-utils/.eslintrc.cjs @@ -1,3 +1,3 @@ const { createConfig } = require("../../config-v-next/eslint.cjs"); -module.exports = createConfig(__filename, ["src/index.ts"]); +module.exports = createConfig(__filename); diff --git a/v-next/hardhat/.eslintrc.cjs b/v-next/hardhat/.eslintrc.cjs index acf97c3303..939317ab1c 100644 --- a/v-next/hardhat/.eslintrc.cjs +++ b/v-next/hardhat/.eslintrc.cjs @@ -1,3 +1,3 @@ const { createConfig } = require("../../config-v-next/eslint.cjs"); -module.exports = createConfig(__filename, ["src/index.ts"]); +module.exports = createConfig(__filename); diff --git a/v-next/template-package/.eslintrc.cjs b/v-next/template-package/.eslintrc.cjs index e39f56f730..939317ab1c 100644 --- a/v-next/template-package/.eslintrc.cjs +++ b/v-next/template-package/.eslintrc.cjs @@ -1,6 +1,3 @@ const { createConfig } = require("../../config-v-next/eslint.cjs"); -module.exports = createConfig(__filename, [ - "src/index.ts", - "src/other-entry-point.ts", -]); +module.exports = createConfig(__filename);