pickier 0.1.25 → 0.1.26
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/dist/bin/cli.js +20 -6
- package/dist/src/index.js +19 -5
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -4635,15 +4635,16 @@ async function getConfig() {
|
|
|
4635
4635
|
if (!_config) {
|
|
4636
4636
|
_config = await loadConfig({
|
|
4637
4637
|
name: "pickier",
|
|
4638
|
-
alias:
|
|
4638
|
+
alias: [...CONFIG_ALIASES],
|
|
4639
4639
|
defaultConfig: defaultConfig2
|
|
4640
4640
|
});
|
|
4641
4641
|
}
|
|
4642
4642
|
return _config;
|
|
4643
4643
|
}
|
|
4644
|
-
var defaultConfig2, _config = null, config3;
|
|
4644
|
+
var CONFIG_ALIASES, defaultConfig2, _config = null, config3;
|
|
4645
4645
|
var init_config2 = __esm(() => {
|
|
4646
4646
|
init_dist();
|
|
4647
|
+
CONFIG_ALIASES = ["code-style", "lint"];
|
|
4647
4648
|
defaultConfig2 = {
|
|
4648
4649
|
ignores: [
|
|
4649
4650
|
"**/node_modules/**",
|
|
@@ -15555,6 +15556,9 @@ var init_no_unused_vars = __esm(() => {
|
|
|
15555
15556
|
if (ctx.filePath.endsWith("/no-unused-vars.ts")) {
|
|
15556
15557
|
return [];
|
|
15557
15558
|
}
|
|
15559
|
+
if (ctx.filePath.endsWith(".d.ts")) {
|
|
15560
|
+
return [];
|
|
15561
|
+
}
|
|
15558
15562
|
const issues = [];
|
|
15559
15563
|
const opts = ctx.options || {};
|
|
15560
15564
|
const varsIgnorePattern = typeof opts.varsIgnorePattern === "string" ? opts.varsIgnorePattern : "^_";
|
|
@@ -16437,6 +16441,10 @@ var init_no_unused_vars = __esm(() => {
|
|
|
16437
16441
|
if (afterFunc.startsWith(":")) {
|
|
16438
16442
|
continue;
|
|
16439
16443
|
}
|
|
16444
|
+
const beforeFunc = codeClean.slice(0, m.index).trimEnd();
|
|
16445
|
+
if (beforeFunc.endsWith(".") || beforeFunc.endsWith("?.")) {
|
|
16446
|
+
continue;
|
|
16447
|
+
}
|
|
16440
16448
|
const funcIdx = m.index;
|
|
16441
16449
|
const openParenIdx = line.indexOf("(", funcIdx);
|
|
16442
16450
|
if (openParenIdx === -1)
|
|
@@ -33622,7 +33630,9 @@ function scanContentOptimized(filePath, content, cfg, suppress, commentLines) {
|
|
|
33622
33630
|
const fileExt = filePath.split(".").pop()?.toLowerCase() ?? "";
|
|
33623
33631
|
const isMd = fileExt === "md";
|
|
33624
33632
|
const isShell = fileExt === "sh" || fileExt === "bash" || fileExt === "zsh" || fileExt === "ksh" || fileExt === "dash" || /^#!\s*(?:\/usr\/bin\/env\s+)?(?:ba|z|k|da)?sh\b/.test(content);
|
|
33625
|
-
const
|
|
33633
|
+
const quotesRuleSetting = cfg.rules?.quotes ?? cfg.pluginRules?.quotes ?? cfg.pluginRules?.["style/quotes"];
|
|
33634
|
+
const quotesDisabled = quotesRuleSetting === "off";
|
|
33635
|
+
const skipQuotesCheck = quotesDisabled || fileExt === "json" || fileExt === "jsonc" || fileExt === "lock" || isMd || fileExt === "yaml" || fileExt === "yml" || fileExt === "stx" || fileExt === "html" || fileExt === "htm" || fileExt === "vue" || isShell || filePath.endsWith("bun.lock");
|
|
33626
33636
|
const skipCodeRules = isMd || fileExt === "yaml" || fileExt === "yml" || fileExt === "json" || fileExt === "jsonc" || isShell;
|
|
33627
33637
|
let quotesReported = false;
|
|
33628
33638
|
const sevMap = (s) => s === "warn" ? "warning" : s === "error" ? "error" : undefined;
|
|
@@ -33690,9 +33700,12 @@ function scanContentOptimized(filePath, content, cfg, suppress, commentLines) {
|
|
|
33690
33700
|
quotesReported = true;
|
|
33691
33701
|
}
|
|
33692
33702
|
}
|
|
33703
|
+
const indentRuleSetting = cfg.rules?.indent ?? cfg.pluginRules?.indent ?? cfg.pluginRules?.["style/indent"];
|
|
33704
|
+
const indentDisabled = indentRuleSetting === "off";
|
|
33705
|
+
const isTemplate = fileExt === "stx" || fileExt === "html" || fileExt === "htm" || fileExt === "vue";
|
|
33693
33706
|
const leadingMatch = line.match(/^[ \t]*/);
|
|
33694
33707
|
const leading = leadingMatch ? leadingMatch[0] : "";
|
|
33695
|
-
if (!isMd && leading.length > 0 && !linesInFencedCodeBlock.has(lineNo) && hasIndentIssue(leading, cfg.format.indent, cfg.format.indentStyle, line)) {
|
|
33708
|
+
if (!indentDisabled && !isMd && !isTemplate && leading.length > 0 && !linesInFencedCodeBlock.has(lineNo) && hasIndentIssue(leading, cfg.format.indent, cfg.format.indentStyle, line)) {
|
|
33696
33709
|
if (!isSuppressed("indent", lineNo, suppress))
|
|
33697
33710
|
issues.push({ filePath, line: lineNo, column: 1, ruleId: "indent", message: "Incorrect indentation detected", severity: "warning", help: `Use ${cfg.format.indentStyle === "spaces" ? `${cfg.format.indent} spaces` : "tabs"} for indentation. Configure with format.indent and format.indentStyle in your config` });
|
|
33698
33711
|
}
|
|
@@ -34267,7 +34280,8 @@ async function runUnified(globs, options) {
|
|
|
34267
34280
|
};
|
|
34268
34281
|
return runLint2(globs, lintOpts2);
|
|
34269
34282
|
}
|
|
34270
|
-
|
|
34283
|
+
const wantsFix = options.fix === true || options.write === true || options.check === true;
|
|
34284
|
+
if (!wantsFix)
|
|
34271
34285
|
return runLint2(globs, options);
|
|
34272
34286
|
const lintOpts = {
|
|
34273
34287
|
...options,
|
|
@@ -38085,7 +38099,7 @@ var require_package = __commonJS((exports, module) => {
|
|
|
38085
38099
|
module.exports = {
|
|
38086
38100
|
name: "pickier",
|
|
38087
38101
|
type: "module",
|
|
38088
|
-
version: "0.1.
|
|
38102
|
+
version: "0.1.26",
|
|
38089
38103
|
description: "Format, lint and more in a fraction of seconds.",
|
|
38090
38104
|
author: "Chris Breuer <chris@stacksjs.org>",
|
|
38091
38105
|
license: "MIT",
|
package/dist/src/index.js
CHANGED
|
@@ -3648,15 +3648,16 @@ async function getConfig() {
|
|
|
3648
3648
|
if (!_config) {
|
|
3649
3649
|
_config = await loadConfig({
|
|
3650
3650
|
name: "pickier",
|
|
3651
|
-
alias:
|
|
3651
|
+
alias: [...CONFIG_ALIASES],
|
|
3652
3652
|
defaultConfig: defaultConfig2
|
|
3653
3653
|
});
|
|
3654
3654
|
}
|
|
3655
3655
|
return _config;
|
|
3656
3656
|
}
|
|
3657
|
-
var defaultConfig2, _config = null, config3;
|
|
3657
|
+
var CONFIG_ALIASES, defaultConfig2, _config = null, config3;
|
|
3658
3658
|
var init_config2 = __esm(() => {
|
|
3659
3659
|
init_dist();
|
|
3660
|
+
CONFIG_ALIASES = ["code-style", "lint"];
|
|
3660
3661
|
defaultConfig2 = {
|
|
3661
3662
|
ignores: [
|
|
3662
3663
|
"**/node_modules/**",
|
|
@@ -15172,6 +15173,9 @@ var init_no_unused_vars = __esm(() => {
|
|
|
15172
15173
|
if (ctx.filePath.endsWith("/no-unused-vars.ts")) {
|
|
15173
15174
|
return [];
|
|
15174
15175
|
}
|
|
15176
|
+
if (ctx.filePath.endsWith(".d.ts")) {
|
|
15177
|
+
return [];
|
|
15178
|
+
}
|
|
15175
15179
|
const issues = [];
|
|
15176
15180
|
const opts = ctx.options || {};
|
|
15177
15181
|
const varsIgnorePattern = typeof opts.varsIgnorePattern === "string" ? opts.varsIgnorePattern : "^_";
|
|
@@ -16054,6 +16058,10 @@ var init_no_unused_vars = __esm(() => {
|
|
|
16054
16058
|
if (afterFunc.startsWith(":")) {
|
|
16055
16059
|
continue;
|
|
16056
16060
|
}
|
|
16061
|
+
const beforeFunc = codeClean.slice(0, m.index).trimEnd();
|
|
16062
|
+
if (beforeFunc.endsWith(".") || beforeFunc.endsWith("?.")) {
|
|
16063
|
+
continue;
|
|
16064
|
+
}
|
|
16057
16065
|
const funcIdx = m.index;
|
|
16058
16066
|
const openParenIdx = line.indexOf("(", funcIdx);
|
|
16059
16067
|
if (openParenIdx === -1)
|
|
@@ -33621,7 +33629,9 @@ function scanContentOptimized(filePath, content, cfg, suppress, commentLines) {
|
|
|
33621
33629
|
const fileExt = filePath.split(".").pop()?.toLowerCase() ?? "";
|
|
33622
33630
|
const isMd = fileExt === "md";
|
|
33623
33631
|
const isShell = fileExt === "sh" || fileExt === "bash" || fileExt === "zsh" || fileExt === "ksh" || fileExt === "dash" || /^#!\s*(?:\/usr\/bin\/env\s+)?(?:ba|z|k|da)?sh\b/.test(content);
|
|
33624
|
-
const
|
|
33632
|
+
const quotesRuleSetting = cfg.rules?.quotes ?? cfg.pluginRules?.quotes ?? cfg.pluginRules?.["style/quotes"];
|
|
33633
|
+
const quotesDisabled = quotesRuleSetting === "off";
|
|
33634
|
+
const skipQuotesCheck = quotesDisabled || fileExt === "json" || fileExt === "jsonc" || fileExt === "lock" || isMd || fileExt === "yaml" || fileExt === "yml" || fileExt === "stx" || fileExt === "html" || fileExt === "htm" || fileExt === "vue" || isShell || filePath.endsWith("bun.lock");
|
|
33625
33635
|
const skipCodeRules = isMd || fileExt === "yaml" || fileExt === "yml" || fileExt === "json" || fileExt === "jsonc" || isShell;
|
|
33626
33636
|
let quotesReported = false;
|
|
33627
33637
|
const sevMap = (s) => s === "warn" ? "warning" : s === "error" ? "error" : undefined;
|
|
@@ -33689,9 +33699,12 @@ function scanContentOptimized(filePath, content, cfg, suppress, commentLines) {
|
|
|
33689
33699
|
quotesReported = true;
|
|
33690
33700
|
}
|
|
33691
33701
|
}
|
|
33702
|
+
const indentRuleSetting = cfg.rules?.indent ?? cfg.pluginRules?.indent ?? cfg.pluginRules?.["style/indent"];
|
|
33703
|
+
const indentDisabled = indentRuleSetting === "off";
|
|
33704
|
+
const isTemplate = fileExt === "stx" || fileExt === "html" || fileExt === "htm" || fileExt === "vue";
|
|
33692
33705
|
const leadingMatch = line.match(/^[ \t]*/);
|
|
33693
33706
|
const leading = leadingMatch ? leadingMatch[0] : "";
|
|
33694
|
-
if (!isMd && leading.length > 0 && !linesInFencedCodeBlock.has(lineNo) && hasIndentIssue(leading, cfg.format.indent, cfg.format.indentStyle, line)) {
|
|
33707
|
+
if (!indentDisabled && !isMd && !isTemplate && leading.length > 0 && !linesInFencedCodeBlock.has(lineNo) && hasIndentIssue(leading, cfg.format.indent, cfg.format.indentStyle, line)) {
|
|
33695
33708
|
if (!isSuppressed("indent", lineNo, suppress))
|
|
33696
33709
|
issues.push({ filePath, line: lineNo, column: 1, ruleId: "indent", message: "Incorrect indentation detected", severity: "warning", help: `Use ${cfg.format.indentStyle === "spaces" ? `${cfg.format.indent} spaces` : "tabs"} for indentation. Configure with format.indent and format.indentStyle in your config` });
|
|
33697
33710
|
}
|
|
@@ -34266,7 +34279,8 @@ async function runUnified(globs, options) {
|
|
|
34266
34279
|
};
|
|
34267
34280
|
return runLint2(globs, lintOpts2);
|
|
34268
34281
|
}
|
|
34269
|
-
|
|
34282
|
+
const wantsFix = options.fix === true || options.write === true || options.check === true;
|
|
34283
|
+
if (!wantsFix)
|
|
34270
34284
|
return runLint2(globs, options);
|
|
34271
34285
|
const lintOpts = {
|
|
34272
34286
|
...options,
|