ricardofbarros / linter-js-standard

Atom linter plugin for JavaScript, using JavaScript Standard Style
https://atom.io/packages/linter-js-standard
MIT License
99 stars 50 forks source link

Wrong indentation warning for nested JS templates #223

Closed mercmobily closed 5 years ago

mercmobily commented 5 years ago

Hi,

I am not sure if this belongs to linter itself or here. This is a small example to show the problem: (I realise the code doesn't do much, it was working code butchered for brevity)

function render () {
  const {html, _items} = this;
  return html`
    <style>
      :host { display: block; }
    </style>
    <p ?hidden="${_items.length !== 0}">Please add some products to cart.</p>
    ${_items.map((item) => {
      console.log('aaa')
    })}
  `;
}
render();

The console.log line gives a warning: `expected indentation of 4 spaces but found 6 The following line has the same problem.

Help?

sonicdoe commented 5 years ago

It looks like this issue actually occurs in standard (since v11), see https://github.com/standard/standard/issues/1056 and https://github.com/standard/standard/issues/1176. I see you also already opened an issue over at https://github.com/eslint/eslint/issues/10932.

mercmobily commented 5 years ago

I know but it looks like the issues stems from eslint more than standard... right?

sonicdoe commented 5 years ago

Yes, I think so too.

mercmobily commented 5 years ago

This issue depends on https://github.com/eslint/eslint/issues/10932 -- I am not sure how you deal with these cases in this repo. However, it's basically up to Eslint to fix it.

sonicdoe commented 5 years ago

Since there isn’t anything we can do about this in this plugin, I’ll go ahead and close this issue.