pickier 0.1.59 → 0.1.61

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.
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{H as u,k as m}from"./chunk-b369mtka.js";import{Q as y}from"./chunk-awmb5sg5.js";import{readFileSync as O,statSync as p,writeFileSync as x}from"fs";import{isAbsolute as d,resolve as l}from"path";async function R(r,t){let a=t.mode||"auto";if(a==="format"&&r.length===1&&!/[*?[\]{}()!]/.test(r[0]))try{let n=r[0],i=d(n)?n:l(process.cwd(),n);if(p(i).isFile()){let o=await u(t.config),c=O(i,"utf8"),f=m(c,o,i);if(t.check&&f!==c)return 1;if(t.write&&f!==c)x(i,f,"utf8");return 0}}catch{}let{runLint:e}=await import("./chunk-n23710ya.js");if(a==="lint")return e(r,t);if(a==="format"){let n={...t,fix:!0,dryRun:!!t.check,ext:t.ext,_formatOnly:!0};return e(r,n)}if(!(t.fix===!0||t.write===!0||t.check===!0))return e(r,t);let s={...t,fix:!0,dryRun:!!t.check,ext:t.ext};return e(r,s)}
3
+ export{R as h};
package/dist/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{a as t,b as f,c as m,g as e}from"../chunk-6cf4pq67.js";import{h as x}from"../chunk-t6trprqw.js";import{A as F,B as G,C as H,D as I,E as J,F as K,G as M,H as N,I as Q,J as S,k as O,l as P,m as R,n as T,o as U,p as a,q as b,r as j,s as q,t as v,u as w,v as z,w as A,x as B,y as D,z as E}from"../chunk-er69kh4d.js";import{K as r,M as o}from"../chunk-ah6h41gy.js";import"../chunk-43fsk0jg.js";export{D as yellow,N as withAlwaysIgnores,S as shouldIgnorePath,m as runLintProgrammatic,e as runLint,t as runFormat,x as run,B as red,I as mergeConfig,J as loadConfigFromPath,f as lintText,M as isCodeFile,R as hasIndentIssue,A as green,F as gray,a as glob,w as getRuleSetting,T as formatImports,O as formatCode,K as expandPatterns,P as detectQuoteIssues,r as defaultConfig,b as createLimiter,Q as createIgnoreMatcher,o as config,H as colors,z as colorize,G as bold,E as blue,v as UNIVERSAL_IGNORES,U as MAX_FIXER_PASSES,j as ENV,q as ALWAYS_IGNORES};
2
+ import{a as i,b as r,c as t,g as o}from"../chunk-xjc1fk5y.js";import{h as s}from"../chunk-z1nez1br.js";import{A as F,B as I,C as O,D as A,E,F as W,G as U,H as q,I as z,J as B,K as D,L as G,M as N,k as m,l as b,m as P,n as C,o as R,p as d,q as y,r as k,s as h,t as v,u as w,v as S,w as L,x as M,y as T,z as j}from"../chunk-b369mtka.js";import{N as e,P as n}from"../chunk-3j5z4940.js";import"../chunk-awmb5sg5.js";export{h as ALWAYS_IGNORES,k as ENV,R as MAX_FIXER_PASSES,v as UNIVERSAL_IGNORES,O as blue,E as bold,T as colorize,W as colors,n as config,G as createIgnoreMatcher,y as createLimiter,e as defaultConfig,b as detectQuoteIssues,z as expandPatterns,m as formatCode,C as formatImports,w as getRuleSetting,d as glob,A as gray,j as green,P as hasIndentIssue,B as isCodeFile,M as isRuleOff,r as lintText,q as loadConfigFromPath,U as mergeConfig,S as normalizeRuleSeverity,F as red,L as resolveRuleSeverity,s as run,i as runFormat,o as runLint,t as runLintProgrammatic,N as shouldIgnorePath,D as withAlwaysIgnores,I as yellow};
@@ -1,4 +1,4 @@
1
- import type { PickierConfig, PickierOptions, RulesConfigMap } from './types';
1
+ import type { PickierConfig, PickierOptions, RuleSeverity, RulesConfigMap } from './types';
2
2
  /**
3
3
  * Glob files matching the given patterns.
4
4
  * Uses Bun.Glob when running under Bun for maximum performance,
@@ -17,6 +17,40 @@ export declare function createLimiter(concurrency: number): <T>(fn: () => Promis
17
17
  * Handles both string format ('error', 'warn', 'off') and array format (['error', options]).
18
18
  */
19
19
  export declare function getRuleSetting(rulesConfig: RulesConfigMap, ruleId: string): { enabled: boolean, severity?: 'error' | 'warning', options?: any };
20
+ /**
21
+ * Normalize a raw rule config value into a severity.
22
+ *
23
+ * Accepts both the string form (`'error'`) and the array form
24
+ * (`['warn', options]`). Returns `'off'` for an explicit opt-out and
25
+ * `undefined` when the rule is not configured at all — the two are different
26
+ * answers, and only the caller knows what an unconfigured rule should default
27
+ * to (plugin rules default to disabled, built-in rules do not).
28
+ */
29
+ export declare function normalizeRuleSeverity(raw: unknown): 'off' | 'warning' | 'error' | undefined;
30
+ /**
31
+ * The single severity gate every rule passes through before it runs.
32
+ *
33
+ * A rule is configurable from either config map — `rules` and `pluginRules`
34
+ * are both user-facing and people reasonably reach for whichever they saw
35
+ * first — and under any of its aliases: the id it reports as (`no-console`),
36
+ * the plugin-qualified id (`style/quotes`), or the legacy camelCase key the
37
+ * built-in scan was originally written against (`noConsole`). Pass the
38
+ * reported id first and aliases in descending priority; the first configured
39
+ * one wins, so an explicit `'no-console': 'off'` beats an inherited
40
+ * `noConsole: 'warn'`.
41
+ *
42
+ * Returns the severity issues should be reported at, or `undefined` when the
43
+ * rule is off — callers must not run a rule that resolves to `undefined`.
44
+ */
45
+ export declare function resolveRuleSeverity(cfg: Pick<PickierConfig, 'rules' | 'pluginRules'>, ruleId: string, aliases?: string[], fallback?: RuleSeverity): 'warning' | 'error' | undefined;
46
+ /**
47
+ * True when a rule is explicitly switched off in either config map.
48
+ *
49
+ * Distinct from `resolveRuleSeverity`: this answers "did the user opt out?"
50
+ * for call sites whose default is enabled, where an unconfigured rule must
51
+ * keep running.
52
+ */
53
+ export declare function isRuleOff(cfg: Pick<PickierConfig, 'rules' | 'pluginRules'>, ruleId: string): boolean;
20
54
  /**
21
55
  * Colorize console output (simple ANSI colors)
22
56
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pickier",
3
3
  "type": "module",
4
- "version": "0.1.59",
4
+ "version": "0.1.61",
5
5
  "description": "Format, lint and more in a fraction of seconds.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{b as a,c as b,d as c,e as d,f as e,g as f}from"./chunk-6cf4pq67.js";import"./chunk-er69kh4d.js";import"./chunk-ah6h41gy.js";import"./chunk-43fsk0jg.js";export{d as scanContentOptimized,e as scanContent,b as runLintProgrammatic,f as runLint,a as lintText,c as applyPlugins};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{K as a,L as b,M as c}from"./chunk-ah6h41gy.js";import"./chunk-43fsk0jg.js";export{b as getConfig,a as defaultConfig,c as config};