You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think there's a problem with the UnnecessaryStringOutput linter.
When dealing with nested values, if there's interpolation, Haml treats it like a script tag, triggering a false positive.
The following spec illustrates the problem.
context 'when tag contains nested text with interpolation' do
let(:haml) { <<-'HAML' }
%tag
Some #{interpolation} text
HAML
it { should_not report_lint }
end
Unfortunately, fixing this by checking for interpolation breaks the following spec:
context 'when script outputs literal string in double quotes' do
let(:haml) { '= "hello #{world}"' }
it { should report_lint }
end
As Haml parses each of these as a script node. You might be able to get around it by checking for a space before the quote as that would give you some indication that an equals sign was present, but that would depend on the SpaceBeforeScript linter to ensure all the matches.
Anyone have any ideas?
The text was updated successfully, but these errors were encountered:
Thanks for the report @fshowalter, and for trying out our unreleased code.
This situation can fortunately be detected by the absence of a leading = to indicate that it is an explicitly defined script node instead of a special case one generated by the HAML parser.
Hey all,
I think there's a problem with the UnnecessaryStringOutput linter.
When dealing with nested values, if there's interpolation, Haml treats it like a script tag, triggering a false positive.
The following spec illustrates the problem.
Unfortunately, fixing this by checking for interpolation breaks the following spec:
As Haml parses each of these as a script node. You might be able to get around it by checking for a space before the quote as that would give you some indication that an equals sign was present, but that would depend on the SpaceBeforeScript linter to ensure all the matches.
Anyone have any ideas?
The text was updated successfully, but these errors were encountered: