From ad729f0c60d42a84b2c87da52a6d2456b5211b48 Mon Sep 17 00:00:00 2001 From: Steve Dodier-Lazaro Date: Tue, 20 Aug 2024 23:21:10 +0200 Subject: [PATCH] feat: Export internal constructs for other plugin authors (#17) --- src/index.js | 2 ++ tests/package/exports.js | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/package/exports.js diff --git a/src/index.js b/src/index.js index f1fc665..061887a 100644 --- a/src/index.js +++ b/src/index.js @@ -8,6 +8,7 @@ //----------------------------------------------------------------------------- import { JSONLanguage } from "./languages/json-language.js"; +import { JSONSourceCode } from "./languages/json-source-code.js"; import noDuplicateKeys from "./rules/no-duplicate-keys.js"; import noEmptyKeys from "./rules/no-empty-keys.js"; @@ -43,3 +44,4 @@ Object.assign(plugin.configs, { }); export default plugin; +export { JSONLanguage, JSONSourceCode }; diff --git a/tests/package/exports.js b/tests/package/exports.js new file mode 100644 index 0000000..69a8878 --- /dev/null +++ b/tests/package/exports.js @@ -0,0 +1,34 @@ +/** + * @fileoverview Tests for the package index's exports. + * @author Steve Dodier-Lazaro + */ + +//------------------------------------------------------------------------------ +// Imports +//------------------------------------------------------------------------------ + +import * as exports from "../../src/index.js"; +import assert from "node:assert"; + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +describe("Package exports", () => { + it("has the ESLint plugin as a default export", () => { + assert.deepStrictEqual(Object.keys(exports.default), [ + "meta", + "languages", + "rules", + "configs", + ]); + }); + + it("has a JSONLanguage export", () => { + assert.ok(exports.JSONLanguage); + }); + + it("has a JSONSourceCode export", () => { + assert.ok(exports.JSONSourceCode); + }); +});