Skip to content

Commit 0e4bb41

Browse files
markusguentherwardpeet
authored andcommitted
chore: Fix ESLint warnings (#10968)
## Description Some packages throw aslant warnings and this PR resolve them. ## Related Issues Fixes #10943
1 parent c9d632f commit 0e4bb41

File tree

11 files changed

+80
-36
lines changed

11 files changed

+80
-36
lines changed

examples/image-processing/src/pages/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class Index extends React.Component {
208208
and a{` `}
209209
<code>base64</code>
210210
{` `}
211-
image to use as a placeholder) you need to implement the "blur up"
211+
image to use as a placeholder) you need to implement the {`"blur up"`}
212212
technique popularized by
213213
{` `}
214214
<a href="https://jmperezperez.com/medium-image-progressive-loading-placeholder/">
@@ -247,16 +247,17 @@ class Index extends React.Component {
247247

248248
<p>
249249
The <code>toFormat</code> option lets you convert the source image to
250-
another image format. We use "PNG" here to ensure that the duotoned
251-
image does not show any JPG artifacts.
250+
another image format. We use {`"PNG"`} here to ensure that the
251+
duotoned image does not show any JPG artifacts.
252252
</p>
253253

254254
<h3>
255255
<small>
256256
fluid(duotone:
257257
{` `}
258258
{`{ `}
259-
highlight: "#f00e2e", shadow: "#192550" {`}`}, toFormat: PNG)
259+
highlight: {`"#f00e2e"`}, shadow: {`"#192550"`} {`}`}, toFormat:
260+
PNG)
260261
</small>
261262
</h3>
262263

@@ -267,7 +268,7 @@ class Index extends React.Component {
267268
fluid(duotone:
268269
{` `}
269270
{`{ `}
270-
highlight: "#0ec4f1", shadow: "#192550", opacity: 50 {`}`})
271+
highlight: {`"#0ec4f1"`}, shadow: {`"#192550"`}, opacity: 50 {`}`})
271272
</small>
272273
</h3>
273274

