diff --git a/lib/cascading-config-array-factory.js b/lib/cascading-config-array-factory.js index 147c4d1e..c991c24b 100644 --- a/lib/cascading-config-array-factory.js +++ b/lib/cascading-config-array-factory.js @@ -256,7 +256,8 @@ class CascadingConfigArrayFactory { rulePaths, specificConfigPath, useEslintrc, - builtInRules + builtInRules, + loadRules }); } diff --git a/tests/lib/cascading-config-array-factory.js b/tests/lib/cascading-config-array-factory.js index eb9793a3..d78e9836 100644 --- a/tests/lib/cascading-config-array-factory.js +++ b/tests/lib/cascading-config-array-factory.js @@ -1893,4 +1893,22 @@ describe("CascadingConfigArrayFactory", () => { }); }); }); + + describe("bug fixes", () => { + /* + * Clearing cache would previously error on 'createBaseConfigArray()' call + * with 'TypeError: loadRules is not a function' + * https://github.com/eslint/eslintrc/pull/19 + */ + it("should not error when 'clearCache()' is called with `rulePaths` and 'loadRules' options provided.", () => { + const factory = new CascadingConfigArrayFactory({ + rulePaths: ["./rules"], + loadRules() { + return []; + }, + }); + + factory.clearCache(); + }); + }); });