@jesscss/plugin-less 2.0.0-alpha.2
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/LICENSE +21 -0
- package/README.md +3 -0
- package/lib/index.d.ts +23 -0
- package/lib/index.js +264 -0
- package/lib/index.js.map +1 -0
- package/lib/options.d.ts +5 -0
- package/lib/options.js +2 -0
- package/lib/options.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Matthew Dean
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AbstractPlugin, type ISafeParseResult } from '@jesscss/core';
|
|
2
|
+
import type { EqualityMode, MathMode, UnitMode, LessOptions } from 'styles-config';
|
|
3
|
+
import { Parser } from '@jesscss/less-parser';
|
|
4
|
+
export declare class LessPlugin extends AbstractPlugin {
|
|
5
|
+
opts: LessOptions;
|
|
6
|
+
name: string;
|
|
7
|
+
supportedExtensions: string[];
|
|
8
|
+
parser: Parser;
|
|
9
|
+
mathMode: MathMode;
|
|
10
|
+
unitMode: UnitMode;
|
|
11
|
+
equalityMode: EqualityMode;
|
|
12
|
+
leakyRules: boolean;
|
|
13
|
+
bubbleRootAtRules: boolean;
|
|
14
|
+
collapseNesting: boolean;
|
|
15
|
+
constructor(opts?: LessOptions);
|
|
16
|
+
private _registerFunctions;
|
|
17
|
+
expandImport(importPath: string, currentDir: string): string[];
|
|
18
|
+
resolve(filePath: string | string[], currentDir: string, searchPaths: string[]): string[];
|
|
19
|
+
safeParse(filePath: string, source: string): ISafeParseResult;
|
|
20
|
+
}
|
|
21
|
+
export type { LessOptions } from 'styles-config';
|
|
22
|
+
declare const lessPlugin: (opts?: LessOptions) => LessPlugin;
|
|
23
|
+
export default lessPlugin;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { AbstractPlugin, TreeContext, JsFunction, getErrorFromParser, toDiagnostic, extractRelevantLines } from '@jesscss/core';
|
|
2
|
+
import * as lessFunctions from '@jesscss/fns';
|
|
3
|
+
import { Parser } from '@jesscss/less-parser';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { createRequire } from 'node:module';
|
|
6
|
+
import { expandLessImportCandidates } from '@jesscss/style-resolver';
|
|
7
|
+
export class LessPlugin extends AbstractPlugin {
|
|
8
|
+
opts;
|
|
9
|
+
name = 'less';
|
|
10
|
+
supportedExtensions = ['.less'];
|
|
11
|
+
parser;
|
|
12
|
+
mathMode;
|
|
13
|
+
unitMode;
|
|
14
|
+
equalityMode;
|
|
15
|
+
leakyRules;
|
|
16
|
+
bubbleRootAtRules;
|
|
17
|
+
collapseNesting;
|
|
18
|
+
constructor(opts = {}) {
|
|
19
|
+
super();
|
|
20
|
+
this.opts = opts;
|
|
21
|
+
// Handle deprecated math option -> mathMode conversion
|
|
22
|
+
let mathMode;
|
|
23
|
+
if (opts.mathMode !== undefined) {
|
|
24
|
+
mathMode = opts.mathMode;
|
|
25
|
+
}
|
|
26
|
+
else if (opts.math !== undefined) {
|
|
27
|
+
// Convert deprecated math option to mathMode
|
|
28
|
+
if (opts.math === 0 || opts.math === 'always') {
|
|
29
|
+
mathMode = 'always';
|
|
30
|
+
}
|
|
31
|
+
else if (opts.math === 1 || opts.math === 'parens-division') {
|
|
32
|
+
mathMode = 'parens-division';
|
|
33
|
+
}
|
|
34
|
+
else if (opts.math === 2 || opts.math === 'parens' || opts.math === 'strict') {
|
|
35
|
+
mathMode = 'parens';
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// 3 or 'strict-legacy' -> 'parens' (deprecated, use 'strict' instead)
|
|
39
|
+
mathMode = 'parens';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
mathMode = 'parens-division';
|
|
44
|
+
}
|
|
45
|
+
this.mathMode = mathMode;
|
|
46
|
+
// Handle deprecated strictUnits option -> unitMode conversion
|
|
47
|
+
let unitMode;
|
|
48
|
+
if (opts.unitMode !== undefined) {
|
|
49
|
+
unitMode = opts.unitMode;
|
|
50
|
+
}
|
|
51
|
+
else if (opts.strictUnits === true) {
|
|
52
|
+
unitMode = 'strict';
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
unitMode = 'preserve';
|
|
56
|
+
}
|
|
57
|
+
this.unitMode = unitMode;
|
|
58
|
+
this.equalityMode = opts.equalityMode ?? 'coerce';
|
|
59
|
+
this.leakyRules = opts.leakyRules ?? true;
|
|
60
|
+
this.bubbleRootAtRules = opts.bubbleRootAtRules ?? true;
|
|
61
|
+
this.collapseNesting = opts.collapseNesting ?? false;
|
|
62
|
+
// Pass options to parser (including leakyRules, defaulting to true)
|
|
63
|
+
this.parser = new Parser();
|
|
64
|
+
}
|
|
65
|
+
_registerFunctions(tree) {
|
|
66
|
+
const registeredNames = [];
|
|
67
|
+
for (const [key, value] of Object.entries(lessFunctions)) {
|
|
68
|
+
if (typeof value !== 'function') {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const runtimeName = value.name ?? key;
|
|
72
|
+
tree.register('function', new JsFunction({ name: runtimeName, fn: value }));
|
|
73
|
+
registeredNames.push(runtimeName);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
expandImport(importPath, currentDir) {
|
|
77
|
+
void currentDir;
|
|
78
|
+
// Keep import expansion in sync with the language service.
|
|
79
|
+
return expandLessImportCandidates(importPath);
|
|
80
|
+
}
|
|
81
|
+
resolve(filePath, currentDir, searchPaths) {
|
|
82
|
+
const paths = Array.isArray(filePath) ? filePath : [filePath];
|
|
83
|
+
const mapped = paths.map((candidate) => {
|
|
84
|
+
if (candidate.startsWith('@less/test-import-module/')) {
|
|
85
|
+
const after = candidate.slice('@less/test-import-module/'.length);
|
|
86
|
+
const marker = `${path.sep}packages${path.sep}test-data${path.sep}`;
|
|
87
|
+
const idx = currentDir.indexOf(marker);
|
|
88
|
+
if (idx !== -1) {
|
|
89
|
+
const packagesRoot = currentDir.slice(0, idx + `${path.sep}packages`.length);
|
|
90
|
+
return path.join(packagesRoot, 'test-import-module', after);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const m = candidate.match(/^https?:\/\/cdn\.jsdelivr\.net\/npm\/([^?#]+)(?:[?#].*)?$/i);
|
|
94
|
+
if (m?.[1]) {
|
|
95
|
+
return m[1];
|
|
96
|
+
}
|
|
97
|
+
const mProtocolRelative = candidate.match(/^\/\/cdn\.jsdelivr\.net\/npm\/([^?#]+)(?:[?#].*)?$/i);
|
|
98
|
+
if (mProtocolRelative?.[1]) {
|
|
99
|
+
return mProtocolRelative[1];
|
|
100
|
+
}
|
|
101
|
+
return candidate;
|
|
102
|
+
});
|
|
103
|
+
const resolved = super.resolve(mapped, currentDir, searchPaths);
|
|
104
|
+
const out = [...resolved];
|
|
105
|
+
const bases = [currentDir, ...searchPaths, process.cwd()];
|
|
106
|
+
const looksBareSpecifier = (p) => !path.isAbsolute(p)
|
|
107
|
+
&& !p.startsWith('./')
|
|
108
|
+
&& !p.startsWith('../')
|
|
109
|
+
&& !p.startsWith('/')
|
|
110
|
+
&& !/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(p);
|
|
111
|
+
for (const candidate of mapped) {
|
|
112
|
+
if (!looksBareSpecifier(candidate)) {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
for (const base of bases) {
|
|
116
|
+
const baseDir = path.isAbsolute(base) ? base : path.resolve(currentDir, base);
|
|
117
|
+
try {
|
|
118
|
+
const req = createRequire(path.join(baseDir, '__jess_resolve__.js'));
|
|
119
|
+
const resolvedModule = req.resolve(candidate);
|
|
120
|
+
if (!out.includes(resolvedModule)) {
|
|
121
|
+
out.push(resolvedModule);
|
|
122
|
+
}
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
try {
|
|
127
|
+
const req = createRequire(path.join(baseDir, '__jess_resolve__.js'));
|
|
128
|
+
const resolvedModuleLess = req.resolve(`${candidate}.less`);
|
|
129
|
+
if (!out.includes(resolvedModuleLess)) {
|
|
130
|
+
out.push(resolvedModuleLess);
|
|
131
|
+
}
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
// keep trying other base dirs
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return out;
|
|
141
|
+
}
|
|
142
|
+
safeParse(filePath, source) {
|
|
143
|
+
const context = new TreeContext({
|
|
144
|
+
file: {
|
|
145
|
+
name: path.basename(filePath),
|
|
146
|
+
path: path.dirname(filePath),
|
|
147
|
+
fullPath: filePath,
|
|
148
|
+
source: source
|
|
149
|
+
},
|
|
150
|
+
mathMode: this.mathMode,
|
|
151
|
+
unitMode: this.unitMode,
|
|
152
|
+
equalityMode: this.equalityMode,
|
|
153
|
+
plugin: this,
|
|
154
|
+
collapseNesting: this.collapseNesting,
|
|
155
|
+
leakyRules: this.leakyRules,
|
|
156
|
+
bubbleRootAtRules: this.bubbleRootAtRules
|
|
157
|
+
});
|
|
158
|
+
const errors = [];
|
|
159
|
+
const warnings = [];
|
|
160
|
+
let tree;
|
|
161
|
+
try {
|
|
162
|
+
const parseResult = this.parser.parse(source, 'stylesheet', { context });
|
|
163
|
+
tree = parseResult.tree;
|
|
164
|
+
// Convert parser deprecation warnings to diagnostics
|
|
165
|
+
if ('warnings' in parseResult && parseResult.warnings) {
|
|
166
|
+
for (const warning of parseResult.warnings) {
|
|
167
|
+
const line = warning.token?.startLine ?? 1;
|
|
168
|
+
const column = warning.token?.startColumn ?? 1;
|
|
169
|
+
warnings.push({
|
|
170
|
+
code: 'parse/deprecated',
|
|
171
|
+
phase: 'parse',
|
|
172
|
+
message: warning.message,
|
|
173
|
+
reason: warning.message,
|
|
174
|
+
fix: 'Update your code to use the recommended syntax.',
|
|
175
|
+
file: context.file,
|
|
176
|
+
filePath: filePath,
|
|
177
|
+
line,
|
|
178
|
+
column,
|
|
179
|
+
lines: extractRelevantLines(source, line)
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// Convert all parser/lexer errors to normalized diagnostics
|
|
184
|
+
if (parseResult.errors.length || parseResult.lexerResult?.errors?.length) {
|
|
185
|
+
// Convert each parser error to a diagnostic
|
|
186
|
+
for (const error of parseResult.errors) {
|
|
187
|
+
const line = error.token?.startLine ?? error.line ?? 1;
|
|
188
|
+
const jessError = getErrorFromParser([error], undefined, filePath, source, { file: context.file });
|
|
189
|
+
const diagnostic = toDiagnostic(jessError);
|
|
190
|
+
// Ensure lines are extracted
|
|
191
|
+
if (!diagnostic.lines) {
|
|
192
|
+
diagnostic.lines = extractRelevantLines(source, line);
|
|
193
|
+
}
|
|
194
|
+
if ('errors' in diagnostic) {
|
|
195
|
+
errors.push(diagnostic);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
warnings.push(diagnostic);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// Convert lexer errors
|
|
202
|
+
if (parseResult.lexerResult?.errors) {
|
|
203
|
+
for (const lexError of parseResult.lexerResult.errors) {
|
|
204
|
+
const line = lexError.line ?? 1;
|
|
205
|
+
const jessError = getErrorFromParser([], [lexError], filePath, source, { file: context.file });
|
|
206
|
+
const diagnostic = toDiagnostic(jessError);
|
|
207
|
+
// Ensure lines are extracted
|
|
208
|
+
if (!diagnostic.lines) {
|
|
209
|
+
diagnostic.lines = extractRelevantLines(source, line);
|
|
210
|
+
}
|
|
211
|
+
if ('errors' in diagnostic) {
|
|
212
|
+
errors.push(diagnostic);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
warnings.push(diagnostic);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
// Convert caught error to diagnostic
|
|
223
|
+
if (error && typeof error === 'object' && 'severity' in error) {
|
|
224
|
+
const diagnostic = toDiagnostic(error);
|
|
225
|
+
if ('errors' in diagnostic) {
|
|
226
|
+
errors.push(diagnostic);
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
warnings.push(diagnostic);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
errors.push({
|
|
234
|
+
code: 'internal/unknown',
|
|
235
|
+
phase: 'parse',
|
|
236
|
+
message: error?.message || 'Unknown parsing error',
|
|
237
|
+
reason: error?.message || 'An unexpected error occurred during parsing.',
|
|
238
|
+
fix: 'Check the file syntax and ensure it is valid.',
|
|
239
|
+
file: context.file,
|
|
240
|
+
filePath: filePath,
|
|
241
|
+
line: 1,
|
|
242
|
+
column: 1,
|
|
243
|
+
lines: extractRelevantLines(source, 1)
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
// Return with errors/warnings only (no tree)
|
|
247
|
+
return { errors, warnings };
|
|
248
|
+
}
|
|
249
|
+
// Only register functions if parsing succeeded without errors
|
|
250
|
+
if (tree && errors.length === 0) {
|
|
251
|
+
this._registerFunctions(tree);
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
tree,
|
|
255
|
+
errors,
|
|
256
|
+
warnings
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
const lessPlugin = ((opts) => {
|
|
261
|
+
return new LessPlugin(opts);
|
|
262
|
+
});
|
|
263
|
+
export default lessPlugin;
|
|
264
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,EACd,WAAW,EAGX,UAAU,EAEV,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EAIrB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,aAAa,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAErE,MAAM,OAAO,UAAW,SAAQ,cAAc;IAWzB;IAVnB,IAAI,GAAG,MAAM,CAAC;IACd,mBAAmB,GAAG,CAAC,OAAO,CAAC,CAAC;IAChC,MAAM,CAAS;IACf,QAAQ,CAAW;IACnB,QAAQ,CAAW;IACnB,YAAY,CAAe;IAC3B,UAAU,CAAU;IACpB,iBAAiB,CAAU;IAC3B,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AAC,CAAC;gBACpD,IAAI,QAAQ,IAAI,UAAU,EAAE,CAAC;oBAC3B,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAC1B,CAAC;qBAAM,CAAC;oBACN,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI,EAAE,kBAAkB;oBACxB,KAAK,EAAE,OAAO;oBACd,OAAO,EAAE,KAAK,EAAE,OAAO,IAAI,uBAAuB;oBAClD,MAAM,EAAE,KAAK,EAAE,OAAO,IAAI,8CAA8C;oBACxE,GAAG,EAAE,+CAA+C;oBACpD,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,QAAQ,EAAE,QAAQ;oBAClB,IAAI,EAAE,CAAC;oBACP,MAAM,EAAE,CAAC;oBACT,KAAK,EAAE,oBAAoB,CAAC,MAAM,EAAE,CAAC,CAAC;iBACvC,CAAC,CAAC;YACL,CAAC;YACD,6CAA6C;YAC7C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;QAC9B,CAAC;QAED,8DAA8D;QAC9D,IAAI,IAAI,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QAED,OAAO;YACL,IAAI;YACJ,MAAM;YACN,QAAQ;SACT,CAAC;IACJ,CAAC;CACF;AAID,MAAM,UAAU,GAAG,CAAC,CAAC,IAAkB,EAAE,EAAE;IACzC,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC,CAAkB,CAAC;AAEpB,eAAe,UAAU,CAAC"}
|
package/lib/options.d.ts
ADDED
package/lib/options.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jesscss/plugin-less",
|
|
3
|
+
"publishConfig": {
|
|
4
|
+
"access": "public"
|
|
5
|
+
},
|
|
6
|
+
"description": "A Less stylesheet engine for Jess",
|
|
7
|
+
"version": "2.0.0-alpha.2",
|
|
8
|
+
"main": "lib/index.js",
|
|
9
|
+
"types": "lib/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./lib/index.js",
|
|
13
|
+
"types": "./lib/index.d.ts",
|
|
14
|
+
"source": "./src/index.ts"
|
|
15
|
+
},
|
|
16
|
+
"./*": {
|
|
17
|
+
"types": "./lib/*.d.ts",
|
|
18
|
+
"import": "./lib/*.js",
|
|
19
|
+
"source": "./src/*.ts"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"lib"
|
|
25
|
+
],
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@jesscss/core": "2.0.0-alpha.2",
|
|
28
|
+
"@jesscss/less-parser": "2.0.0-alpha.2",
|
|
29
|
+
"styles-config": "2.0.0-alpha.2",
|
|
30
|
+
"@jesscss/style-resolver": "2.0.0-alpha.2",
|
|
31
|
+
"@jesscss/fns": "2.0.0-alpha.2"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {},
|
|
34
|
+
"author": "Matthew Dean <matthew-dean@users.noreply.github.com>",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/jesscss/jess/issues"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/jesscss/jess#readme",
|
|
40
|
+
"scripts": {
|
|
41
|
+
"ci": "pnpm build && pnpm test",
|
|
42
|
+
"build": "pnpm compile",
|
|
43
|
+
"compile": "tsc -b tsconfig.build.json",
|
|
44
|
+
"test": "vitest --run --passWithNoTests",
|
|
45
|
+
"lint:fix": "eslint --fix '**/*.{js,ts}'",
|
|
46
|
+
"lint": "eslint '**/*.{js,ts}'"
|
|
47
|
+
}
|
|
48
|
+
}
|