@ttsc/lint 0.19.3 → 0.20.1
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/README.md +1 -1
- package/lib/index.js +26 -4
- package/lib/index.js.map +1 -1
- package/lib/structures/format/ITtscLintFormat.d.ts +14 -10
- package/lib/structures/rules/ITtscLintRegexpRules.d.ts +24 -9
- package/lib/structures/rules/ITtscLintSecurityRules.d.ts +18 -0
- package/lib/structures/rules/ITtscLintSolidRules.d.ts +22 -2
- package/lib/structures/rules/ITtscLintStorybookRules.d.ts +21 -0
- package/lib/structures/rules/ITtscLintTypeScriptRuleOptions.d.ts +10 -1
- package/lib/structures/rules/ITtscLintTypeScriptRules.d.ts +13 -2
- package/linthost/compile.go +9 -4
- package/linthost/config.go +18 -14
- package/linthost/contrib_adapter.go +57 -0
- package/linthost/dispatch.go +5 -1
- package/linthost/display_width.go +179 -41
- package/linthost/engine.go +120 -4
- package/linthost/flags_gen.go +4 -4
- package/linthost/hints.go +207 -0
- package/linthost/host.go +68 -0
- package/linthost/lsp.go +148 -29
- package/linthost/print_dispatch.go +24 -0
- package/linthost/print_nodes_array.go +88 -15
- package/linthost/print_nodes_call.go +38 -31
- package/linthost/print_nodes_control_flow.go +319 -0
- package/linthost/print_nodes_function.go +140 -13
- package/linthost/print_nodes_list.go +22 -10
- package/linthost/project_engine.go +18 -1
- package/linthost/project_rules.go +47 -0
- package/linthost/rule_docs.go +114 -0
- package/linthost/rules_boundaries.go +80 -2
- package/linthost/rules_format_bracket_spacing.go +18 -6
- package/linthost/rules_format_clause_join.go +11 -8
- package/linthost/rules_format_indent.go +155 -4
- package/linthost/rules_format_print_width.go +12 -35
- package/linthost/rules_format_quote_props.go +88 -27
- package/linthost/rules_format_statement_split.go +81 -0
- package/linthost/rules_format_trailing_comma.go +62 -94
- package/linthost/rules_gap.go +26 -17
- package/linthost/rules_jsdoc.go +54 -0
- package/linthost/rules_logic.go +30 -15
- package/linthost/rules_no_redeclare.go +12 -3
- package/linthost/rules_promise.go +37 -15
- package/linthost/rules_regexp.go +443 -49
- package/linthost/rules_security.go +243 -4
- package/linthost/rules_solid.go +430 -10
- package/linthost/rules_storybook.go +255 -10
- package/linthost/rules_suggestions.go +60 -39
- package/linthost/rules_ts.go +7 -0
- package/linthost/rules_ts_async.go +80 -2
- package/linthost/rules_ts_extra.go +21 -7
- package/linthost/serve.go +318 -0
- package/linthost/width_tables_gen.go +219 -0
- package/package.json +2 -2
- package/rule/hint.go +142 -0
- package/rule/rule.go +197 -1
- package/src/index.ts +35 -4
- package/src/structures/format/ITtscLintFormat.ts +14 -10
- package/src/structures/rules/ITtscLintRegexpRules.ts +24 -9
- package/src/structures/rules/ITtscLintSecurityRules.ts +18 -0
- package/src/structures/rules/ITtscLintSolidRules.ts +22 -2
- package/src/structures/rules/ITtscLintStorybookRules.ts +21 -0
- package/src/structures/rules/ITtscLintTypeScriptRuleOptions.ts +10 -1
- package/src/structures/rules/ITtscLintTypeScriptRules.ts +13 -2
|
@@ -548,9 +548,18 @@ func (tripleSlashReference) Check(ctx *Context, node *shimast.Node) {
|
|
|
548
548
|
// noArrayDelete: `delete arr[0]` leaves a sparse hole. Use `splice`.
|
|
549
549
|
type noArrayDelete struct{}
|
|
550
550
|
|
|
551
|
-
func (noArrayDelete) Name() string
|
|
551
|
+
func (noArrayDelete) Name() string { return "typescript/no-array-delete" }
|
|
552
|
+
|
|
553
|
+
// NeedsTypeChecker is what makes this rule correct rather than approximate.
|
|
554
|
+
// The construct it rejects and the construct it must leave alone are spelled
|
|
555
|
+
// identically — `delete target[key]` — and only the target's type tells them
|
|
556
|
+
// apart.
|
|
557
|
+
func (noArrayDelete) NeedsTypeChecker() bool { return true }
|
|
552
558
|
func (noArrayDelete) Visits() []shimast.Kind { return []shimast.Kind{shimast.KindDeleteExpression} }
|
|
553
559
|
func (noArrayDelete) Check(ctx *Context, node *shimast.Node) {
|
|
560
|
+
if ctx.Checker == nil {
|
|
561
|
+
return
|
|
562
|
+
}
|
|
554
563
|
del := node.AsDeleteExpression()
|
|
555
564
|
if del == nil || del.Expression == nil {
|
|
556
565
|
return
|
|
@@ -559,15 +568,20 @@ func (noArrayDelete) Check(ctx *Context, node *shimast.Node) {
|
|
|
559
568
|
return
|
|
560
569
|
}
|
|
561
570
|
access := del.Expression.AsElementAccessExpression()
|
|
562
|
-
if access == nil || access.ArgumentExpression == nil {
|
|
571
|
+
if access == nil || access.Expression == nil || access.ArgumentExpression == nil {
|
|
563
572
|
return
|
|
564
573
|
}
|
|
565
|
-
//
|
|
566
|
-
//
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
574
|
+
// The target's type is the whole question. `delete record[key]` on a
|
|
575
|
+
// `Record<string, T>` or an index signature is the correct way to remove an
|
|
576
|
+
// entry, while the same syntax on an array leaves a sparse hole. The
|
|
577
|
+
// subscript's syntactic shape says nothing about which one this is: the rule
|
|
578
|
+
// used to require a numeric literal or an identifier, which both reported
|
|
579
|
+
// every `delete record[key]` and missed `delete array[next()]`.
|
|
580
|
+
target := ctx.Checker.GetTypeAtLocation(access.Expression)
|
|
581
|
+
if target == nil || !noForInArrayIsArrayLike(ctx.Checker, target) {
|
|
582
|
+
return
|
|
570
583
|
}
|
|
584
|
+
ctx.Report(node, "Using delete with an array expression is unsafe.")
|
|
571
585
|
}
|
|
572
586
|
|
|
573
587
|
// consistentTypeImports: `import { Foo } from "./types"` where Foo is
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
package linthost
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"bufio"
|
|
5
|
+
"encoding/json"
|
|
6
|
+
"fmt"
|
|
7
|
+
"io"
|
|
8
|
+
"os"
|
|
9
|
+
"strings"
|
|
10
|
+
"sync"
|
|
11
|
+
|
|
12
|
+
shimast "github.com/microsoft/typescript-go/shim/ast"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
// residentPrograms is the warm-Program cache the resident lsp-serve loop
|
|
16
|
+
// installs for the life of the daemon. It is nil in every one-shot verb
|
|
17
|
+
// invocation, so acquireProgram falls straight through to loadProgram and the
|
|
18
|
+
// spawn-per-verb path behaves byte-identically to before. Only RunLSPServe sets
|
|
19
|
+
// it, and the serve loop is single-threaded, but the mutex keeps the invariant
|
|
20
|
+
// explicit and cheap.
|
|
21
|
+
var residentPrograms *residentProgramCache
|
|
22
|
+
|
|
23
|
+
// residentProgramCache holds one loaded Program per (cwd, tsconfig, checker)
|
|
24
|
+
// key. A resident daemon pays the cold NewProgram parse+bind and the standalone
|
|
25
|
+
// checker build once, then reuses them across LSP verbs until a document change
|
|
26
|
+
// invalidates the cache. The expensive work is the parse+bind+checker; the
|
|
27
|
+
// per-verb rule walk is re-run each time (see acquire) because different verbs
|
|
28
|
+
// resolve different rule sets.
|
|
29
|
+
type residentProgramCache struct {
|
|
30
|
+
mu sync.Mutex
|
|
31
|
+
entries map[string]*program
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
func newResidentProgramCache() *residentProgramCache {
|
|
35
|
+
return &residentProgramCache{entries: map[string]*program{}}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// residentProgramKey identifies one cached Program. The checker suffix keeps a
|
|
39
|
+
// checker-free Program from being handed to a verb whose rules read one.
|
|
40
|
+
func residentProgramKey(opts *lspCommandOptions, needsChecker bool) string {
|
|
41
|
+
key := opts.cwd + "\x00" + opts.tsconfig + "\x00"
|
|
42
|
+
if needsChecker {
|
|
43
|
+
key += "checker"
|
|
44
|
+
}
|
|
45
|
+
return key
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// acquire returns a warm Program for the key, building and caching it on a miss.
|
|
49
|
+
// On a hit it resets the memoized project cycle so the caller's engine — which
|
|
50
|
+
// may differ from the engine that first warmed this Program (a lint verb versus
|
|
51
|
+
// a format verb) — re-evaluates its own project and file rules over the reused
|
|
52
|
+
// ASTs and checker. The returned close func is a no-op: a cached Program
|
|
53
|
+
// outlives the verb and is released only by invalidate or daemon exit.
|
|
54
|
+
//
|
|
55
|
+
// One project keeps one Program. A checker-bearing Program answers a verb that
|
|
56
|
+
// needs no checker, and a verb that does need one releases the checker-free
|
|
57
|
+
// entry it supersedes, so the daemon's memory does not depend on which verb the
|
|
58
|
+
// editor happened to ask for first.
|
|
59
|
+
func (c *residentProgramCache) acquire(
|
|
60
|
+
opts *lspCommandOptions,
|
|
61
|
+
needsChecker bool,
|
|
62
|
+
) (*program, []*shimast.Diagnostic, func(), error) {
|
|
63
|
+
key := residentProgramKey(opts, needsChecker)
|
|
64
|
+
c.mu.Lock()
|
|
65
|
+
defer c.mu.Unlock()
|
|
66
|
+
if prog, ok := c.entries[key]; ok {
|
|
67
|
+
// Drop the prior verb's project-cycle memo so this verb's engine re-runs.
|
|
68
|
+
prog.projectCycle = nil
|
|
69
|
+
return prog, nil, noopClose, nil
|
|
70
|
+
}
|
|
71
|
+
if !needsChecker {
|
|
72
|
+
// A Program that has a checker satisfies a verb that needs none. Without
|
|
73
|
+
// this the daemon would hold two Programs for one project as soon as a
|
|
74
|
+
// checker-free verb (lsp-hints, whose publishers declined a checker) joined
|
|
75
|
+
// a checker-bearing one (lsp-diagnostics with a type-aware rule enabled) —
|
|
76
|
+
// doubling the memory the resident cache exists to bound.
|
|
77
|
+
if prog, ok := c.entries[residentProgramKey(opts, true)]; ok {
|
|
78
|
+
prog.projectCycle = nil
|
|
79
|
+
return prog, nil, noopClose, nil
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
prog, diags, err := loadProgram(opts.cwd, opts.tsconfig, loadProgramOptions{
|
|
83
|
+
forceNoEmit: true,
|
|
84
|
+
needsRuleChecker: needsChecker,
|
|
85
|
+
projectIdentity: opts.projectIdentity,
|
|
86
|
+
})
|
|
87
|
+
if err != nil {
|
|
88
|
+
return nil, nil, noopClose, err
|
|
89
|
+
}
|
|
90
|
+
if len(diags) > 0 || prog == nil {
|
|
91
|
+
// A project that does not parse right now (a save mid-edit) is not cached —
|
|
92
|
+
// the next verb rebuilds. tsgo owns these diagnostics upstream anyway.
|
|
93
|
+
return prog, diags, noopClose, nil
|
|
94
|
+
}
|
|
95
|
+
if needsChecker {
|
|
96
|
+
// The checker-free entry for this project, if one exists, is now redundant:
|
|
97
|
+
// every verb that could use it can use this one. Releasing it here is what
|
|
98
|
+
// keeps the invariant at one Program per project in both arrival orders.
|
|
99
|
+
// Requests are served serially by the RunLSPServe loop, so no verb still
|
|
100
|
+
// holds the Program being closed.
|
|
101
|
+
plain := residentProgramKey(opts, false)
|
|
102
|
+
if previous, ok := c.entries[plain]; ok {
|
|
103
|
+
previous.close()
|
|
104
|
+
delete(c.entries, plain)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
c.entries[key] = prog
|
|
108
|
+
return prog, nil, noopClose, nil
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// invalidate releases every cached Program. Called when the editor signals that
|
|
112
|
+
// a document in the project changed on disk (didSave) or opened, so the next
|
|
113
|
+
// verb rebuilds against current source.
|
|
114
|
+
func (c *residentProgramCache) invalidate() {
|
|
115
|
+
c.mu.Lock()
|
|
116
|
+
defer c.mu.Unlock()
|
|
117
|
+
for key, prog := range c.entries {
|
|
118
|
+
prog.close()
|
|
119
|
+
delete(c.entries, key)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
func noopClose() {}
|
|
124
|
+
|
|
125
|
+
// applyChanges incrementally updates every cached Program for the changed files,
|
|
126
|
+
// or drops an entry for a full reload when a changed path is not one of its
|
|
127
|
+
// source files — a config edit, or a new or removed file, which tsgo's
|
|
128
|
+
// per-file UpdateProgram cannot express and a fresh load handles correctly.
|
|
129
|
+
func (c *residentProgramCache) applyChanges(paths []string) {
|
|
130
|
+
if len(paths) == 0 {
|
|
131
|
+
return
|
|
132
|
+
}
|
|
133
|
+
c.mu.Lock()
|
|
134
|
+
defer c.mu.Unlock()
|
|
135
|
+
for key, prog := range c.entries {
|
|
136
|
+
fullReload := false
|
|
137
|
+
for _, path := range paths {
|
|
138
|
+
if prog.sourceFileByPath(path) == nil {
|
|
139
|
+
fullReload = true
|
|
140
|
+
break
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if fullReload {
|
|
144
|
+
prog.close()
|
|
145
|
+
delete(c.entries, key)
|
|
146
|
+
continue
|
|
147
|
+
}
|
|
148
|
+
for _, path := range paths {
|
|
149
|
+
prog.applyChange(path)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// acquireProgram returns the Program an LSP verb should lint over, plus the
|
|
155
|
+
// close func the verb must defer. Outside a resident daemon (residentPrograms
|
|
156
|
+
// nil) it builds a fresh Program exactly as before and returns its real close,
|
|
157
|
+
// so the spawn-per-verb path is unchanged. Inside a daemon it returns the warm
|
|
158
|
+
// cached Program and a no-op close.
|
|
159
|
+
func acquireProgram(
|
|
160
|
+
opts *lspCommandOptions,
|
|
161
|
+
needsChecker bool,
|
|
162
|
+
) (*program, []*shimast.Diagnostic, func(), error) {
|
|
163
|
+
if residentPrograms != nil {
|
|
164
|
+
return residentPrograms.acquire(opts, needsChecker)
|
|
165
|
+
}
|
|
166
|
+
prog, diags, err := loadProgram(opts.cwd, opts.tsconfig, loadProgramOptions{
|
|
167
|
+
forceNoEmit: true,
|
|
168
|
+
needsRuleChecker: needsChecker,
|
|
169
|
+
projectIdentity: opts.projectIdentity,
|
|
170
|
+
})
|
|
171
|
+
if prog == nil {
|
|
172
|
+
return prog, diags, noopClose, err
|
|
173
|
+
}
|
|
174
|
+
return prog, diags, prog.close, err
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// serveLSPRequest is one newline-delimited request the resident daemon reads.
|
|
178
|
+
// The base project options (cwd, tsconfig, plugins-json, project-context) are
|
|
179
|
+
// fixed for the daemon's life and arrive as RunLSPServe's argv; only the
|
|
180
|
+
// per-verb fields travel per request.
|
|
181
|
+
type serveLSPRequest struct {
|
|
182
|
+
Verb string `json:"verb"`
|
|
183
|
+
URI string `json:"uri,omitempty"`
|
|
184
|
+
RangeJSON string `json:"rangeJson,omitempty"`
|
|
185
|
+
ContextJSON string `json:"contextJson,omitempty"`
|
|
186
|
+
// Invalidate drops the warm Program before serving. The client sends it for a
|
|
187
|
+
// change it cannot localize, so the request that carries it rebuilds.
|
|
188
|
+
Invalidate bool `json:"invalidate,omitempty"`
|
|
189
|
+
// Changed carries document URIs that changed on disk (a didSave), so the warm
|
|
190
|
+
// Program is updated incrementally — re-parsing only those files — before
|
|
191
|
+
// serving, instead of rebuilt from scratch. The sidecar owns the URI-to-path
|
|
192
|
+
// conversion so the spelling matches its own source-file names. A file the
|
|
193
|
+
// Program does not already hold as a source (a config edit, a new or removed
|
|
194
|
+
// file) drops the entry for a full reload instead.
|
|
195
|
+
Changed []string `json:"changed,omitempty"`
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// serveLSPResponse is the reply to one request: the verb's JSON result verbatim
|
|
199
|
+
// (the same bytes the one-shot verb would print) and the exit code that verb
|
|
200
|
+
// would have returned. A nonzero code with a null result means the verb failed;
|
|
201
|
+
// the client falls back rather than treating it as an empty answer.
|
|
202
|
+
type serveLSPResponse struct {
|
|
203
|
+
Result json.RawMessage `json:"result"`
|
|
204
|
+
Code int `json:"code"`
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// RunLSPServe is the resident @ttsc/lint LSP daemon. It installs a warm-Program
|
|
208
|
+
// cache and answers newline-delimited verb requests read from in by writing one
|
|
209
|
+
// JSON reply per line to out, until in reaches EOF.
|
|
210
|
+
//
|
|
211
|
+
// Only the read verbs run resident here. lsp-diagnostics and lsp-hints (one per
|
|
212
|
+
// save) and lsp-code-actions (one per cursor) are the hot path and reuse the
|
|
213
|
+
// warm Program; lsp-command-ids and lsp-code-action-kinds answer their static
|
|
214
|
+
// lists; an invalidate control drops the Program. lsp-execute-command is
|
|
215
|
+
// deliberately left to the spawn-per-verb path — it is user-initiated and its
|
|
216
|
+
// temp-workspace fix cascade does not fit the resident cache.
|
|
217
|
+
//
|
|
218
|
+
// in and out are explicit so the loop is testable; dispatch wires them to
|
|
219
|
+
// os.Stdin and os.Stdout.
|
|
220
|
+
func RunLSPServe(in io.Reader, out io.Writer, args []string) int {
|
|
221
|
+
base, ok := parseLSPCommandOptions("lsp-serve", args)
|
|
222
|
+
if !ok {
|
|
223
|
+
return 2
|
|
224
|
+
}
|
|
225
|
+
residentPrograms = newResidentProgramCache()
|
|
226
|
+
defer func() {
|
|
227
|
+
residentPrograms.invalidate()
|
|
228
|
+
residentPrograms = nil
|
|
229
|
+
}()
|
|
230
|
+
encoder := json.NewEncoder(out)
|
|
231
|
+
// ReadString imposes no line-length limit: a request is small, but keeping the
|
|
232
|
+
// same reader shape as utility/serve.go avoids an arbitrary ceiling if a
|
|
233
|
+
// future field carries buffer text.
|
|
234
|
+
reader := bufio.NewReader(in)
|
|
235
|
+
for {
|
|
236
|
+
raw, err := reader.ReadString('\n')
|
|
237
|
+
if line := strings.TrimSpace(raw); line != "" {
|
|
238
|
+
handleServeLSPLine(line, base, encoder)
|
|
239
|
+
}
|
|
240
|
+
if err != nil {
|
|
241
|
+
if err != io.EOF {
|
|
242
|
+
fmt.Fprintf(os.Stderr, "@ttsc/lint lsp-serve: read error: %v\n", err)
|
|
243
|
+
return 2
|
|
244
|
+
}
|
|
245
|
+
return 0
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// handleServeLSPLine answers one request line. A panic inside a rule cycle is
|
|
251
|
+
// contained so one bad request drops to a nonzero code rather than taking down
|
|
252
|
+
// the daemon and every document with it — the resident analog of the one-shot
|
|
253
|
+
// process's isolation.
|
|
254
|
+
func handleServeLSPLine(line string, base *lspCommandOptions, encoder *json.Encoder) {
|
|
255
|
+
defer func() {
|
|
256
|
+
if recovered := recover(); recovered != nil {
|
|
257
|
+
fmt.Fprintf(os.Stderr, "@ttsc/lint lsp-serve: request panicked: %v\n", recovered)
|
|
258
|
+
_ = encoder.Encode(serveLSPResponse{Code: 2})
|
|
259
|
+
}
|
|
260
|
+
}()
|
|
261
|
+
var req serveLSPRequest
|
|
262
|
+
if err := json.Unmarshal([]byte(line), &req); err != nil {
|
|
263
|
+
_ = encoder.Encode(serveLSPResponse{Code: 2})
|
|
264
|
+
return
|
|
265
|
+
}
|
|
266
|
+
if req.Invalidate {
|
|
267
|
+
residentPrograms.invalidate()
|
|
268
|
+
}
|
|
269
|
+
if len(req.Changed) > 0 {
|
|
270
|
+
paths := make([]string, 0, len(req.Changed))
|
|
271
|
+
for _, uri := range req.Changed {
|
|
272
|
+
if path, err := filePathFromURI(uri); err == nil {
|
|
273
|
+
paths = append(paths, path)
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
residentPrograms.applyChanges(paths)
|
|
277
|
+
}
|
|
278
|
+
opts := *base
|
|
279
|
+
opts.uri = req.URI
|
|
280
|
+
opts.rangeJSON = req.RangeJSON
|
|
281
|
+
opts.contextJSON = req.ContextJSON
|
|
282
|
+
switch req.Verb {
|
|
283
|
+
case "lsp-diagnostics":
|
|
284
|
+
result, code := computeLSPDiagnostics(&opts)
|
|
285
|
+
encodeServeResult(encoder, result, code)
|
|
286
|
+
case "lsp-code-actions":
|
|
287
|
+
result, code := computeLSPCodeActions(&opts)
|
|
288
|
+
encodeServeResult(encoder, result, code)
|
|
289
|
+
case "lsp-hints":
|
|
290
|
+
result, code := computeLSPHints(&opts)
|
|
291
|
+
encodeServeResult(encoder, result, code)
|
|
292
|
+
case "lsp-command-ids":
|
|
293
|
+
encodeServeResult(encoder, lspCommandIDs(), 0)
|
|
294
|
+
case "lsp-code-action-kinds":
|
|
295
|
+
encodeServeResult(encoder, lspCodeActionKinds(), 0)
|
|
296
|
+
case "":
|
|
297
|
+
// A bare invalidate carries no verb; acknowledge it.
|
|
298
|
+
_ = encoder.Encode(serveLSPResponse{Code: 0})
|
|
299
|
+
default:
|
|
300
|
+
fmt.Fprintf(os.Stderr, "@ttsc/lint lsp-serve: unknown verb %q\n", req.Verb)
|
|
301
|
+
_ = encoder.Encode(serveLSPResponse{Code: 2})
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// encodeServeResult marshals a verb result and writes it with its code. A
|
|
306
|
+
// marshal failure degrades to a nonzero code rather than a malformed line.
|
|
307
|
+
func encodeServeResult(encoder *json.Encoder, result any, code int) {
|
|
308
|
+
if code != 0 {
|
|
309
|
+
_ = encoder.Encode(serveLSPResponse{Code: code})
|
|
310
|
+
return
|
|
311
|
+
}
|
|
312
|
+
raw, err := json.Marshal(result)
|
|
313
|
+
if err != nil {
|
|
314
|
+
_ = encoder.Encode(serveLSPResponse{Code: 2})
|
|
315
|
+
return
|
|
316
|
+
}
|
|
317
|
+
_ = encoder.Encode(serveLSPResponse{Result: raw, Code: 0})
|
|
318
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
// Code generated by packages/lint/tools/widthgen. DO NOT EDIT.
|
|
2
|
+
//
|
|
3
|
+
// Transcribed from prettier@3.8.3's own `getStringWidth`, which is the
|
|
4
|
+
// width contract `@ttsc/lint` publishes. Regenerate when the pinned Prettier
|
|
5
|
+
// moves: `node packages/lint/tools/widthgen/main.cjs`.
|
|
6
|
+
|
|
7
|
+
package linthost
|
|
8
|
+
|
|
9
|
+
const prettierWidthVersion = "3.8.3"
|
|
10
|
+
|
|
11
|
+
// The emoji-regex pattern Prettier substitutes before it counts, over
|
|
12
|
+
// UTF-16 code units with surrogates relocated by surrogateShift below.
|
|
13
|
+
const prettierEmojiPattern = "[#*0-9]\\x{FE0F}?\\x{20E3}|[\\xA9\\xAE\\x{203C}\\x{2049}\\x{2122}\\x{2139}\\x{2194}-\\x{2199}\\x{21A9}\\x{21AA}\\x{231A}\\x{231B}\\x{2328}\\x{23CF}\\x{23ED}-\\x{23EF}\\x{23F1}\\x{23F2}\\x{23F8}-\\x{23FA}\\x{24C2}\\x{25AA}\\x{25AB}\\x{25B6}\\x{25C0}\\x{25FB}\\x{25FC}\\x{25FE}\\x{2600}-\\x{2604}\\x{260E}\\x{2611}\\x{2614}\\x{2615}\\x{2618}\\x{2620}\\x{2622}\\x{2623}\\x{2626}\\x{262A}\\x{262E}\\x{262F}\\x{2638}-\\x{263A}\\x{2640}\\x{2642}\\x{2648}-\\x{2653}\\x{265F}\\x{2660}\\x{2663}\\x{2665}\\x{2666}\\x{2668}\\x{267B}\\x{267E}\\x{267F}\\x{2692}\\x{2694}-\\x{2697}\\x{2699}\\x{269B}\\x{269C}\\x{26A0}\\x{26A7}\\x{26AA}\\x{26B0}\\x{26B1}\\x{26BD}\\x{26BE}\\x{26C4}\\x{26C8}\\x{26CF}\\x{26D1}\\x{26E9}\\x{26F0}-\\x{26F5}\\x{26F7}\\x{26F8}\\x{26FA}\\x{2702}\\x{2708}\\x{2709}\\x{270F}\\x{2712}\\x{2714}\\x{2716}\\x{271D}\\x{2721}\\x{2733}\\x{2734}\\x{2744}\\x{2747}\\x{2757}\\x{2763}\\x{27A1}\\x{2934}\\x{2935}\\x{2B05}-\\x{2B07}\\x{2B1B}\\x{2B1C}\\x{2B55}\\x{3030}\\x{303D}\\x{3297}\\x{3299}]\\x{FE0F}?|[\\x{261D}\\x{270C}\\x{270D}](?:\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{FE0F})?|[\\x{270A}\\x{270B}](?:\\x{F003C}[\\x{F07FB}-\\x{F07FF}])?|[\\x{23E9}-\\x{23EC}\\x{23F0}\\x{23F3}\\x{25FD}\\x{2693}\\x{26A1}\\x{26AB}\\x{26C5}\\x{26CE}\\x{26D4}\\x{26EA}\\x{26FD}\\x{2705}\\x{2728}\\x{274C}\\x{274E}\\x{2753}-\\x{2755}\\x{2795}-\\x{2797}\\x{27B0}\\x{27BF}\\x{2B50}]|\\x{26D3}\\x{FE0F}?(?:\\x{200D}\\x{F003D}\\x{F04A5})?|\\x{26F9}(?:\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{FE0F})?(?:\\x{200D}[\\x{2640}\\x{2642}]\\x{FE0F}?)?|\\x{2764}\\x{FE0F}?(?:\\x{200D}(?:\\x{F003D}\\x{F0525}|\\x{F003E}\\x{F0679}))?|\\x{F003C}(?:[\\x{F0404}\\x{F0570}\\x{F0571}\\x{F057E}\\x{F057F}\\x{F0602}\\x{F0637}\\x{F0721}\\x{F0724}-\\x{F072C}\\x{F0736}\\x{F077D}\\x{F0796}\\x{F0797}\\x{F0799}-\\x{F079B}\\x{F079E}\\x{F079F}\\x{F07CD}\\x{F07CE}\\x{F07D4}-\\x{F07DF}\\x{F07F5}\\x{F07F7}]\\x{FE0F}?|[\\x{F0785}\\x{F07C2}\\x{F07C7}](?:\\x{F003C}[\\x{F07FB}-\\x{F07FF}])?|[\\x{F07C4}\\x{F07CA}](?:\\x{F003C}[\\x{F07FB}-\\x{F07FF}])?(?:\\x{200D}[\\x{2640}\\x{2642}]\\x{FE0F}?)?|[\\x{F07CB}\\x{F07CC}](?:\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{FE0F})?(?:\\x{200D}[\\x{2640}\\x{2642}]\\x{FE0F}?)?|[\\x{F04CF}\\x{F058E}\\x{F0591}-\\x{F059A}\\x{F0601}\\x{F061A}\\x{F062F}\\x{F0632}-\\x{F0636}\\x{F0638}-\\x{F063A}\\x{F0650}\\x{F0651}\\x{F0700}-\\x{F0720}\\x{F072D}-\\x{F0735}\\x{F0737}-\\x{F0743}\\x{F0745}-\\x{F074A}\\x{F074C}-\\x{F077C}\\x{F077E}-\\x{F0784}\\x{F0786}-\\x{F0793}\\x{F07A0}-\\x{F07C1}\\x{F07C5}\\x{F07C6}\\x{F07C8}\\x{F07C9}\\x{F07CF}-\\x{F07D3}\\x{F07E0}-\\x{F07F0}\\x{F07F8}-\\x{F07FF}]|\\x{F05E6}\\x{F003C}[\\x{F05E8}-\\x{F05EC}\\x{F05EE}\\x{F05F1}\\x{F05F2}\\x{F05F4}\\x{F05F6}-\\x{F05FA}\\x{F05FC}\\x{F05FD}\\x{F05FF}]|\\x{F05E7}\\x{F003C}[\\x{F05E6}\\x{F05E7}\\x{F05E9}-\\x{F05EF}\\x{F05F1}-\\x{F05F4}\\x{F05F6}-\\x{F05F9}\\x{F05FB}\\x{F05FC}\\x{F05FE}\\x{F05FF}]|\\x{F05E8}\\x{F003C}[\\x{F05E6}\\x{F05E8}\\x{F05E9}\\x{F05EB}-\\x{F05EE}\\x{F05F0}-\\x{F05F7}\\x{F05FA}-\\x{F05FF}]|\\x{F05E9}\\x{F003C}[\\x{F05EA}\\x{F05EC}\\x{F05EF}\\x{F05F0}\\x{F05F2}\\x{F05F4}\\x{F05FF}]|\\x{F05EA}\\x{F003C}[\\x{F05E6}\\x{F05E8}\\x{F05EA}\\x{F05EC}\\x{F05ED}\\x{F05F7}-\\x{F05FA}]|\\x{F05EB}\\x{F003C}[\\x{F05EE}-\\x{F05F0}\\x{F05F2}\\x{F05F4}\\x{F05F7}]|\\x{F05EC}\\x{F003C}[\\x{F05E6}\\x{F05E7}\\x{F05E9}-\\x{F05EE}\\x{F05F1}-\\x{F05F3}\\x{F05F5}-\\x{F05FA}\\x{F05FC}\\x{F05FE}]|\\x{F05ED}\\x{F003C}[\\x{F05F0}\\x{F05F2}\\x{F05F3}\\x{F05F7}\\x{F05F9}\\x{F05FA}]|\\x{F05EE}\\x{F003C}[\\x{F05E8}-\\x{F05EA}\\x{F05F1}-\\x{F05F4}\\x{F05F6}-\\x{F05F9}]|\\x{F05EF}\\x{F003C}[\\x{F05EA}\\x{F05F2}\\x{F05F4}\\x{F05F5}]|\\x{F05F0}\\x{F003C}[\\x{F05EA}\\x{F05EC}-\\x{F05EE}\\x{F05F2}\\x{F05F3}\\x{F05F5}\\x{F05F7}\\x{F05FC}\\x{F05FE}\\x{F05FF}]|\\x{F05F1}\\x{F003C}[\\x{F05E6}-\\x{F05E8}\\x{F05EE}\\x{F05F0}\\x{F05F7}-\\x{F05FB}\\x{F05FE}]|\\x{F05F2}\\x{F003C}[\\x{F05E6}\\x{F05E8}-\\x{F05ED}\\x{F05F0}-\\x{F05FF}]|\\x{F05F3}\\x{F003C}[\\x{F05E6}\\x{F05E8}\\x{F05EA}-\\x{F05EC}\\x{F05EE}\\x{F05F1}\\x{F05F4}\\x{F05F5}\\x{F05F7}\\x{F05FA}\\x{F05FF}]|\\x{F05F4}\\x{F003C}\\x{F05F2}|\\x{F05F5}\\x{F003C}[\\x{F05E6}\\x{F05EA}-\\x{F05ED}\\x{F05F0}-\\x{F05F3}\\x{F05F7}-\\x{F05F9}\\x{F05FC}\\x{F05FE}]|\\x{F05F6}\\x{F003C}\\x{F05E6}|\\x{F05F7}\\x{F003C}[\\x{F05EA}\\x{F05F4}\\x{F05F8}\\x{F05FA}\\x{F05FC}]|\\x{F05F8}\\x{F003C}[\\x{F05E6}-\\x{F05EA}\\x{F05EC}-\\x{F05F4}\\x{F05F7}-\\x{F05F9}\\x{F05FB}\\x{F05FD}-\\x{F05FF}]|\\x{F05F9}\\x{F003C}[\\x{F05E6}\\x{F05E8}\\x{F05E9}\\x{F05EB}-\\x{F05ED}\\x{F05EF}-\\x{F05F4}\\x{F05F7}\\x{F05F9}\\x{F05FB}\\x{F05FC}\\x{F05FF}]|\\x{F05FA}\\x{F003C}[\\x{F05E6}\\x{F05EC}\\x{F05F2}\\x{F05F3}\\x{F05F8}\\x{F05FE}\\x{F05FF}]|\\x{F05FB}\\x{F003C}[\\x{F05E6}\\x{F05E8}\\x{F05EA}\\x{F05EC}\\x{F05EE}\\x{F05F3}\\x{F05FA}]|\\x{F05FC}\\x{F003C}[\\x{F05EB}\\x{F05F8}]|\\x{F05FD}\\x{F003C}\\x{F05F0}|\\x{F05FE}\\x{F003C}[\\x{F05EA}\\x{F05F9}]|\\x{F05FF}\\x{F003C}[\\x{F05E6}\\x{F05F2}\\x{F05FC}]|\\x{F0744}(?:\\x{200D}\\x{F003D}\\x{F07EB})?|\\x{F074B}(?:\\x{200D}\\x{F003D}\\x{F07E9})?|\\x{F07C3}(?:\\x{F003C}[\\x{F07FB}-\\x{F07FF}])?(?:\\x{200D}(?:[\\x{2640}\\x{2642}]\\x{FE0F}?(?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|\\x{27A1}\\x{FE0F}?))?|\\x{F07F3}\\x{FE0F}?(?:\\x{200D}(?:\\x{26A7}\\x{FE0F}?|\\x{F003C}\\x{F0708}))?|\\x{F07F4}(?:\\x{200D}\\x{2620}\\x{FE0F}?|\\x{F0340}\\x{F0467}\\x{F0340}\\x{F0462}\\x{F0340}(?:\\x{F0465}\\x{F0340}\\x{F046E}\\x{F0340}\\x{F0467}|\\x{F0473}\\x{F0340}\\x{F0463}\\x{F0340}\\x{F0474}|\\x{F0477}\\x{F0340}\\x{F046C}\\x{F0340}\\x{F0473})\\x{F0340}\\x{F047F})?)|\\x{F003D}(?:[\\x{F043F}\\x{F04FD}\\x{F0549}\\x{F054A}\\x{F056F}\\x{F0570}\\x{F0573}\\x{F0576}-\\x{F0579}\\x{F0587}\\x{F058A}-\\x{F058D}\\x{F05A5}\\x{F05A8}\\x{F05B1}\\x{F05B2}\\x{F05BC}\\x{F05C2}-\\x{F05C4}\\x{F05D1}-\\x{F05D3}\\x{F05DC}-\\x{F05DE}\\x{F05E1}\\x{F05E3}\\x{F05E8}\\x{F05EF}\\x{F05F3}\\x{F05FA}\\x{F06CB}\\x{F06CD}-\\x{F06CF}\\x{F06E0}-\\x{F06E5}\\x{F06E9}\\x{F06F0}\\x{F06F3}]\\x{FE0F}?|[\\x{F0442}\\x{F0443}\\x{F0446}-\\x{F0450}\\x{F0466}\\x{F0467}\\x{F046B}-\\x{F046D}\\x{F0472}\\x{F0474}-\\x{F0476}\\x{F0478}\\x{F047C}\\x{F0483}\\x{F0485}\\x{F048F}\\x{F0491}\\x{F04AA}\\x{F057A}\\x{F0595}\\x{F0596}\\x{F064C}\\x{F064F}\\x{F06C0}\\x{F06CC}](?:\\x{F003C}[\\x{F07FB}-\\x{F07FF}])?|[\\x{F046E}-\\x{F0471}\\x{F0473}\\x{F0477}\\x{F0481}\\x{F0482}\\x{F0486}\\x{F0487}\\x{F0645}-\\x{F0647}\\x{F064B}\\x{F064D}\\x{F064E}\\x{F06A3}\\x{F06B4}\\x{F06B5}](?:\\x{F003C}[\\x{F07FB}-\\x{F07FF}])?(?:\\x{200D}[\\x{2640}\\x{2642}]\\x{FE0F}?)?|[\\x{F0574}\\x{F0590}](?:\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{FE0F})?|[\\x{F0400}-\\x{F0407}\\x{F0409}-\\x{F0414}\\x{F0416}-\\x{F0425}\\x{F0427}-\\x{F043A}\\x{F043C}-\\x{F043E}\\x{F0440}\\x{F0444}\\x{F0445}\\x{F0451}-\\x{F0465}\\x{F046A}\\x{F0479}-\\x{F047B}\\x{F047D}-\\x{F0480}\\x{F0484}\\x{F0488}-\\x{F048E}\\x{F0490}\\x{F0492}-\\x{F04A9}\\x{F04AB}-\\x{F04FC}\\x{F04FF}-\\x{F053D}\\x{F054B}-\\x{F054E}\\x{F0550}-\\x{F0567}\\x{F05A4}\\x{F05FB}-\\x{F062D}\\x{F062F}-\\x{F0634}\\x{F0637}-\\x{F0641}\\x{F0643}\\x{F0644}\\x{F0648}-\\x{F064A}\\x{F0680}-\\x{F06A2}\\x{F06A4}-\\x{F06B3}\\x{F06B7}-\\x{F06BF}\\x{F06C1}-\\x{F06C5}\\x{F06D0}-\\x{F06D2}\\x{F06D5}-\\x{F06D8}\\x{F06DC}-\\x{F06DF}\\x{F06EB}\\x{F06EC}\\x{F06F4}-\\x{F06FC}\\x{F07E0}-\\x{F07EB}\\x{F07F0}]|\\x{F0408}(?:\\x{200D}\\x{2B1B})?|\\x{F0415}(?:\\x{200D}\\x{F003E}\\x{F05BA})?|\\x{F0426}(?:\\x{200D}(?:\\x{2B1B}|\\x{F003D}\\x{F0525}))?|\\x{F043B}(?:\\x{200D}\\x{2744}\\x{FE0F}?)?|\\x{F0441}\\x{FE0F}?(?:\\x{200D}\\x{F003D}\\x{F05E8}\\x{FE0F}?)?|\\x{F0468}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}\\x{F003D}(?:\\x{F048B}\\x{200D}\\x{F003D})?\\x{F0468}|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F0468}\\x{F0469}]\\x{200D}\\x{F003D}(?:\\x{F0466}(?:\\x{200D}\\x{F003D}\\x{F0466})?|\\x{F0467}(?:\\x{200D}\\x{F003D}[\\x{F0466}\\x{F0467}])?)|[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0466}(?:\\x{200D}\\x{F003D}\\x{F0466})?|\\x{F0467}(?:\\x{200D}\\x{F003D}[\\x{F0466}\\x{F0467}])?)|\\x{F003E}(?:[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}]))|\\x{F003C}(?:\\x{F07FB}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}\\x{F003D}(?:\\x{F048B}\\x{200D}\\x{F003D})?\\x{F0468}\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0430}\\x{200D}\\x{F003D}\\x{F0468}\\x{F003C}[\\x{F07FC}-\\x{F07FF}])|\\x{F003E}(?:[\\x{F051D}\\x{F06EF}]\\x{200D}\\x{F003D}\\x{F0468}\\x{F003C}[\\x{F07FC}-\\x{F07FF}]|[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}])))?|\\x{F07FC}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}\\x{F003D}(?:\\x{F048B}\\x{200D}\\x{F003D})?\\x{F0468}\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0430}\\x{200D}\\x{F003D}\\x{F0468}\\x{F003C}[\\x{F07FB}\\x{F07FD}-\\x{F07FF}])|\\x{F003E}(?:[\\x{F051D}\\x{F06EF}]\\x{200D}\\x{F003D}\\x{F0468}\\x{F003C}[\\x{F07FB}\\x{F07FD}-\\x{F07FF}]|[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}])))?|\\x{F07FD}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}\\x{F003D}(?:\\x{F048B}\\x{200D}\\x{F003D})?\\x{F0468}\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0430}\\x{200D}\\x{F003D}\\x{F0468}\\x{F003C}[\\x{F07FB}\\x{F07FC}\\x{F07FE}\\x{F07FF}])|\\x{F003E}(?:[\\x{F051D}\\x{F06EF}]\\x{200D}\\x{F003D}\\x{F0468}\\x{F003C}[\\x{F07FB}\\x{F07FC}\\x{F07FE}\\x{F07FF}]|[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}])))?|\\x{F07FE}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}\\x{F003D}(?:\\x{F048B}\\x{200D}\\x{F003D})?\\x{F0468}\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0430}\\x{200D}\\x{F003D}\\x{F0468}\\x{F003C}[\\x{F07FB}-\\x{F07FD}\\x{F07FF}])|\\x{F003E}(?:[\\x{F051D}\\x{F06EF}]\\x{200D}\\x{F003D}\\x{F0468}\\x{F003C}[\\x{F07FB}-\\x{F07FD}\\x{F07FF}]|[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}])))?|\\x{F07FF}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}\\x{F003D}(?:\\x{F048B}\\x{200D}\\x{F003D})?\\x{F0468}\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0430}\\x{200D}\\x{F003D}\\x{F0468}\\x{F003C}[\\x{F07FB}-\\x{F07FE}])|\\x{F003E}(?:[\\x{F051D}\\x{F06EF}]\\x{200D}\\x{F003D}\\x{F0468}\\x{F003C}[\\x{F07FB}-\\x{F07FE}]|[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}])))?))?|\\x{F0469}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}\\x{F003D}(?:\\x{F048B}\\x{200D}\\x{F003D})?[\\x{F0468}\\x{F0469}]|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0466}(?:\\x{200D}\\x{F003D}\\x{F0466})?|\\x{F0467}(?:\\x{200D}\\x{F003D}[\\x{F0466}\\x{F0467}])?|\\x{F0469}\\x{200D}\\x{F003D}(?:\\x{F0466}(?:\\x{200D}\\x{F003D}\\x{F0466})?|\\x{F0467}(?:\\x{200D}\\x{F003D}[\\x{F0466}\\x{F0467}])?))|\\x{F003E}(?:[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}]))|\\x{F003C}(?:\\x{F07FB}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}\\x{F003D}(?:[\\x{F0468}\\x{F0469}]|\\x{F048B}\\x{200D}\\x{F003D}[\\x{F0468}\\x{F0469}])\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0430}\\x{200D}\\x{F003D}\\x{F0469}\\x{F003C}[\\x{F07FC}-\\x{F07FF}])|\\x{F003E}(?:[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}]|\\x{F051D}\\x{200D}\\x{F003D}[\\x{F0468}\\x{F0469}]\\x{F003C}[\\x{F07FC}-\\x{F07FF}]|\\x{F06EF}\\x{200D}\\x{F003D}\\x{F0469}\\x{F003C}[\\x{F07FC}-\\x{F07FF}])))?|\\x{F07FC}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}\\x{F003D}(?:[\\x{F0468}\\x{F0469}]|\\x{F048B}\\x{200D}\\x{F003D}[\\x{F0468}\\x{F0469}])\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0430}\\x{200D}\\x{F003D}\\x{F0469}\\x{F003C}[\\x{F07FB}\\x{F07FD}-\\x{F07FF}])|\\x{F003E}(?:[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}]|\\x{F051D}\\x{200D}\\x{F003D}[\\x{F0468}\\x{F0469}]\\x{F003C}[\\x{F07FB}\\x{F07FD}-\\x{F07FF}]|\\x{F06EF}\\x{200D}\\x{F003D}\\x{F0469}\\x{F003C}[\\x{F07FB}\\x{F07FD}-\\x{F07FF}])))?|\\x{F07FD}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}\\x{F003D}(?:[\\x{F0468}\\x{F0469}]|\\x{F048B}\\x{200D}\\x{F003D}[\\x{F0468}\\x{F0469}])\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0430}\\x{200D}\\x{F003D}\\x{F0469}\\x{F003C}[\\x{F07FB}\\x{F07FC}\\x{F07FE}\\x{F07FF}])|\\x{F003E}(?:[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}]|\\x{F051D}\\x{200D}\\x{F003D}[\\x{F0468}\\x{F0469}]\\x{F003C}[\\x{F07FB}\\x{F07FC}\\x{F07FE}\\x{F07FF}]|\\x{F06EF}\\x{200D}\\x{F003D}\\x{F0469}\\x{F003C}[\\x{F07FB}\\x{F07FC}\\x{F07FE}\\x{F07FF}])))?|\\x{F07FE}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}\\x{F003D}(?:[\\x{F0468}\\x{F0469}]|\\x{F048B}\\x{200D}\\x{F003D}[\\x{F0468}\\x{F0469}])\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0430}\\x{200D}\\x{F003D}\\x{F0469}\\x{F003C}[\\x{F07FB}-\\x{F07FD}\\x{F07FF}])|\\x{F003E}(?:[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}]|\\x{F051D}\\x{200D}\\x{F003D}[\\x{F0468}\\x{F0469}]\\x{F003C}[\\x{F07FB}-\\x{F07FD}\\x{F07FF}]|\\x{F06EF}\\x{200D}\\x{F003D}\\x{F0469}\\x{F003C}[\\x{F07FB}-\\x{F07FD}\\x{F07FF}])))?|\\x{F07FF}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}\\x{F003D}(?:[\\x{F0468}\\x{F0469}]|\\x{F048B}\\x{200D}\\x{F003D}[\\x{F0468}\\x{F0469}])\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0430}\\x{200D}\\x{F003D}\\x{F0469}\\x{F003C}[\\x{F07FB}-\\x{F07FE}])|\\x{F003E}(?:[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}]|\\x{F051D}\\x{200D}\\x{F003D}[\\x{F0468}\\x{F0469}]\\x{F003C}[\\x{F07FB}-\\x{F07FE}]|\\x{F06EF}\\x{200D}\\x{F003D}\\x{F0469}\\x{F003C}[\\x{F07FB}-\\x{F07FE}])))?))?|\\x{F0575}(?:\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{FE0F})?(?:\\x{200D}[\\x{2640}\\x{2642}]\\x{FE0F}?)?|\\x{F062E}(?:\\x{200D}\\x{F003D}\\x{F04A8})?|\\x{F0635}(?:\\x{200D}\\x{F003D}\\x{F04AB})?|\\x{F0636}(?:\\x{200D}\\x{F003C}\\x{F072B}\\x{FE0F}?)?|\\x{F0642}(?:\\x{200D}[\\x{2194}\\x{2195}]\\x{FE0F}?)?|\\x{F06B6}(?:\\x{F003C}[\\x{F07FB}-\\x{F07FF}])?(?:\\x{200D}(?:[\\x{2640}\\x{2642}]\\x{FE0F}?(?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|\\x{27A1}\\x{FE0F}?))?)|\\x{F003E}(?:[\\x{F050C}\\x{F050F}\\x{F0518}-\\x{F051F}\\x{F0530}-\\x{F0534}\\x{F0536}\\x{F0577}\\x{F05B5}\\x{F05B6}\\x{F05BB}\\x{F05D2}\\x{F05D3}\\x{F05D5}\\x{F06C3}-\\x{F06C5}\\x{F06F0}\\x{F06F2}-\\x{F06F8}](?:\\x{F003C}[\\x{F07FB}-\\x{F07FF}])?|[\\x{F0526}\\x{F0535}\\x{F0537}-\\x{F0539}\\x{F053C}-\\x{F053E}\\x{F05B8}\\x{F05B9}\\x{F05CD}\\x{F05CF}\\x{F05D4}\\x{F05D6}-\\x{F05DD}](?:\\x{F003C}[\\x{F07FB}-\\x{F07FF}])?(?:\\x{200D}[\\x{2640}\\x{2642}]\\x{FE0F}?)?|[\\x{F05DE}\\x{F05DF}](?:\\x{200D}[\\x{2640}\\x{2642}]\\x{FE0F}?)?|[\\x{F050D}\\x{F050E}\\x{F0510}-\\x{F0517}\\x{F0520}-\\x{F0525}\\x{F0527}-\\x{F052F}\\x{F053A}\\x{F053F}-\\x{F0545}\\x{F0547}-\\x{F0576}\\x{F0578}-\\x{F05B4}\\x{F05B7}\\x{F05BA}\\x{F05BC}-\\x{F05CC}\\x{F05D0}\\x{F05E0}-\\x{F05FF}\\x{F0670}-\\x{F067C}\\x{F0680}-\\x{F068A}\\x{F068E}-\\x{F06C2}\\x{F06C6}\\x{F06C8}\\x{F06CD}-\\x{F06DC}\\x{F06DF}-\\x{F06EA}\\x{F06EF}]|\\x{F05CE}(?:\\x{F003C}[\\x{F07FB}-\\x{F07FF}])?(?:\\x{200D}(?:[\\x{2640}\\x{2642}]\\x{FE0F}?(?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|\\x{27A1}\\x{FE0F}?))?|\\x{F05D1}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0784}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F003E}(?:[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}\\x{F0670}]|\\x{F051D}\\x{200D}\\x{F003E}\\x{F05D1}|\\x{F05D1}\\x{200D}\\x{F003E}\\x{F05D2}(?:\\x{200D}\\x{F003E}\\x{F05D2})?|\\x{F05D2}(?:\\x{200D}\\x{F003E}\\x{F05D2})?))|\\x{F003C}(?:\\x{F07FB}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}(?:\\x{F003D}\\x{F048B}\\x{200D})?\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FC}-\\x{F07FF}]|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0784}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0430}\\x{200D}\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FC}-\\x{F07FF}])|\\x{F003E}(?:[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}\\x{F0670}]|\\x{F051D}\\x{200D}\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{F06EF}\\x{200D}\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FC}-\\x{F07FF}])))?|\\x{F07FC}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}(?:\\x{F003D}\\x{F048B}\\x{200D})?\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}\\x{F07FD}-\\x{F07FF}]|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0784}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0430}\\x{200D}\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}\\x{F07FD}-\\x{F07FF}])|\\x{F003E}(?:[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}\\x{F0670}]|\\x{F051D}\\x{200D}\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{F06EF}\\x{200D}\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}\\x{F07FD}-\\x{F07FF}])))?|\\x{F07FD}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}(?:\\x{F003D}\\x{F048B}\\x{200D})?\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}\\x{F07FC}\\x{F07FE}\\x{F07FF}]|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0784}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0430}\\x{200D}\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}\\x{F07FC}\\x{F07FE}\\x{F07FF}])|\\x{F003E}(?:[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}\\x{F0670}]|\\x{F051D}\\x{200D}\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{F06EF}\\x{200D}\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}\\x{F07FC}\\x{F07FE}\\x{F07FF}])))?|\\x{F07FE}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}(?:\\x{F003D}\\x{F048B}\\x{200D})?\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}-\\x{F07FD}\\x{F07FF}]|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0784}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0430}\\x{200D}\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}-\\x{F07FD}\\x{F07FF}])|\\x{F003E}(?:[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}\\x{F0670}]|\\x{F051D}\\x{200D}\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{F06EF}\\x{200D}\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}-\\x{F07FD}\\x{F07FF}])))?|\\x{F07FF}(?:\\x{200D}(?:[\\x{2695}\\x{2696}\\x{2708}]\\x{FE0F}?|\\x{2764}\\x{FE0F}?\\x{200D}(?:\\x{F003D}\\x{F048B}\\x{200D})?\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}-\\x{F07FE}]|\\x{F003C}[\\x{F073E}\\x{F0773}\\x{F077C}\\x{F0784}\\x{F0793}\\x{F07A4}\\x{F07A8}\\x{F07EB}\\x{F07ED}]|\\x{F003D}(?:[\\x{F04BB}\\x{F04BC}\\x{F0527}\\x{F052C}\\x{F0680}\\x{F0692}]|\\x{F0430}\\x{200D}\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}-\\x{F07FE}])|\\x{F003E}(?:[\\x{F05AF}\\x{F05BC}\\x{F05BD}](?:\\x{200D}\\x{27A1}\\x{FE0F}?)?|[\\x{F05B0}-\\x{F05B3}\\x{F0670}]|\\x{F051D}\\x{200D}\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}-\\x{F07FF}]|\\x{F06EF}\\x{200D}\\x{F003E}\\x{F05D1}\\x{F003C}[\\x{F07FB}-\\x{F07FE}])))?))?|\\x{F06F1}(?:\\x{F003C}(?:\\x{F07FB}(?:\\x{200D}\\x{F003E}\\x{F06F2}\\x{F003C}[\\x{F07FC}-\\x{F07FF}])?|\\x{F07FC}(?:\\x{200D}\\x{F003E}\\x{F06F2}\\x{F003C}[\\x{F07FB}\\x{F07FD}-\\x{F07FF}])?|\\x{F07FD}(?:\\x{200D}\\x{F003E}\\x{F06F2}\\x{F003C}[\\x{F07FB}\\x{F07FC}\\x{F07FE}\\x{F07FF}])?|\\x{F07FE}(?:\\x{200D}\\x{F003E}\\x{F06F2}\\x{F003C}[\\x{F07FB}-\\x{F07FD}\\x{F07FF}])?|\\x{F07FF}(?:\\x{200D}\\x{F003E}\\x{F06F2}\\x{F003C}[\\x{F07FB}-\\x{F07FE}])?))?)"
|
|
14
|
+
|
|
15
|
+
// Where a UTF-16 surrogate code unit is relocated so a Go string can hold
|
|
16
|
+
// it. Go cannot represent a lone surrogate, and emoji-regex matches UTF-16
|
|
17
|
+
// units rather than runes, so both the pattern above and the subject text
|
|
18
|
+
// shift surrogates into this private-use range. Nothing else produces a
|
|
19
|
+
// value there, so the mapping is a bijection and the match is unchanged.
|
|
20
|
+
const surrogateShift = 0xF0000
|
|
21
|
+
|
|
22
|
+
var prettierWideRanges = [...]unicodeRange{
|
|
23
|
+
{lo: 0x1100, hi: 0x115F},
|
|
24
|
+
{lo: 0x231A, hi: 0x231B},
|
|
25
|
+
{lo: 0x2329, hi: 0x232A},
|
|
26
|
+
{lo: 0x23E9, hi: 0x23EC},
|
|
27
|
+
{lo: 0x23F0, hi: 0x23F0},
|
|
28
|
+
{lo: 0x23F3, hi: 0x23F3},
|
|
29
|
+
{lo: 0x25FD, hi: 0x25FE},
|
|
30
|
+
{lo: 0x2614, hi: 0x2615},
|
|
31
|
+
{lo: 0x2630, hi: 0x2637},
|
|
32
|
+
{lo: 0x2648, hi: 0x2653},
|
|
33
|
+
{lo: 0x267F, hi: 0x267F},
|
|
34
|
+
{lo: 0x268A, hi: 0x268F},
|
|
35
|
+
{lo: 0x2693, hi: 0x2693},
|
|
36
|
+
{lo: 0x26A1, hi: 0x26A1},
|
|
37
|
+
{lo: 0x26AA, hi: 0x26AB},
|
|
38
|
+
{lo: 0x26BD, hi: 0x26BE},
|
|
39
|
+
{lo: 0x26C4, hi: 0x26C5},
|
|
40
|
+
{lo: 0x26CE, hi: 0x26CE},
|
|
41
|
+
{lo: 0x26D4, hi: 0x26D4},
|
|
42
|
+
{lo: 0x26EA, hi: 0x26EA},
|
|
43
|
+
{lo: 0x26F2, hi: 0x26F3},
|
|
44
|
+
{lo: 0x26F5, hi: 0x26F5},
|
|
45
|
+
{lo: 0x26FA, hi: 0x26FA},
|
|
46
|
+
{lo: 0x26FD, hi: 0x26FD},
|
|
47
|
+
{lo: 0x2705, hi: 0x2705},
|
|
48
|
+
{lo: 0x270A, hi: 0x270B},
|
|
49
|
+
{lo: 0x2728, hi: 0x2728},
|
|
50
|
+
{lo: 0x274C, hi: 0x274C},
|
|
51
|
+
{lo: 0x274E, hi: 0x274E},
|
|
52
|
+
{lo: 0x2753, hi: 0x2755},
|
|
53
|
+
{lo: 0x2757, hi: 0x2757},
|
|
54
|
+
{lo: 0x2795, hi: 0x2797},
|
|
55
|
+
{lo: 0x27B0, hi: 0x27B0},
|
|
56
|
+
{lo: 0x27BF, hi: 0x27BF},
|
|
57
|
+
{lo: 0x2B1B, hi: 0x2B1C},
|
|
58
|
+
{lo: 0x2B50, hi: 0x2B50},
|
|
59
|
+
{lo: 0x2B55, hi: 0x2B55},
|
|
60
|
+
{lo: 0x2E80, hi: 0x2E99},
|
|
61
|
+
{lo: 0x2E9B, hi: 0x2EF3},
|
|
62
|
+
{lo: 0x2F00, hi: 0x2FD5},
|
|
63
|
+
{lo: 0x2FF0, hi: 0x2FFF},
|
|
64
|
+
{lo: 0x3001, hi: 0x303E},
|
|
65
|
+
{lo: 0x3041, hi: 0x3096},
|
|
66
|
+
{lo: 0x3099, hi: 0x30FF},
|
|
67
|
+
{lo: 0x3105, hi: 0x312F},
|
|
68
|
+
{lo: 0x3131, hi: 0x318E},
|
|
69
|
+
{lo: 0x3190, hi: 0x31E5},
|
|
70
|
+
{lo: 0x31EF, hi: 0x321E},
|
|
71
|
+
{lo: 0x3220, hi: 0x3247},
|
|
72
|
+
{lo: 0x3250, hi: 0xA48C},
|
|
73
|
+
{lo: 0xA490, hi: 0xA4C6},
|
|
74
|
+
{lo: 0xA960, hi: 0xA97C},
|
|
75
|
+
{lo: 0xAC00, hi: 0xD7A3},
|
|
76
|
+
{lo: 0xF900, hi: 0xFAFF},
|
|
77
|
+
{lo: 0xFE10, hi: 0xFE19},
|
|
78
|
+
{lo: 0xFE30, hi: 0xFE52},
|
|
79
|
+
{lo: 0xFE54, hi: 0xFE66},
|
|
80
|
+
{lo: 0xFE68, hi: 0xFE6B},
|
|
81
|
+
{lo: 0x16FE0, hi: 0x16FE4},
|
|
82
|
+
{lo: 0x16FF0, hi: 0x16FF6},
|
|
83
|
+
{lo: 0x17000, hi: 0x18CD5},
|
|
84
|
+
{lo: 0x18CFF, hi: 0x18D1E},
|
|
85
|
+
{lo: 0x18D80, hi: 0x18DF2},
|
|
86
|
+
{lo: 0x1AFF0, hi: 0x1AFF3},
|
|
87
|
+
{lo: 0x1AFF5, hi: 0x1AFFB},
|
|
88
|
+
{lo: 0x1AFFD, hi: 0x1AFFE},
|
|
89
|
+
{lo: 0x1B000, hi: 0x1B122},
|
|
90
|
+
{lo: 0x1B132, hi: 0x1B132},
|
|
91
|
+
{lo: 0x1B150, hi: 0x1B152},
|
|
92
|
+
{lo: 0x1B155, hi: 0x1B155},
|
|
93
|
+
{lo: 0x1B164, hi: 0x1B167},
|
|
94
|
+
{lo: 0x1B170, hi: 0x1B2FB},
|
|
95
|
+
{lo: 0x1D300, hi: 0x1D356},
|
|
96
|
+
{lo: 0x1D360, hi: 0x1D376},
|
|
97
|
+
{lo: 0x1F004, hi: 0x1F004},
|
|
98
|
+
{lo: 0x1F0CF, hi: 0x1F0CF},
|
|
99
|
+
{lo: 0x1F18E, hi: 0x1F18E},
|
|
100
|
+
{lo: 0x1F191, hi: 0x1F19A},
|
|
101
|
+
{lo: 0x1F200, hi: 0x1F202},
|
|
102
|
+
{lo: 0x1F210, hi: 0x1F23B},
|
|
103
|
+
{lo: 0x1F240, hi: 0x1F248},
|
|
104
|
+
{lo: 0x1F250, hi: 0x1F251},
|
|
105
|
+
{lo: 0x1F260, hi: 0x1F265},
|
|
106
|
+
{lo: 0x1F300, hi: 0x1F320},
|
|
107
|
+
{lo: 0x1F32D, hi: 0x1F335},
|
|
108
|
+
{lo: 0x1F337, hi: 0x1F37C},
|
|
109
|
+
{lo: 0x1F37E, hi: 0x1F393},
|
|
110
|
+
{lo: 0x1F3A0, hi: 0x1F3CA},
|
|
111
|
+
{lo: 0x1F3CF, hi: 0x1F3D3},
|
|
112
|
+
{lo: 0x1F3E0, hi: 0x1F3F0},
|
|
113
|
+
{lo: 0x1F3F4, hi: 0x1F3F4},
|
|
114
|
+
{lo: 0x1F3F8, hi: 0x1F43E},
|
|
115
|
+
{lo: 0x1F440, hi: 0x1F440},
|
|
116
|
+
{lo: 0x1F442, hi: 0x1F4FC},
|
|
117
|
+
{lo: 0x1F4FF, hi: 0x1F53D},
|
|
118
|
+
{lo: 0x1F54B, hi: 0x1F54E},
|
|
119
|
+
{lo: 0x1F550, hi: 0x1F567},
|
|
120
|
+
{lo: 0x1F57A, hi: 0x1F57A},
|
|
121
|
+
{lo: 0x1F595, hi: 0x1F596},
|
|
122
|
+
{lo: 0x1F5A4, hi: 0x1F5A4},
|
|
123
|
+
{lo: 0x1F5FB, hi: 0x1F64F},
|
|
124
|
+
{lo: 0x1F680, hi: 0x1F6C5},
|
|
125
|
+
{lo: 0x1F6CC, hi: 0x1F6CC},
|
|
126
|
+
{lo: 0x1F6D0, hi: 0x1F6D2},
|
|
127
|
+
{lo: 0x1F6D5, hi: 0x1F6D8},
|
|
128
|
+
{lo: 0x1F6DC, hi: 0x1F6DF},
|
|
129
|
+
{lo: 0x1F6EB, hi: 0x1F6EC},
|
|
130
|
+
{lo: 0x1F6F4, hi: 0x1F6FC},
|
|
131
|
+
{lo: 0x1F7E0, hi: 0x1F7EB},
|
|
132
|
+
{lo: 0x1F7F0, hi: 0x1F7F0},
|
|
133
|
+
{lo: 0x1F90C, hi: 0x1F93A},
|
|
134
|
+
{lo: 0x1F93C, hi: 0x1F945},
|
|
135
|
+
{lo: 0x1F947, hi: 0x1F9FF},
|
|
136
|
+
{lo: 0x1FA70, hi: 0x1FA7C},
|
|
137
|
+
{lo: 0x1FA80, hi: 0x1FA8A},
|
|
138
|
+
{lo: 0x1FA8E, hi: 0x1FAC6},
|
|
139
|
+
{lo: 0x1FAC8, hi: 0x1FAC8},
|
|
140
|
+
{lo: 0x1FACD, hi: 0x1FADC},
|
|
141
|
+
{lo: 0x1FADF, hi: 0x1FAEA},
|
|
142
|
+
{lo: 0x1FAEF, hi: 0x1FAF8},
|
|
143
|
+
{lo: 0x20000, hi: 0x2FFFD},
|
|
144
|
+
{lo: 0x30000, hi: 0x3FFFD},
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
var prettierFullWidthRanges = [...]unicodeRange{
|
|
148
|
+
{lo: 0x3000, hi: 0x3000},
|
|
149
|
+
{lo: 0xFF01, hi: 0xFF60},
|
|
150
|
+
{lo: 0xFFE0, hi: 0xFFE6},
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
var prettierNarrowEmojiRanges = [...]unicodeRange{
|
|
154
|
+
{lo: 0x00A9, hi: 0x00A9},
|
|
155
|
+
{lo: 0x00AE, hi: 0x00AE},
|
|
156
|
+
{lo: 0x203C, hi: 0x203C},
|
|
157
|
+
{lo: 0x2049, hi: 0x2049},
|
|
158
|
+
{lo: 0x2122, hi: 0x2122},
|
|
159
|
+
{lo: 0x2139, hi: 0x2139},
|
|
160
|
+
{lo: 0x2194, hi: 0x2199},
|
|
161
|
+
{lo: 0x21A9, hi: 0x21AA},
|
|
162
|
+
{lo: 0x2328, hi: 0x2328},
|
|
163
|
+
{lo: 0x23CF, hi: 0x23CF},
|
|
164
|
+
{lo: 0x23F1, hi: 0x23F2},
|
|
165
|
+
{lo: 0x23F8, hi: 0x23FA},
|
|
166
|
+
{lo: 0x25AA, hi: 0x25AB},
|
|
167
|
+
{lo: 0x25B6, hi: 0x25B6},
|
|
168
|
+
{lo: 0x25C0, hi: 0x25C0},
|
|
169
|
+
{lo: 0x25FB, hi: 0x25FC},
|
|
170
|
+
{lo: 0x2600, hi: 0x2604},
|
|
171
|
+
{lo: 0x260E, hi: 0x260E},
|
|
172
|
+
{lo: 0x2611, hi: 0x2611},
|
|
173
|
+
{lo: 0x2618, hi: 0x2618},
|
|
174
|
+
{lo: 0x261D, hi: 0x261D},
|
|
175
|
+
{lo: 0x2620, hi: 0x2620},
|
|
176
|
+
{lo: 0x2622, hi: 0x2623},
|
|
177
|
+
{lo: 0x2626, hi: 0x2626},
|
|
178
|
+
{lo: 0x262A, hi: 0x262A},
|
|
179
|
+
{lo: 0x262E, hi: 0x262F},
|
|
180
|
+
{lo: 0x2638, hi: 0x263A},
|
|
181
|
+
{lo: 0x2640, hi: 0x2640},
|
|
182
|
+
{lo: 0x2642, hi: 0x2642},
|
|
183
|
+
{lo: 0x265F, hi: 0x2660},
|
|
184
|
+
{lo: 0x2663, hi: 0x2663},
|
|
185
|
+
{lo: 0x2665, hi: 0x2666},
|
|
186
|
+
{lo: 0x2668, hi: 0x2668},
|
|
187
|
+
{lo: 0x267B, hi: 0x267B},
|
|
188
|
+
{lo: 0x267E, hi: 0x267E},
|
|
189
|
+
{lo: 0x2692, hi: 0x2692},
|
|
190
|
+
{lo: 0x2694, hi: 0x2697},
|
|
191
|
+
{lo: 0x2699, hi: 0x2699},
|
|
192
|
+
{lo: 0x269B, hi: 0x269C},
|
|
193
|
+
{lo: 0x26A0, hi: 0x26A0},
|
|
194
|
+
{lo: 0x26A7, hi: 0x26A7},
|
|
195
|
+
{lo: 0x26B0, hi: 0x26B1},
|
|
196
|
+
{lo: 0x26C8, hi: 0x26C8},
|
|
197
|
+
{lo: 0x26CF, hi: 0x26CF},
|
|
198
|
+
{lo: 0x26D1, hi: 0x26D1},
|
|
199
|
+
{lo: 0x26D3, hi: 0x26D3},
|
|
200
|
+
{lo: 0x26E9, hi: 0x26E9},
|
|
201
|
+
{lo: 0x26F1, hi: 0x26F1},
|
|
202
|
+
{lo: 0x26F7, hi: 0x26F9},
|
|
203
|
+
{lo: 0x2702, hi: 0x2702},
|
|
204
|
+
{lo: 0x2708, hi: 0x2709},
|
|
205
|
+
{lo: 0x270C, hi: 0x270D},
|
|
206
|
+
{lo: 0x270F, hi: 0x270F},
|
|
207
|
+
{lo: 0x2712, hi: 0x2712},
|
|
208
|
+
{lo: 0x2714, hi: 0x2714},
|
|
209
|
+
{lo: 0x2716, hi: 0x2716},
|
|
210
|
+
{lo: 0x271D, hi: 0x271D},
|
|
211
|
+
{lo: 0x2721, hi: 0x2721},
|
|
212
|
+
{lo: 0x2733, hi: 0x2734},
|
|
213
|
+
{lo: 0x2744, hi: 0x2744},
|
|
214
|
+
{lo: 0x2747, hi: 0x2747},
|
|
215
|
+
{lo: 0x2763, hi: 0x2764},
|
|
216
|
+
{lo: 0x27A1, hi: 0x27A1},
|
|
217
|
+
{lo: 0x2934, hi: 0x2935},
|
|
218
|
+
{lo: 0x2B05, hi: 0x2B07},
|
|
219
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttsc/lint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"description": "Reference ttsc plugin: ESLint-style lint rules over the TypeScript-Go Program used by the type-check pass.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@types/node": "^25.3.0",
|
|
38
38
|
"rimraf": "^6.1.2",
|
|
39
39
|
"typescript": "^7.0.2",
|
|
40
|
-
"ttsc": "0.
|
|
40
|
+
"ttsc": "0.20.1"
|
|
41
41
|
},
|
|
42
42
|
"repository": {
|
|
43
43
|
"type": "git",
|