Skip to content

Commit

Permalink
fix: expose plugin.configs in types (#59)
Browse files Browse the repository at this point in the history
* fix: expose `plugin.configs` in types

* declare empty `plugins` object

* use assignment
  • Loading branch information
fasttime authored Nov 20, 2024
1 parent 659bbeb commit 1fd0452
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,22 @@ const plugin = {
"no-empty-keys": noEmptyKeys,
"no-unsafe-values": noUnsafeValues,
},
configs: {},
};

Object.assign(plugin.configs, {
recommended: {
plugins: { json: plugin },
rules: {
"json/no-duplicate-keys": "error",
"json/no-empty-keys": "error",
"json/no-unsafe-values": "error",
configs: {
recommended: {
plugins: {},
rules: {
"json/no-duplicate-keys": "error",
"json/no-empty-keys": "error",
"json/no-unsafe-values": "error",
},
},
},
});
};

// eslint-disable-next-line no-lone-blocks -- The block syntax { ... } ensures that TypeScript does not get confused about the type of `plugin`.
{
plugin.configs.recommended.plugins.json = plugin;
}

export default plugin;
export { JSONLanguage, JSONSourceCode };

0 comments on commit 1fd0452

Please sign in to comment.