pickier 0.1.25 → 0.1.27

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 CHANGED
@@ -4635,15 +4635,16 @@ async function getConfig() {
4635
4635
  if (!_config) {
4636
4636
  _config = await loadConfig({
4637
4637
  name: "pickier",
4638
- alias: "code-style",
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)
@@ -26549,7 +26557,7 @@ function ensureLoaded() {
26549
26557
  if (_loaded)
26550
26558
  return _available;
26551
26559
  try {
26552
- _tssc = (()=>{throw new Error("Cannot require module "+"ts-spell-check");})();
26560
+ _tssc = (()=>{throw new Error("Cannot require module "+"@stacksjs/ts-spell-check");})();
26553
26561
  _tssc.SpellChecker.create({ minWordLength: 3, maxSuggestions: 3 }).then((c) => {
26554
26562
  _checker = c;
26555
26563
  }).catch(() => {
@@ -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 skipQuotesCheck = fileExt === "json" || fileExt === "jsonc" || fileExt === "lock" || isMd || fileExt === "yaml" || fileExt === "yml" || isShell || filePath.endsWith("bun.lock");
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
- if (options.fix != null || options.reporter != null || options.maxWarnings != null || options.dryRun != null)
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.25",
38102
+ version: "0.1.27",
38089
38103
  description: "Format, lint and more in a fraction of seconds.",
38090
38104
  author: "Chris Breuer <chris@stacksjs.org>",
38091
38105
  license: "MIT",
@@ -38164,7 +38178,7 @@ var require_package = __commonJS((exports, module) => {
38164
38178
  "@stacksjs/clapp": "^0.2.0"
38165
38179
  },
38166
38180
  optionalDependencies: {
38167
- "ts-spell-check": "^0.1.0"
38181
+ "@stacksjs/ts-spell-check": "^0.1.0"
38168
38182
  },
38169
38183
  devDependencies: {
38170
38184
  bunfig: "^0.15.6"
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: "code-style",
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)
@@ -26166,7 +26174,7 @@ function ensureLoaded() {
26166
26174
  if (_loaded)
26167
26175
  return _available;
26168
26176
  try {
26169
- _tssc = (()=>{throw new Error("Cannot require module "+"ts-spell-check");})();
26177
+ _tssc = (()=>{throw new Error("Cannot require module "+"@stacksjs/ts-spell-check");})();
26170
26178
  _tssc.SpellChecker.create({ minWordLength: 3, maxSuggestions: 3 }).then((c) => {
26171
26179
  _checker = c;
26172
26180
  }).catch(() => {
@@ -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 skipQuotesCheck = fileExt === "json" || fileExt === "jsonc" || fileExt === "lock" || isMd || fileExt === "yaml" || fileExt === "yml" || isShell || filePath.endsWith("bun.lock");
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
- if (options.fix != null || options.reporter != null || options.maxWarnings != null || options.dryRun != null)
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,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pickier",
3
3
  "type": "module",
4
- "version": "0.1.25",
4
+ "version": "0.1.27",
5
5
  "description": "Format, lint and more in a fraction of seconds.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -80,7 +80,7 @@
80
80
  "@stacksjs/clapp": "^0.2.0"
81
81
  },
82
82
  "optionalDependencies": {
83
- "ts-spell-check": "^0.1.0"
83
+ "@stacksjs/ts-spell-check": "^0.1.0"
84
84
  },
85
85
  "devDependencies": {
86
86
  "bunfig": "^0.15.6"