Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve types for Config #93

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/rules/custom.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Logger from "../lib/logger.js";
const logger = Logger("rule:custom");

/** @typedef {import('cheerio').Cheerio<import('domhandler').Document>} Cheerio */
/** @typedef {import("../lib/reporter.js")} Reporter */
/** @typedef {import("../lib/parse.js").AST} AST */
/** @typedef {import("../lib/parse.js").Node} Node */
Expand All @@ -11,6 +12,7 @@ const logger = Logger("rule:custom");
* @param {Reporter} reporter The reporter to report to
* @param {Cheerio} $ A cheerio representation of the document
* @param {AST} ast The AST of the document, which we should pass to reporter
* @param {Info} info Info related to the current file being linted
*/
/**
* @typedef {CustomRule} CustomConfig
Expand Down
8 changes: 7 additions & 1 deletion src/svglint.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ const logger = Logger("");

/** @typedef {import("./lib/parse.js").AST} AST */
/** @typedef {import("./lib/rule-loader.js").RuleModule} RuleModule */
/** @typedef {import("./rules/elm.js").ElmConfig} ElmConfig */
/** @typedef {import("./rules/attr.js").AttrConfig} AttrConfig */
/** @typedef {import("./rules/custom.js").CustomConfig} CustomConfig */

/**
* @typedef {Object<string,any>} RulesConfig
* @typedef RulesConfig
* An object with each key representing a rule name, and each value representing
* a rule config.
* If the rule config is set to `false`, then the rule is disabled (useful for
* e.g. overwriting presets).
* @property {ElmConfig} [elm={}]
* @property {Array<AttrConfig>} [attr=[]]
* @property {Array<CustomConfig>} [custom=[]]
*/
/**
* @typedef {Object<string,Function|Function[]>} NormalizedRules
Expand Down
Loading