Skip to content

Commit

Permalink
Remove the rules from the config and source code
Browse files Browse the repository at this point in the history
  • Loading branch information
alcuadrado authored and kanej committed Jun 28, 2024
1 parent cba5777 commit 623ed23
Show file tree
Hide file tree
Showing 15 changed files with 9 additions and 52 deletions.
22 changes: 1 addition & 21 deletions config-v-next/eslint.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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}
*/
Expand All @@ -23,7 +22,6 @@ function createConfig(configFilePath, packageEntryPoints = []) {
es2022: true,
node: true,
},
extends: ["plugin:@nomicfoundation/slow-imports/recommended"],
settings: {
"import/resolver": {
typescript: true,
Expand All @@ -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: {
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion v-next/core/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const { createConfig } = require("../../config-v-next/eslint.cjs");

module.exports = createConfig(__filename, ["src/index.ts"]);
module.exports = createConfig(__filename);
2 changes: 1 addition & 1 deletion v-next/hardhat-build-system/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const { createConfig } = require("../../config-v-next/eslint.cjs");

module.exports = createConfig(__filename, ["src/index.ts"]);
module.exports = createConfig(__filename);
1 change: 0 additions & 1 deletion v-next/hardhat-build-system/src/internal/solidity/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 0 additions & 2 deletions v-next/hardhat-build-system/src/internal/solidity/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ export class Resolver {
);
}

// eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error
throw error;
}
}
Expand Down Expand Up @@ -579,7 +578,6 @@ export class Resolver {
);
}

// eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error
throw error;
}
}
Expand Down
3 changes: 0 additions & 3 deletions v-next/hardhat-build-system/src/internal/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}
}
Expand Down
2 changes: 0 additions & 2 deletions v-next/hardhat-build-system/src/internal/utils/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
}
Expand Down
10 changes: 0 additions & 10 deletions v-next/hardhat-build-system/src/internal/utils/fs-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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));
}

Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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));
}

Expand All @@ -222,11 +216,9 @@ export async function getRealPath(absolutePath: string): Promise<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);
}
}
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ async function getSourceNameTrueCase(
);
}

// eslint-disable-next-line @nomicfoundation/hardhat-internal-rules/only-hardhat-error -- Re-throwing the error
throw error;
}
}
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion v-next/hardhat-errors/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const { createConfig } = require("../../config-v-next/eslint.cjs");

module.exports = createConfig(__filename, ["src/index.ts"]);
module.exports = createConfig(__filename);
2 changes: 1 addition & 1 deletion v-next/hardhat-node-test-reporter/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -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"],
Expand Down
2 changes: 1 addition & 1 deletion v-next/hardhat-utils/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const { createConfig } = require("../../config-v-next/eslint.cjs");

module.exports = createConfig(__filename, ["src/index.ts"]);
module.exports = createConfig(__filename);
2 changes: 1 addition & 1 deletion v-next/hardhat-zod-utils/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const { createConfig } = require("../../config-v-next/eslint.cjs");

module.exports = createConfig(__filename, ["src/index.ts"]);
module.exports = createConfig(__filename);
2 changes: 1 addition & 1 deletion v-next/hardhat/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const { createConfig } = require("../../config-v-next/eslint.cjs");

module.exports = createConfig(__filename, ["src/index.ts"]);
module.exports = createConfig(__filename);
5 changes: 1 addition & 4 deletions v-next/template-package/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 623ed23

Please sign in to comment.