Javascript: react/jsx-quotes is deprecated. Use jsx-quotes instead

Created on 16 Sep 2015  路  12Comments  路  Source: airbnb/javascript

React/jsx-quotes has been deprecated in latest version of eslint.

Most helpful comment

Just a heads up, to get rid of these errors override the react/jsx-quotes rule in your eslintrc file with 0. Then you can specify jsx-quotes rule. You can also just not specify the extra rule to avoid causing issues in 3P packages that may have not updated eslint (gulp-eslint seems to fail)

// Use this file as a starting point for your project's .eslintrc.
// Copy this file, and add rule overrides as needed.
{
  "extends": "airbnb",
  "rules": {
    "react/jsx-quotes": 0,
    "jsx-quotes": [2, "prefer-double"]
  }
}

All 12 comments

:+1:

:+1: We're getting these errors when linting as well.

Just a heads up, to get rid of these errors override the react/jsx-quotes rule in your eslintrc file with 0. Then you can specify jsx-quotes rule. You can also just not specify the extra rule to avoid causing issues in 3P packages that may have not updated eslint (gulp-eslint seems to fail)

// Use this file as a starting point for your project's .eslintrc.
// Copy this file, and add rule overrides as needed.
{
  "extends": "airbnb",
  "rules": {
    "react/jsx-quotes": 0,
    "jsx-quotes": [2, "prefer-double"]
  }
}

We were actually running into it on a code base that doesn't use react at all, so we just did:

{
  "extends": "airbnb/base"
}

which doesn't load the react linting modules.

:+1: @nackjicholson

:+1: @brad-decker

And there already are PRs for upgrading eslint and the config in eslint-config-airbnb/react.js

https://github.com/airbnb/javascript/pull/518
https://github.com/airbnb/javascript/pull/514

@nackjicholson thanks for the tip, I'm not using react either but my lint tests started failing because of that deprecation error.

Just a ping. What's going on with these issues #513 #514 #518

These are all aimed at fixing this issue with jsx-quotes deprecation.

But I've noticed another issue. I'm using both the airbnb presets for JSCS and ESLint, and they disagree on this point about whether to use a single quote or double quote in jsx.

airbnb JSCS says it wants singles: <Hello text='world'/>
airbnb ESLint says it wants doubles: <Hello text="world"/>

I can fix it by doing this in my jscsConfig:

{
  "validateQuoteMarks": { "mark": "'", "escape": true, "ignoreJSX": true }
}

Maybe that should just be turned on by default in the airbnb preset for JSCS.

@nackjicholson JSX should be using double quotes, everything else, single quotes - a PR is very welcome to fix that.

Similarly, a separate PR to use jsx-quotes instead of react/jsx-quotes is welcome!

Airbnb JSCS preset updated here: https://github.com/jscs-dev/node-jscs/issues/2007#issuecomment-162665407

This is fixed in #521.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

felixsanz picture felixsanz  路  3Comments

stephenkingsley picture stephenkingsley  路  3Comments

golopot picture golopot  路  3Comments

progre picture progre  路  3Comments

tpiros picture tpiros  路  3Comments