standard / vscode-standard

VS Code extension for JavaScript Standard Style (`standard`) with automatic fixing

Home Page:https://marketplace.visualstudio.com/items?itemName=standard.vscode-standard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lints doublequotes in JSX HTML

alexchandel opened this issue · comments

commented

What version of this package are you using?
1.4.0

What operating system, Node.js, and npm version?
macOS 11, v15.14.0, 7.9.0

What happened?

The double quotes below are unexpectedly linted:

import logo from './logo.svg'
import './App.css'

function App () {
  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <p>
          Edit <code>src/App.js</code> and save to reload.
        </p>
        <a
          className="App-link"
          href="https://reactjs.org"
          target="_blank"
          rel="noopener noreferrer"
        >
          Learn React
        </a>
      </header>
    </div>
  )
}

export default App

What did you expect to happen?
HTML was correctly detected, but double quotes are standard in HTML.

Are you willing to submit a pull request to fix this bug?
Is this intended?

JSX != HTML though, I personally think it's better to be consistent with the surrounding plain javascript code than to be consistent with another language (even though that language was the inspiration for JSX)

commented

But essentially no one uses single quotes in HTML, and almost as few use single-quotes in JSX, surveying git repos. Far fewer than any other style choice of standard-js.

Wouldn't it be better to adopt a normal standard?

commented

@LinusU @divlo If being consistent with surrounding code is greater than consistency with the language, why not lint JS embedded in script tags with double-quotes?

Consistency is clearly a criterion as well. And JSX attribute tags are properly consistent with HTML attribute tags, no?