|
2 | 2 |
|
3 | 3 | const blocks = new Map();
|
4 | 4 | const new_block = () => ({ transformed_code: '', line_offsets: null, translations: new Map() });
|
5 |
| -let custom_compiler, default_compiler, compiler_options, messages, ignore_warnings, ignore_styles, var_names; |
| 5 | +let custom_compiler, default_compiler, compiler_options, messages, ignore_warnings, ignore_styles, named_blocks, var_names; |
6 | 6 |
|
7 | 7 | // get the total length, number of lines, and length of the last line of a string
|
8 | 8 | const get_offsets = str => {
|
@@ -291,7 +291,7 @@ const preprocess = text => {
|
291 | 291 | }
|
292 | 292 |
|
293 | 293 | // return processed string
|
294 |
| -return [...blocks].map(([filename, { transformed_code: text }]) => ({ text, filename })); |
| 294 | +return [...blocks].map(([filename, { transformed_code: text }]) => named_blocks ? { text, filename } : text); |
295 | 295 | };
|
296 | 296 |
|
297 | 297 | // extract the string referenced by a message
|
@@ -367,6 +367,7 @@ Linter.prototype.verify = function(code, config, options) {
|
367 | 367 | ignore_warnings = settings['svelte3/ignore-warnings'];
|
368 | 368 | ignore_styles = settings['svelte3/ignore-styles'];
|
369 | 369 | compiler_options = settings['svelte3/compiler-options'];
|
| 370 | +named_blocks = settings['svelte3/named-blocks']; |
370 | 371 | // call original Linter#verify
|
371 | 372 | return verify.call(this, code, config, options);
|
372 | 373 | };
|
|
0 commit comments