@reteps/tree-sitter-htmlmustache 0.0.22 → 0.0.23
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/cli/out/check.js +15 -3
- package/package.json +1 -1
package/cli/out/check.js
CHANGED
|
@@ -177,18 +177,30 @@ function run(args) {
|
|
|
177
177
|
const parser = loadParser();
|
|
178
178
|
let totalErrors = 0;
|
|
179
179
|
let filesWithErrors = 0;
|
|
180
|
+
const cwd = process.cwd();
|
|
181
|
+
const errorOutput = [];
|
|
180
182
|
for (const file of files) {
|
|
183
|
+
const displayPath = node_path_1.default.relative(cwd, file) || file;
|
|
181
184
|
const source = node_fs_1.default.readFileSync(file, 'utf-8');
|
|
182
185
|
const tree = parser.parse(source);
|
|
183
|
-
const errors = collectErrors(tree,
|
|
186
|
+
const errors = collectErrors(tree, displayPath);
|
|
184
187
|
if (errors.length > 0) {
|
|
185
188
|
filesWithErrors++;
|
|
186
189
|
totalErrors += errors.length;
|
|
187
190
|
for (const error of errors) {
|
|
188
|
-
|
|
189
|
-
console.log();
|
|
191
|
+
errorOutput.push(formatError(error, source));
|
|
190
192
|
}
|
|
191
193
|
}
|
|
194
|
+
console.log(errors.length > 0
|
|
195
|
+
? chalk_1.default.red(displayPath)
|
|
196
|
+
: chalk_1.default.dim(displayPath));
|
|
197
|
+
}
|
|
198
|
+
if (errorOutput.length > 0) {
|
|
199
|
+
console.log();
|
|
200
|
+
for (const output of errorOutput) {
|
|
201
|
+
console.log(output);
|
|
202
|
+
console.log();
|
|
203
|
+
}
|
|
192
204
|
}
|
|
193
205
|
console.log(formatSummary(totalErrors, filesWithErrors, files.length));
|
|
194
206
|
return totalErrors > 0 ? 1 : 0;
|