Skip to content

Commit

Permalink
Fix packageDir for allowed dependencies plugin - make it work from an…
Browse files Browse the repository at this point in the history
…y cwd.
  • Loading branch information
RobinTail committed Feb 8, 2025
1 parent e08ee4e commit ce88fab
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import prettierOverrides from "eslint-config-prettier";
import prettierRules from "eslint-plugin-prettier/recommended";
import unicornPlugin from "eslint-plugin-unicorn";
import allowedDepsPlugin from "eslint-plugin-allowed-dependencies";
import { fileURLToPath } from "node:url";
import { dirname, join } from "node:path";

const packageDir = join(
dirname(fileURLToPath(import.meta.url)),
"express-zod-api",
);

const peformanceConcerns = [
{
Expand Down Expand Up @@ -171,7 +178,7 @@ export default tsPlugin.config(
rules: {
"allowed/dependencies": [
"error",
{ typeOnly: ["eslint", "prettier"], packageDir: "express-zod-api" },
{ typeOnly: ["eslint", "prettier"], packageDir },
],
"no-restricted-syntax": ["warn", ...peformanceConcerns],
},
Expand Down Expand Up @@ -204,10 +211,7 @@ export default tsPlugin.config(
rules: {
"allowed/dependencies": [
"error",
{
ignore: ["^@typescript-eslint", "^\\."],
packageDir: "express-zod-api",
},
{ ignore: ["^@typescript-eslint", "^\\."], packageDir },
],
},
},
Expand Down

0 comments on commit ce88fab

Please sign in to comment.