Unexpected usage of singlequote. Open
<div className='servers_available_pie_chart_section'>
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
enforce the consistent use of either double or single quotes in JSX attributes (jsx-quotes)
JSX attribute values can contain string literals, which are delimited with single or double quotes.
Unlike string literals in JavaScript, string literals within JSX attributes can’t contain escaped quotes. If you want to have e.g. a double quote within a JSX attribute value, you have to use single quotes as string delimiter.
Rule Details
This rule enforces the consistent use of either double or single quotes in JSX attributes.
Options
This rule has a string option:
-
"prefer-double"
(default) enforces the use of double quotes for all JSX attribute values that don't contain a double quote. -
"prefer-single"
enforces the use of single quotes for all JSX attribute values that don’t contain a single quote.
prefer-double
Examples of incorrect code for this rule with the default "prefer-double"
option:
/*eslint jsx-quotes: ["error", "prefer-double"]*/
Examples of correct code for this rule with the default "prefer-double"
option:
/*eslint jsx-quotes: ["error", "prefer-double"]*/
prefer-single
Examples of incorrect code for this rule with the "prefer-single"
option:
/*eslint jsx-quotes: ["error", "prefer-single"]*/
Examples of correct code for this rule with the "prefer-single"
option:
/*eslint jsx-quotes: ["error", "prefer-single"]*/
When Not To Use It
You can turn this rule off if you don’t use JSX or if you aren’t concerned with a consistent usage of quotes within JSX attributes.
Related Rules
- [quotes](quotes.md) Source: http://eslint.org/docs/rules/
Similar blocks of code found in 2 locations. Consider refactoring. Open
return (
<div className='servers_available_pie_chart_section'>
<div className="utilization-trend-chart-pf">
<h3>{config.title}</h3>
<div className="current-values" />
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 133.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76