postcss-less icon indicating copy to clipboard operation
postcss-less copied to clipboard

Less: Unknown word CssSyntaxError

Open XhmikosR opened this issue 6 years ago • 8 comments

v10.15.3
6.4.1
[email protected]
[email protected]
[email protected]

Errors

Running "stylelint:dist" (stylelint) task

<input css 1>
 51:2  ×  Unknown word   CssSyntaxError

Expected Behavior

No errors to be thrown

How can we reproduce the behavior?

I will try to pinpoint what exactly is causing this, but in case anyone wants to give it a go just checkout the v3-dev branch of https://github.com/twbs/bootstrap.git

XhmikosR avatar Mar 22 '19 16:03 XhmikosR

All right, it seems the minum less code that triggers this is:

//** `<input>` background color

XhmikosR avatar Mar 22 '19 16:03 XhmikosR

Hmm, maybe this one is an issue with stylelint. Let me make an issue there too.

XhmikosR avatar Mar 22 '19 16:03 XhmikosR

Scratch all the above. After further looking into this it does seems it's a new regression here.

I will try to provide a patch in the next days.

EDIT:

Actually, this triggers the error:

//** Horizontal offset for forms and lists.

but this does not:

// Horizontal offset for forms and lists.

Which doesn't make any sense since you cover this case in your tests.

XhmikosR avatar Mar 22 '19 17:03 XhmikosR

Thanks for reporting this. It might be due to the two asterisks in a row, possible edge case. I might have time tonight to take a look, otherwise might have to wait until Monday (will be heading out of town).

(minor side note: please don't modify the issue template, and do please use the Edit function rather than multiple comments. I was pretty confused until I got to your last comment)

shellscape avatar Mar 22 '19 21:03 shellscape

My main problem is that this passes your test suite. But it fails in our branch where there are new lines and consecutive comments like the above

On Fri, Mar 22, 2019, 23:33 Andrew Powell [email protected] wrote:

Thanks for reporting this. It might be due to the two asterisks in a row, possible edge case. I might have time tonight to take a look, otherwise might have to wait until Monday (will be heading out of town).

(minor side note: please don't modify the issue template, and do please use the Edit function rather than multiple comments. I was pretty confused until I got to your last comment)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/shellscape/postcss-less/issues/138#issuecomment-475790685, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVVtUC5PPPicEiLzlJqutkbuf50SimIks5vZUwOgaJpZM4cD75A .

XhmikosR avatar Mar 22 '19 22:03 XhmikosR

I just ran your sample LESS and this was the result I received:

Sample:

`//** Horizontal offset for forms and lists.`

Result:

Comment {
  raws: { before: '', begin: '//', left: '', right: '' },
  type: 'comment',
  parent:
   Root {
     raws: { semicolon: false, after: '' },
     type: 'root',
     nodes: [ [Circular] ],
     source: { input: [Input], start: [Object] } },
  source:
   { start: { line: 1, column: 1 },
     input:
      Input {
        css: '//** Horizontal offset for forms and lists.',
        hasBOM: false,
        id: '<input css 1>' },
     end: { line: 1, column: 2 } },
  inline: true,
  text: '** Horizontal offset for forms and lists.' }

However, when I run this sample:

`//** Horizontal offset for forms and lists.\n`

I get a CssSyntaxError. I'm not sure if this is what you were eluding to, but it would seem that a comment with a leading asterisk and ending with a newline causes this problem. I also confirmed this on a small sample //*a\n.

shellscape avatar Mar 22 '19 23:03 shellscape

Yes, it seems the newline is causing the error indeed. Because whatever I tried as one line, worked fine in your tests.

Just to make sure everything is fine, I will confirm later with our v3-dev branch.

XhmikosR avatar Mar 22 '19 23:03 XhmikosR

I tried to find a solution to this to no avail. It does throw if I do '//** Horizontal offset for forms and lists.\n'.

Let me know if there's something else I can do to help.

XhmikosR avatar Mar 26 '19 14:03 XhmikosR