Skip to content

Commit ccc18a8

Browse files
committed
put named code blocks behind svelte3/named-blocks
1 parent db8aa82 commit ccc18a8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const blocks = new Map();
44
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;
66

77
// get the total length, number of lines, and length of the last line of a string
88
const get_offsets = str => {
@@ -291,7 +291,7 @@ const preprocess = text => {
291291
}
292292

293293
// 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);
295295
};
296296

297297
// extract the string referenced by a message
@@ -367,6 +367,7 @@ Linter.prototype.verify = function(code, config, options) {
367367
ignore_warnings = settings['svelte3/ignore-warnings'];
368368
ignore_styles = settings['svelte3/ignore-styles'];
369369
compiler_options = settings['svelte3/compiler-options'];
370+
named_blocks = settings['svelte3/named-blocks'];
370371
// call original Linter#verify
371372
return verify.call(this, code, config, options);
372373
};

0 commit comments

Comments
 (0)