pickier 0.1.66 → 0.1.68
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 +1 -1
- package/dist/chunk-5dpt7qv4.js +2 -0
- package/dist/chunk-ek25vxkw.js +2 -0
- package/dist/chunk-jcy3sgzh.js +2 -0
- package/dist/{chunk-rg0g2fzg.js → chunk-q47v401h.js} +3 -3
- package/dist/{chunk-vbmkrdh6.js → chunk-s0n5r5hb.js} +154 -153
- package/dist/{chunk-0byqg5rc.js → chunk-zeaz9zt8.js} +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/lexer.d.ts +44 -0
- package/dist/src/rules/general/_template-tracking.d.ts +5 -18
- package/dist/src/rules/general/no-unused-vars.d.ts +12 -0
- package/dist/src/rules/ts/no-top-level-await.d.ts +7 -1
- package/package.json +1 -1
- package/dist/chunk-nke9r0j5.js +0 -2
- package/dist/chunk-p5zbyxq6.js +0 -2
- package/dist/chunk-zzacmw52.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var e="pickier",u="module",t="0.1.
|
|
2
|
+
var e="pickier",u="module",t="0.1.68",r="Format, lint and more in a fraction of seconds.",s="Chris Breuer <chris@stacksjs.org>",l="MIT",p="https://github.com/pickier/pickier#readme",b={type:"git",url:"git+https://github.com/pickier/pickier.git"},c={url:"https://github.com/pickier/pickier/issues"},m=["pickier","linter","formatter","bun","fast"],o={".":{types:"./dist/src/index.d.ts",import:"./dist/src/index.js"},"./*":{import:"./dist/*"}},a="./dist/src/index.js",x="./dist/src/index.d.ts",d={pickier:"./dist/bin/cli.js"},w=["README.md","dist"],k={build:"bun --bun build.ts","build:bin":"bun --bun build.ts && bun run compile",compile:"bun build ./bin/cli.ts --compile --minify --outfile bin/pickier","compile:all":"bun run compile:linux-x64 && bun run compile:linux-arm64 && bun run compile:linux-x64-musl && bun run compile:linux-arm64-musl && bun run compile:windows-x64 && bun run compile:windows-arm64 && bun run compile:darwin-x64 && bun run compile:darwin-arm64","compile:linux-x64":"bun build ./bin/cli.ts --compile --minify --target=bun-linux-x64 --outfile bin/pickier-linux-x64","compile:linux-arm64":"bun build ./bin/cli.ts --compile --minify --target=bun-linux-arm64 --outfile bin/pickier-linux-arm64","compile:linux-x64-musl":"bun build ./bin/cli.ts --compile --minify --target=bun-linux-x64-musl --outfile bin/pickier-linux-x64-musl","compile:linux-arm64-musl":"bun build ./bin/cli.ts --compile --minify --target=bun-linux-arm64-musl --outfile bin/pickier-linux-arm64-musl","compile:windows-x64":"bun build ./bin/cli.ts --compile --minify --target=bun-windows-x64 --outfile bin/pickier-windows-x64.exe","compile:windows-arm64":"bun build ./bin/cli.ts --compile --minify --target=bun-windows-arm64 --outfile bin/pickier-windows-arm64.exe","compile:darwin-x64":"bun build ./bin/cli.ts --compile --minify --target=bun-darwin-x64 --outfile bin/pickier-darwin-x64","compile:darwin-arm64":"bun build ./bin/cli.ts --compile --minify --target=bun-darwin-arm64 --outfile bin/pickier-darwin-arm64",zip:"bun run zip:all","zip:all":"bun run zip:linux-x64 && bun run zip:linux-arm64 && bun run zip:linux-x64-musl && bun run zip:linux-arm64-musl && bun run zip:windows-x64 && bun run zip:windows-arm64 && bun run zip:darwin-x64 && bun run zip:darwin-arm64","zip:linux-x64":"zip -j bin/pickier-linux-x64.zip bin/pickier-linux-x64","zip:linux-arm64":"zip -j bin/pickier-linux-arm64.zip bin/pickier-linux-arm64","zip:linux-x64-musl":"zip -j bin/pickier-linux-x64-musl.zip bin/pickier-linux-x64-musl","zip:linux-arm64-musl":"zip -j bin/pickier-linux-arm64-musl.zip bin/pickier-linux-arm64-musl","zip:windows-x64":"zip -j bin/pickier-windows-x64.zip bin/pickier-windows-x64.exe","zip:windows-arm64":"zip -j bin/pickier-windows-arm64.zip bin/pickier-windows-arm64.exe","zip:darwin-x64":"zip -j bin/pickier-darwin-x64.zip bin/pickier-darwin-x64","zip:darwin-arm64":"zip -j bin/pickier-darwin-arm64.zip bin/pickier-darwin-arm64",prepublishOnly:"bun --bun run build && bun run compile:all && bun run zip",test:"PICKIER_NO_AUTO_CONFIG=1 bun test --coverage","test:core":"PICKIER_NO_AUTO_CONFIG=1 bun test test/core","test:format":"PICKIER_NO_AUTO_CONFIG=1 bun test test/format","test:lint":"PICKIER_NO_AUTO_CONFIG=1 bun test test/lint","test:rules":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules","test:rules:sort":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/sort","test:rules:style":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/style","test:rules:quality":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/quality","test:rules:imports":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/imports","test:rules:typescript":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/typescript","test:rules:regexp":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/regexp","test:plugin":"PICKIER_NO_AUTO_CONFIG=1 bun test test/plugin","test:watch":"PICKIER_NO_AUTO_CONFIG=1 bun test --watch"},I={"@stacksjs/clarity":"^0.3.24","@stacksjs/clapp":"^0.2.3"},O={"@stacksjs/ts-spell-check":"^0.1.0"},_={bunfig:"^0.15.13"},z={name:e,type:u,version:t,description:r,author:s,license:l,homepage:p,repository:b,bugs:c,keywords:m,exports:o,module:a,types:x,bin:d,files:w,scripts:k,dependencies:I,optionalDependencies:O,devDependencies:_};export{s as author,d as bin,c as bugs,z as default,I as dependencies,r as description,_ as devDependencies,o as exports,w as files,p as homepage,m as keywords,l as license,a as module,e as name,O as optionalDependencies,b as repository,k as scripts,u as type,x as types,t as version};
|
package/dist/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{s,S,f,k,y,p,b,
|
|
2
|
+
import{s,S,f,k,y,p,b,i,D,n,R,o,v,g,a,j,h,T,L,A,O,_,N,e,m,u,d,w,l,c,B,I}from"../chunk-q47v401h.js";import{M,C,x,E,P}from"../chunk-s0n5r5hb.js";export{R as ALWAYS_IGNORES,n as ENV,b as MAX_FIXER_PASSES,o as UNIVERSAL_IGNORES,O as blue,N as bold,h as colorize,e as colors,S as config,c as createIgnoreMatcher,D as createLimiter,s as defaultConfig,k as detectQuoteIssues,d as expandPatterns,x as fixText,f as formatCode,p as formatImports,v as getRuleSetting,i as glob,_ as gray,T as green,y as hasIndentIssue,w as isCodeFile,j as isRuleOff,C as lintText,u as loadConfigFromPath,m as mergeConfig,g as normalizeRuleSeverity,L as red,a as resolveRuleSeverity,I as run,M as runFormat,P as runLint,E as runLintProgrammatic,B as shouldIgnorePath,l as withAlwaysIgnores,A as yellow};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lex `text` once, returning every comment, string, template-body and regex
|
|
3
|
+
* region. See the module comment for what is handled.
|
|
4
|
+
*/
|
|
5
|
+
export declare function lexSource(text: string): LexResult;
|
|
6
|
+
/**
|
|
7
|
+
* `text` with the contents of the chosen region kinds replaced by spaces.
|
|
8
|
+
*
|
|
9
|
+
* Line breaks, delimiters and length are unchanged. With no options only
|
|
10
|
+
* comments are blanked, which is the common need: prose can then never be
|
|
11
|
+
* mistaken for code. A template's `${}` expressions are code and are never
|
|
12
|
+
* blanked.
|
|
13
|
+
*/
|
|
14
|
+
export declare function maskSource(text: string, options?: MaskOptions, lexed?: LexResult): string;
|
|
15
|
+
/** Every comment's contents blanked; everything else as written. */
|
|
16
|
+
export declare function maskComments(text: string): string;
|
|
17
|
+
/** Only code left: comments, strings, template bodies and regex patterns blanked. */
|
|
18
|
+
export declare function maskNonCode(text: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* For each line, whether it begins inside a template-literal body - between
|
|
21
|
+
* a backtick (or the `}` closing a `${}`) and the next backtick or `${`.
|
|
22
|
+
*
|
|
23
|
+
* A line that begins inside a `${}` expression is code, not template text.
|
|
24
|
+
*/
|
|
25
|
+
export declare function lineStartsInTemplate(text: string, lexed?: LexResult): boolean[];
|
|
26
|
+
export declare interface Region {
|
|
27
|
+
kind: RegionKind
|
|
28
|
+
start: number
|
|
29
|
+
end: number
|
|
30
|
+
}
|
|
31
|
+
export declare interface LexResult {
|
|
32
|
+
regions: Region[]
|
|
33
|
+
templates: Array<[number, number]>
|
|
34
|
+
}
|
|
35
|
+
export declare interface MaskOptions {
|
|
36
|
+
comments?: boolean
|
|
37
|
+
strings?: boolean
|
|
38
|
+
templates?: boolean
|
|
39
|
+
regex?: boolean
|
|
40
|
+
}
|
|
41
|
+
/*` or a quote still
|
|
42
|
+
* find them.
|
|
43
|
+
*/
|
|
44
|
+
export type RegionKind = 'comment' | 'string' | 'template' | 'regex';
|
|
@@ -9,23 +9,10 @@
|
|
|
9
9
|
* applying lint rules to them produces false positives that fixers will
|
|
10
10
|
* happily turn into broken runtime code.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* character on the logical statement: `/` after operators / punctuation
|
|
18
|
-
* starts a regex; `/` after an identifier or closing bracket is division.
|
|
12
|
+
* This was a scanner of its own, and it got two things wrong that the shared
|
|
13
|
+
* lexer gets right: a regex after a keyword (`return /it's/`) read as
|
|
14
|
+
* division, so its quote opened a string, and a quoted string did not end at
|
|
15
|
+
* the end of its line. Either one left the state inverted for the rest of the
|
|
16
|
+
* file, so the lines *outside* every template were the ones skipped.
|
|
19
17
|
*/
|
|
20
18
|
export declare function computeLineStartsInTemplate(text: string): boolean[];
|
|
21
|
-
/**
|
|
22
|
-
* On a single line, return [start, end] ranges of characters that fall
|
|
23
|
-
* inside a backtick-bounded template literal. If a backtick opens but
|
|
24
|
-
* doesn't close on this line, the range extends to the line's end (it's
|
|
25
|
-
* the first line of a multi-line template).
|
|
26
|
-
*
|
|
27
|
-
* Used by per-line fixers to refuse to rewrite identifiers that fall
|
|
28
|
-
* inside an embedded code blob whose other usages live in the same
|
|
29
|
-
* template string and aren't visible to the syntactic rename.
|
|
30
|
-
*/
|
|
31
|
-
export declare function backtickRangesOnLine(line: string): Array<[number, number]>;
|
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
import type { RuleModule } from '../../types';
|
|
2
|
+
/*`, `*\/` and
|
|
3
|
+
* `//` delimiters stay, so the scanners that look for them still work; the
|
|
4
|
+
* length and the line breaks are unchanged, so every reported column still
|
|
5
|
+
* points where it did; and a name that appears only in a comment is now
|
|
6
|
+
* correctly not a use, which is what the rule meant all along.
|
|
7
|
+
*
|
|
8
|
+
* Finding the comments is the shared lexer's job ({@link maskComments}): it
|
|
9
|
+
* is the one place that knows a regex ending in `\/` is not a line comment, a
|
|
10
|
+
* template nested in `${}` is not the end of its parent, and a backtick or an
|
|
11
|
+
* apostrophe inside a comment is prose. This used to be a scanner of its own
|
|
12
|
+
* here, and every rule that had one got a different subset of that wrong.
|
|
13
|
+
*/
|
|
2
14
|
export declare function maskCommentText(text: string): string;
|
|
3
15
|
export declare const noUnusedVarsRule: RuleModule;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { RuleModule } from '../../types';
|
|
2
2
|
// Heuristic: flag 'await' only when at top level (brace depth 0),
|
|
3
|
-
// outside of comments/strings/templates, and not part of 'for await'.
|
|
3
|
+
// outside of comments/strings/templates/regexes, and not part of 'for await'.
|
|
4
|
+
//
|
|
5
|
+
// The scan runs over the shared lexer's code-only view of the file. It used to
|
|
6
|
+
// track strings and comments itself, without regex literals: the `/*` inside
|
|
7
|
+
// `/\/?\*\*\/*\*\*$/` opened a block comment, and from there a backtick or an
|
|
8
|
+
// apostrophe in a real comment further down decided the brace depth - so an
|
|
9
|
+
// `await` inside a function was reported as top-level, or a real one missed.
|
|
4
10
|
export declare const noTopLevelAwaitRule: RuleModule;
|
package/package.json
CHANGED
package/dist/chunk-nke9r0j5.js
DELETED
package/dist/chunk-p5zbyxq6.js
DELETED
package/dist/chunk-zzacmw52.js
DELETED