Skip to content

Commit

Permalink
Fix: include loadRules in internalSlotsMap cache (#19)
Browse files Browse the repository at this point in the history
* Fix: include loadRules in internalSlotsMap cache

* add unit test
  • Loading branch information
henryqdineen authored Dec 3, 2020
1 parent f30bb49 commit 1746840
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/cascading-config-array-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ class CascadingConfigArrayFactory {
rulePaths,
specificConfigPath,
useEslintrc,
builtInRules
builtInRules,
loadRules
});
}

Expand Down
18 changes: 18 additions & 0 deletions tests/lib/cascading-config-array-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
});

0 comments on commit 1746840

Please sign in to comment.