Skip to content

Commit b1e8fb9

Browse files
committed
config: append, not overwrite RULES_DIR
1 parent 8bf251f commit b1e8fb9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/config/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ import { formattingRules } from "./formatting";
77
import { overrides } from "./overrides";
88
import { otherRules } from "./other";
99

10-
rulesDirPlugin.RULES_DIR = [
10+
// Merge, not overwrite.
11+
// Otherwise in some setups the order of file loading is wrong and
12+
// we overwrite RULES_DIR configured elsewhere.
13+
const previousRulesDir =
14+
typeof rulesDirPlugin.RULES_DIR === "string"
15+
? [rulesDirPlugin.RULES_DIR]
16+
: (rulesDirPlugin.RULES_DIR ?? []);
17+
rulesDirPlugin.RULES_DIR = previousRulesDir.concat([
1118
// Relative to the individual project’s root
1219
".eslint/custom-rules",
13-
];
20+
]);
1421

1522
export const main = {
1623
env: {

0 commit comments

Comments
 (0)