examples/using-contentful/src/pages/image-api.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const ImageAPI = props => {
1313
Gatsby offers rich integration with
1414
{` `}
1515
<a href="https://www.contentful.com/developers/docs/references/images-api/">
16-
Contentful's Image API
16+
{`Contentful's Image API`}
1717
</a>
1818
</p>
1919
<p>
@@ -62,11 +62,11 @@ const ImageAPI = props => {
6262
<p>
6363
If you make queries with <code>fixed</code> then Gatsby automatically
6464
generates images with 1x, 1.5x, 2x, and 3x versions so your images look
65-
great on whatever screen resolution of device they're on.
65+
great on whatever screen resolution of device {`they're`} on.
6666
</p>
6767
<p>
68-
If you're on a retina class screen, notice how much sharper these images
69-
are than the above "resized" images.
68+
If {`you're`} on a retina class screen, notice how much sharper these
69+
images are than the above {`"resized"`} images.
7070
</p>
7171
<p>
7272
You should prefer this operator over <code>resize</code>.
@@ -225,8 +225,8 @@ const ImageAPI = props => {
225225
WebP is currently only supported in
226226
{` `}
227227
<a href="https://caniuse.com/#feat=webp">Chrome and Oprah browsers</a>,
228-
and you'll want to fall back to another format for other clients. When
229-
this query is used with
228+
and {`you'll`} want to fall back to another format for other clients.
229+
When this query is used with
230230
{` `}
231231
<a href="https://www.gatsbyjs.org/packages/gatsby-image/">
232232
<code>gatsby-image</code>

examples/using-contentful/src/pages/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ class IndexPage extends React.Component {
4242
return (
4343
<Layout>
4444
<div style={{ marginBottom: rhythm(2) }}>
45-
<h2>Gatsby's integration with the Contentful Image API</h2>
45+
<h2>{`Gatsby's`} integration with the Contentful Image API</h2>
4646
<Link to="/image-api/">See examples</Link>
4747
<br />
4848
<br />
4949
<br />
5050
<h2>Localization</h2>
5151
<p>
5252
The <code>gatsby-source-contentful</code> plugin offers full support
53-
for Contentful's localization features. Our sample space includes
54-
products localized into both English and German.
53+
for {`Contentful's`} localization features. Our sample space
54+
includes products localized into both English and German.
5555
</p>
5656
<p>
5757
An entry and asset node are created for each locale following

examples/using-css-modules/src/pages/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ class IndexComponent extends React.Component {
99
<div className={indexStyles.index}>
1010
<h1>Hello world</h1>
1111
<h2 className={indexStyles.subheader}>
12-
You've arrived at the world renowned css modules & gatsby example site
12+
{`You've`} arrived at the world renowned css modules & gatsby example
13+
site
1314
</h2>
1415
<p>
1516
<Link className={indexStyles.link} to="/another-page/">

examples/using-drupal/src/pages/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ class IndexPage extends React.Component {
131131
square={true}
132132
columns={4}
133133
marginBottom={0}
134+
key={recipe.fields.slug}
134135
/>
135136
))}
136137
</div>
@@ -147,7 +148,7 @@ class IndexPage extends React.Component {
147148
}}
148149
>
149150
<div css={{ maxWidth: rhythm(15) }}>
150-
<h2>In this month's edition</h2>
151+
<h2>In this {`month's`} edition</h2>
151152
<p>
152153
Quisque vitae pulvinar arcu. Aliquam ac pellentesque erat, at
153154
finibus massa.
@@ -186,7 +187,11 @@ class IndexPage extends React.Component {
186187
}}
187188
>
188189
{nextFourPromotedRecipes.map(recipe => (
189-
<PromotedCard recipe={recipe} columns={2} />
190+
<PromotedCard
191+
recipe={recipe}
192+
columns={2}
193+
key={recipe.fields.slug}
194+
/>
190195
))}
191196
</div>
192197
</Container>

examples/using-drupal/src/pages/recipes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const AllRecipes = ({ data }) => (
1010
<h1>Recipes</h1>
1111
<ul>
1212
{data.allRecipes.edges.map(({ node }) => (
13-
<li>
13+
<li key={node.fields.slug}>
1414
<Link to={node.fields.slug}>{node.title}</Link>
1515
</li>
1616
))}

examples/using-drupal/src/templates/recipe.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,24 @@ const RecipeTemplate = ({ data }) => (
5353
</div>
5454
</div>
5555
<div css={{ background: `white`, padding: rhythm(1.5) }}>
56-
<h2>What you'll need and how to make this dish</h2>
56+
<h2>What {`you'll`} need and how to make this dish</h2>
5757
<div css={{ display: `flex`, justifyContent: `space-between` }}>
5858
<div css={{ width: `calc(1/2*100% - (1 - 1/2) * ${rhythm(1.5)})` }}>
5959
<h3>Ingredients</h3>
6060
<ul>
6161
{data.recipes.ingredients &&
62-
data.recipes.ingredients.map(ing => <li>{ing}</li>)}
62+
data.recipes.ingredients.map((ing, index) => (
63+
<li key={index}>{ing}</li>
64+
))}
6365
</ul>
6466
</div>
6567
<div css={{ width: `calc(1/2*100% - (1 - 1/2) * ${rhythm(1.5)})` }}>
6668
<h3>Method</h3>
6769
<ul>
6870
{data.recipes.instructions &&
69-
data.recipes.instructions.split(`,`).map(i => <li>{i}</li>)}
71+
data.recipes.instructions
72+
.split(`,`)
73+
.map(i => <li key={i}>{i}</li>)}
7074
</ul>
7175
</div>
7276
</div>

examples/using-redirects/src/pages/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const IndexPage = () => (
5353
to apply the <code>selected</code>
5454
&nbsp;class to links that match to the active path, and
5555
{` `}
56-
<code>import './selected.css'</code>
56+
<code>import {`'./selected.css'`}</code>
5757
&nbsp;in <code>/src/layouts/index.js</code>
5858
&nbsp;makes the <code>.selected {`{ color: #396; }`}</code> &nbsp;style
5959
declaration globally available to both&nbsp;pages.

packages/gatsby/cache-dir/static-entry.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ const createElement = React.createElement
5252
export default (pagePath, callback) => {
5353
let bodyHtml = ``
5454
let headComponents = [
55-
<meta name="generator" content={`Gatsby ${gatsbyVersion}`} />,
55+
<meta
56+
name="generator"
57+
content={`Gatsby ${gatsbyVersion}`}
58+
key={`generator-${gatsbyVersion}`}
59+
/>,
5660
]
5761
let htmlAttributes = {}
5862
let bodyAttributes = {}

www/src/components/evaluation-table.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class EvaluationTable extends Component {
2828
background: colors.ui.bright,
2929
},
3030
}}
31+
key={`info-icon-${words[words.length - 1]}`}
3132
>
3233
{` `}
3334
{`${words[words.length - 1]} `}
@@ -114,17 +115,21 @@ class EvaluationTable extends Component {
114115
{flatten(
115116
sections.map((section, s) =>
116117
[
117-
<SectionTitle text={sectionHeaders[s]} />,
118-
<SectionHeaderTop />,
118+
<SectionTitle
119+
text={sectionHeaders[s]}
120+
key={`section-title-${s}`}
121+
/>,
122+
<SectionHeaderTop key={`section-header-${s}`} />,
119123
].concat(
120124
flatten(
121125
section.map((row, i) =>
122126
[].concat([
123127
<SectionHeaderBottom
124128
display={row.node.Subcategory}
125129
category={row.node.Subcategory}
130+
key={`section-header-bottom-${i}`}
126131
/>,
127-
<tr>
132+
<tr key={`first-row-${i}`}>
128133
{headers.map((header, j) => (
129134
<td
130135
key={j}
@@ -165,6 +170,7 @@ class EvaluationTable extends Component {
165170
style={{
166171
display: showTooltip(s, i) ? `table-row` : `none`,
167172
}}
173+
key={`second-row-${i}`}
168174
>
169175
<td
170176
css={{

0 commit comments

Comments
 (0)