Skip to content

Commit 5d1e4c5

Browse files
committed
fix linebreak-style false positives
1 parent a440921 commit 5d1e4c5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ const get_translation = (text, block, node, options = {}) => {
135135
block.transformed_code += dedented;
136136
translation.offsets = get_offsets(text.slice(0, node.start));
137137
translation.dedent = offsets;
138-
const end = get_offsets(block.transformed_code).lines;
139-
for (let i = translation.unoffsets.lines; i <= end; i++) {
138+
translation.end = get_offsets(block.transformed_code).lines;
139+
for (let i = translation.unoffsets.lines; i <= translation.end; i++) {
140140
block.translations.set(i, translation);
141141
}
142142
block.transformed_code += '\n';
@@ -313,15 +313,16 @@ const get_referenced_string = (block, message) => {
313313
const get_identifier = str => (str && str.match(/^[^\s!"#%&\\'()*+,\-./:;<=>?@[\\\]^`{|}~]+/) || [])[0];
314314

315315
// determine whether this message from ESLint is something we care about
316-
const is_valid_message = (block, message, { options }) => {
316+
const is_valid_message = (block, message, translation) => {
317317
switch (message.ruleId) {
318318
case 'eol-last': return false;
319-
case 'indent': return !options.template;
319+
case 'indent': return !translation.options.template;
320+
case 'linebreak-style': return message.line !== translation.end;
320321
case 'no-labels': return get_identifier(get_referenced_string(block, message)) !== '$';
321322
case 'no-restricted-syntax': return message.nodeType !== 'LabeledStatement' || get_identifier(get_referenced_string(block, message)) !== '$';
322323
case 'no-self-assign': return !var_names.has(get_identifier(get_referenced_string(block, message)));
323324
case 'no-unused-labels': return get_referenced_string(block, message) !== '$';
324-
case 'quotes': return !options.in_quoted_attribute;
325+
case 'quotes': return !translation.options.in_quoted_attribute;
325326
}
326327
return true;
327328
};

0 commit comments

Comments
 (0)