@diplodoc/yfmlint 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +1 -1
- package/build/index.js +30 -19
- package/build/index.js.map +2 -2
- package/build/utils.d.ts +2 -2
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { LintError, Options } from './typings';
|
|
2
|
-
export { LogLevels, log, normalizeConfig } from './utils';
|
|
2
|
+
export { LogLevels, log, getLogLevel, normalizeConfig } from './utils';
|
|
3
3
|
export declare function yfmlint(content: string, path: string, opts: Options): Promise<LintError[] | undefined>;
|
package/build/index.js
CHANGED
|
@@ -21336,6 +21336,7 @@ var init_exports_promise = __esm({
|
|
|
21336
21336
|
var src_exports = {};
|
|
21337
21337
|
__export(src_exports, {
|
|
21338
21338
|
LogLevels: () => LogLevels,
|
|
21339
|
+
getLogLevel: () => getLogLevel,
|
|
21339
21340
|
log: () => log,
|
|
21340
21341
|
normalizeConfig: () => normalizeConfig,
|
|
21341
21342
|
yfmlint: () => yfmlint
|
|
@@ -21354,33 +21355,42 @@ var LogLevels = /* @__PURE__ */ ((LogLevels2) => {
|
|
|
21354
21355
|
})(LogLevels || {});
|
|
21355
21356
|
var DEFAULT_LOG_LEVEL = "warn" /* WARN */;
|
|
21356
21357
|
function normalizeConfig(...parts) {
|
|
21358
|
+
const simplify = (config) => {
|
|
21359
|
+
return Object.keys(config).reduce((result, key) => {
|
|
21360
|
+
if (config[key].level === "disabled" /* DISABLED */) {
|
|
21361
|
+
config[key] = false;
|
|
21362
|
+
}
|
|
21363
|
+
return result;
|
|
21364
|
+
}, config);
|
|
21365
|
+
};
|
|
21357
21366
|
const normalized = parts.map((part) => {
|
|
21358
21367
|
return Object.keys(part).reduce((result, key) => {
|
|
21359
21368
|
if (key === "default") {
|
|
21360
21369
|
result[key] = part[key];
|
|
21361
|
-
} else {
|
|
21362
|
-
|
|
21363
|
-
|
|
21364
|
-
|
|
21365
|
-
|
|
21366
|
-
|
|
21367
|
-
|
|
21368
|
-
|
|
21369
|
-
|
|
21370
|
-
|
|
21371
|
-
|
|
21372
|
-
|
|
21373
|
-
|
|
21374
|
-
|
|
21375
|
-
|
|
21376
|
-
|
|
21377
|
-
|
|
21378
|
-
}
|
|
21370
|
+
} else if (typeof part[key] === "boolean") {
|
|
21371
|
+
result[key] = {
|
|
21372
|
+
level: part[key] ? DEFAULT_LOG_LEVEL : "disabled" /* DISABLED */
|
|
21373
|
+
};
|
|
21374
|
+
} else if (part[key] === "disabled" /* DISABLED */) {
|
|
21375
|
+
result[key] = {
|
|
21376
|
+
level: "disabled" /* DISABLED */
|
|
21377
|
+
};
|
|
21378
|
+
} else if (typeof part[key] === "string") {
|
|
21379
|
+
result[key] = {
|
|
21380
|
+
level: part[key]
|
|
21381
|
+
};
|
|
21382
|
+
} else if (part[key] && typeof part[key] === "object") {
|
|
21383
|
+
result[key] = {
|
|
21384
|
+
...part[key],
|
|
21385
|
+
// @ts-ignore
|
|
21386
|
+
level: part[key].level || DEFAULT_LOG_LEVEL
|
|
21387
|
+
};
|
|
21379
21388
|
}
|
|
21380
21389
|
return result;
|
|
21381
21390
|
}, {});
|
|
21382
21391
|
});
|
|
21383
|
-
|
|
21392
|
+
const merged = (0, import_merge.default)({}, ...normalized);
|
|
21393
|
+
return simplify(merged);
|
|
21384
21394
|
}
|
|
21385
21395
|
function getLogLevel(logLevels, ruleNames) {
|
|
21386
21396
|
return ruleNames.map((ruleName) => {
|
|
@@ -21813,6 +21823,7 @@ async function yfmlint(content3, path3, opts) {
|
|
|
21813
21823
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21814
21824
|
0 && (module.exports = {
|
|
21815
21825
|
LogLevels,
|
|
21826
|
+
getLogLevel,
|
|
21816
21827
|
log,
|
|
21817
21828
|
normalizeConfig,
|
|
21818
21829
|
yfmlint
|