Skip to content

Commit 76c04e1

Browse files
EugeneHlushkomontogeek
authored andcommitted
infra(eslint) force single quote for js?x (#2887)
1 parent 761612b commit 76c04e1

File tree

9 files changed

+80
-79
lines changed

9 files changed

+80
-79
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"no-unreachable": 2,
1919
"no-unused-vars": 0,
2020
"no-console": 0,
21-
"semi": ["error", "always"]
21+
"semi": ["error", "always"],
22+
"quotes": ["error", "single"]
2223
},
2324
"overrides": [
2425
{

src/components/Configuration/Configuration.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import React from "react";
2-
import ReactMarkdown from "react-markdown";
3-
import { Details } from "./components";
1+
import React from 'react';
2+
import ReactMarkdown from 'react-markdown';
3+
import { Details } from './components';
44

55
const detailComponentsList = ['link', 'mode', 'entry', 'filename', 'publicPath', 'advancedOutput', 'expert', 'advancedModule', 'alias', 'advancedResolve', 'hints', 'devtool', 'target', 'externals', 'stats', 'advanced', 'libraryTarget'];
66

77
const Pre = props => {
88
const newChildren = React.Children.map(props.children.props.children, child => {
99
if (React.isValidElement(child)) {
10-
if (child.props.props.className.includes("keyword")) {
10+
if (child.props.props.className.includes('keyword')) {
1111
if (!detailComponentsList.includes(child.props.props.componentname)) return child;
1212

1313
return <Details children={child.props.children.slice(4, React.Children.count(child.props.children) - 4)} url={child.props.props.url} />;
1414
}
1515

16-
if (child.props.props.className.includes("comment")) {
17-
return <ReactMarkdown source={child.props.children} disallowedTypes={["paragraph"]} unwrapDisallowed />;
16+
if (child.props.props.className.includes('comment')) {
17+
return <ReactMarkdown source={child.props.children} disallowedTypes={['paragraph']} unwrapDisallowed />;
1818
}
1919
}
2020

src/components/Dropdown/Dropdown.jsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default class Dropdown extends React.Component {
1414
}
1515

1616
_closeDropdownOnEsc(e) {
17-
if (e.key === "Escape" && this.state.active) {
17+
if (e.key === 'Escape' && this.state.active) {
1818
this.setState({ active: false}, () => {
1919
this.dropdownButton.focus();
2020
});
@@ -29,7 +29,7 @@ export default class Dropdown extends React.Component {
2929

3030
render() {
3131
let { className = '', items = [] } = this.props;
32-
let activeMod = this.state.active ? "dropdown__list--active" : "";
32+
let activeMod = this.state.active ? 'dropdown__list--active' : '';
3333

3434
return (
3535
<nav
@@ -40,18 +40,18 @@ export default class Dropdown extends React.Component {
4040
>
4141
<button
4242
ref={ el => this.dropdownButton = el }
43-
aria-haspopup="true"
43+
aria-haspopup='true'
4444
aria-expanded={ String(this.state.active) }
45-
aria-label="Select language"
45+
aria-label='Select language'
4646
onClick={ this._handleClick.bind(this) }
4747
>
4848
<img
49-
className="dropdown__language"
50-
alt="select language"
49+
className='dropdown__language'
50+
alt='select language'
5151
src={ LanguageIcon } />
5252
{/* Commented out until media breakpoints are in place
5353
<span>{ items[0].title }</span> */}
54-
<i aria-hidden="true" className="dropdown__arrow" />
54+
<i aria-hidden='true' className='dropdown__arrow' />
5555
</button>
5656
<div className={ `dropdown__list ${activeMod}` }>
5757
<ul>
@@ -76,19 +76,19 @@ export default class Dropdown extends React.Component {
7676
}
7777

7878
_handleArrowKeys(currentIndex, lastIndex, e) {
79-
if (["ArrowDown", "ArrowUp"].includes(e.key)) {
79+
if (['ArrowDown', 'ArrowUp'].includes(e.key)) {
8080
e.preventDefault();
8181
}
8282

8383
let newIndex = currentIndex;
84-
if (e.key === "ArrowDown") {
84+
if (e.key === 'ArrowDown') {
8585
newIndex++;
8686
if (newIndex > lastIndex) {
8787
newIndex = 0;
8888
}
8989
}
9090

91-
if (e.key === "ArrowUp") {
91+
if (e.key === 'ArrowUp') {
9292
newIndex--;
9393
if (newIndex < 0) {
9494
newIndex = lastIndex;

src/components/Organization/Organization.jsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,55 +8,55 @@ import './Organization.scss';
88

99
const Organization = props => {
1010
return (
11-
<Container className="organization page__content markdown">
11+
<Container className='organization page__content markdown'>
1212
<h1>The Organization</h1>
1313

1414
<p>The list below provides a brief overview of all commonly used projects in the webpack ecosystem.</p>
1515

16-
<div className="organization__projects">
16+
<div className='organization__projects'>
1717
{
1818
Items.map(org => (
19-
<div className="organization__project" key={ org.repo }>
20-
<a className="organization__title" href={ `https://github.com/${org.repo}` }>
19+
<div className='organization__project' key={ org.repo }>
20+
<a className='organization__title' href={ `https://github.com/${org.repo}` }>
2121
<h4>{ org.repo }</h4>
2222
</a>
2323

2424
<p>{ org.description }</p>
2525

2626
<h6>Downloads and Stars</h6>
27-
<Shield content={ `npm/dm/${org.npm}`} label="npm" />
27+
<Shield content={ `npm/dm/${org.npm}`} label='npm' />
2828
&nbsp;
29-
<Shield content={ `github/stars/${org.repo}` } label="%E2%9C%AD" />
29+
<Shield content={ `github/stars/${org.repo}` } label='%E2%9C%AD' />
3030

3131
<h6>Activity</h6>
3232
<Shield
33-
content={ `github/commits-since/${org.repo}/${encodeURIComponent("master@{6 months ago}")}` }
34-
label="6m" />
33+
content={ `github/commits-since/${org.repo}/${encodeURIComponent('master@{6 months ago}')}` }
34+
label='6m' />
3535
&nbsp;
3636
<Shield
37-
content={ `github/commits-since/${org.repo}/${encodeURIComponent("master@{3 months ago}")}` }
38-
label="3m" />
37+
content={ `github/commits-since/${org.repo}/${encodeURIComponent('master@{3 months ago}')}` }
38+
label='3m' />
3939
&nbsp;
4040
<Shield
41-
content={ `github/commits-since/${org.repo}/${encodeURIComponent("master@{1 month ago}")}` }
42-
label="1m" />
41+
content={ `github/commits-since/${org.repo}/${encodeURIComponent('master@{1 month ago}')}` }
42+
label='1m' />
4343
&nbsp;
4444
<Shield
45-
content={ `github/commits-since/${org.repo}/${encodeURIComponent("master@{1 week ago}")}` }
46-
label="1w" />
45+
content={ `github/commits-since/${org.repo}/${encodeURIComponent('master@{1 week ago}')}` }
46+
label='1w' />
4747

4848
<h6>Issues and PRs</h6>
49-
<Shield content={ `github/issues-raw/${org.repo}` } label="issues" />
49+
<Shield content={ `github/issues-raw/${org.repo}` } label='issues' />
5050
&nbsp;
51-
<Shield content={ `github/issues-pr-raw/${org.repo}` } label="prs" />
51+
<Shield content={ `github/issues-pr-raw/${org.repo}` } label='prs' />
5252

5353
<h6>Maintainers</h6>
5454
{
5555
(() => {
5656
if (org.maintainer) {
5757
return <Contributors contributors={[ org.maintainer ]} />;
5858

59-
} else return <Link to="https://github.com/webpack/webpack/issues/2734">Maintainer needed...</Link>;
59+
} else return <Link to='https://github.com/webpack/webpack/issues/2734'>Maintainer needed...</Link>;
6060
})()
6161
}
6262

src/components/Support/AdditionalSupporters.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,39 @@ import SegmentLogo from './logos/segment.png';
33

44
export default [
55
{
6-
name: "MoonMail",
7-
avatar: "https://static.moonmail.io/moonmail-logo.svg",
8-
website: "https://moonmail.io/?utm_source=webpack.js.org",
6+
name: 'MoonMail',
7+
avatar: 'https://static.moonmail.io/moonmail-logo.svg',
8+
website: 'https://moonmail.io/?utm_source=webpack.js.org',
99
totalDonations: 11000,
10-
reason: "Paypal"
10+
reason: 'Paypal'
1111
},
1212
{
13-
name: "Google Angular",
14-
avatar: "https://res.cloudinary.com/opencollective/image/upload/v1485288529/angular_uxllte.png",
15-
website: "https://angular.io/?utm_source=webpack&utm_medium=documentation&utm_campaign=sponsorship",
13+
name: 'Google Angular',
14+
avatar: 'https://res.cloudinary.com/opencollective/image/upload/v1485288529/angular_uxllte.png',
15+
website: 'https://angular.io/?utm_source=webpack&utm_medium=documentation&utm_campaign=sponsorship',
1616
totalDonations: 250000,
17-
reason: "Paypal"
17+
reason: 'Paypal'
1818
},
1919
{
20-
name: "Architects.io",
20+
name: 'Architects.io',
2121
avatar: null,
22-
website: "http://architects.io/?utm_source=webpack&utm_medium=documentation&utm_campaign=sponsorship",
22+
website: 'http://architects.io/?utm_source=webpack&utm_medium=documentation&utm_campaign=sponsorship',
2323
totalDonations: 30000,
24-
reason: "Paypal"
24+
reason: 'Paypal'
2525
},
2626
{
27-
slug: "peerigon",
28-
name: "Peerigon",
29-
avatar: "https://opencollective-production.s3-us-west-1.amazonaws.com/e8a1de10-99c8-11e6-8650-f92e594d5de8.png",
30-
website: "https://peerigon.com/?utm_source=webpack&utm_medium=documentation&utm_campaign=sponsorship",
27+
slug: 'peerigon',
28+
name: 'Peerigon',
29+
avatar: 'https://opencollective-production.s3-us-west-1.amazonaws.com/e8a1de10-99c8-11e6-8650-f92e594d5de8.png',
30+
website: 'https://peerigon.com/?utm_source=webpack&utm_medium=documentation&utm_campaign=sponsorship',
3131
totalDonations: 144139,
32-
reason: "webpack meetup 2017-07"
32+
reason: 'webpack meetup 2017-07'
3333
},
3434
{
35-
name: "Segment",
35+
name: 'Segment',
3636
avatar: SegmentLogo,
37-
website: "https://segment.com/?utm_source=webpack&utm_medium=documentation&utm_campaign=sponsorship",
37+
website: 'https://segment.com/?utm_source=webpack&utm_medium=documentation&utm_campaign=sponsorship',
3838
totalDonations: 2400000,
39-
reason: "Sponsorship 2017-07 - 2017-09"
39+
reason: 'Sponsorship 2017-07 - 2017-09'
4040
}
4141
];

src/utilities/content-tree-enhancers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const enhance = (tree, options) => {
1616
// delete source content directory
1717
.replace(dir, '')
1818
// Normalize url for Windows
19-
.replace(/\\/g, "/")
19+
.replace(/\\/g, '/')
2020
// remove `index` for root urls
2121
.replace(/\/index$/, '')
2222
// replace empty strings with `/`
@@ -47,7 +47,7 @@ const enhance = (tree, options) => {
4747
tree.anchors = anchors;
4848

4949
Object.assign(tree, {
50-
path: tree.path.replace(/\\/g, "/")
50+
path: tree.path.replace(/\\/g, '/')
5151
}, attributes);
5252
}
5353
};

src/utilities/fetch-package-repos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async function paginate (org) {
3838
}
3939

4040
async function main() {
41-
mkdirp.sync(path.resolve(__dirname, `../../repositories/`));
41+
mkdirp.sync(path.resolve(__dirname, '../../repositories/'));
4242

4343
for (const [type, collection] of Object.entries(fetch)) {
4444
const result = await Promise.all(collection.map(async (item) => {

src/utilities/markdown.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = function() {
55
var renderer = new marked.Renderer();
66

77
renderer.image = function(href, title, text) {
8-
return `<img src="${href}" alt="${text}">`;
8+
return `<img src='${href}' alt='${text}'>`;
99
};
1010

1111
// Patch IDs (this.options.headerPrefix can be undefined!)
@@ -14,10 +14,10 @@ module.exports = function() {
1414
var id = parsed.id;
1515

1616
return (
17-
`<h${level} class="header">
18-
<a class="anchor" aria-hidden="true" href="#${id}" id="${id}"></a>
19-
<span class="text">${text}</span>
20-
<a aria-label="${text}" class="icon-link" href="#${id}"></a>
17+
`<h${level} class='header'>
18+
<a class='anchor' aria-hidden='true' href='#${id}' id='${id}'></a>
19+
<span class='text'>${text}</span>
20+
<a aria-label='${text}' class='icon-link' href='#${id}'></a>
2121
</h${level}>\n`
2222
);
2323
};
@@ -31,28 +31,28 @@ module.exports = function() {
3131

3232
if (/-with-links/.test(lang)) {
3333
linksEnabled = true;
34-
lang = lang.replace(/-with-links/, "");
34+
lang = lang.replace(/-with-links/, '');
3535
}
3636

3737
if (/-with-details/.test(lang)) {
3838
detailsEnabled = true;
39-
lang = lang.replace(/-with-details/, "");
39+
lang = lang.replace(/-with-details/, '');
4040
}
4141

4242
if (linksEnabled) {
4343
code = code.replace(/\[([^[\]]+?)\]\((.+?)\)/g, match => {
4444
match = /\[([^[\]]+?)\]\((.+?)\)/.exec(match);
45-
links.push('<a class="code-link" href="' + match[2] + '">' + match[1] + '</a>');
46-
return "MARKDOWNLINK_" + (links.length - 1) + "_";
45+
links.push(`<a class="code-link" href="${match[2]}">${match[1]}</a>`);
46+
return `MARKDOWNLINK_${(links.length - 1)}_`;
4747
});
4848
}
4949

5050
if (detailsEnabled) {
51-
code = code.replace(/<details>/g, "MARKDOWNDETAILSSTART\n");
52-
code = code.replace(/ *<\/details>(\n)?/g, "\nMARKDOWNDETAILSEND\n");
53-
code = code.replace(/<summary>/g, "\nMARKDOWNSUMMARYSTART\n");
54-
code = code.replace(/ *<\/summary>/g, "\nMARKDOWNSUMMARYEND");
55-
code = code.replace(/(?:)?( *)MARKDOWNDETAILSSTART([\s\S]*?)MARKDOWNSUMMARYSTART\n/g, "MARKDOWNDETAILSSTART$2MARKDOWNSUMMARYSTART\n$1");
51+
code = code.replace(/<details>/g, 'MARKDOWNDETAILSSTART\n');
52+
code = code.replace(/ *<\/details>(\n)?/g, '\nMARKDOWNDETAILSEND\n');
53+
code = code.replace(/<summary>/g, '\nMARKDOWNSUMMARYSTART\n');
54+
code = code.replace(/ *<\/summary>/g, '\nMARKDOWNSUMMARYEND');
55+
code = code.replace(/(?:)?( *)MARKDOWNDETAILSSTART([\s\S]*?)MARKDOWNSUMMARYSTART\n/g, 'MARKDOWNDETAILSSTART$2MARKDOWNSUMMARYSTART\n$1');
5656
}
5757

5858
var rendered = codeTemplate.call(this, code, lang, escaped);
@@ -65,10 +65,10 @@ module.exports = function() {
6565
}
6666

6767
if (detailsEnabled) {
68-
rendered = rendered.replace(/MARKDOWNDETAILSSTART.*?\n/g, "<details>");
69-
rendered = rendered.replace(/\n.*?MARKDOWNDETAILSEND.*?\n/g, "</details>");
70-
rendered = rendered.replace(/\n.*?MARKDOWNSUMMARYSTART.*?\n/g, "<summary><span class='code-details-summary-span'>");
71-
rendered = rendered.replace(/\n.*?MARKDOWNSUMMARYEND.*?\n/g, "</span></summary>");
68+
rendered = rendered.replace(/MARKDOWNDETAILSSTART.*?\n/g, '<details>');
69+
rendered = rendered.replace(/\n.*?MARKDOWNDETAILSEND.*?\n/g, '</details>');
70+
rendered = rendered.replace(/\n.*?MARKDOWNSUMMARYSTART.*?\n/g, '<summary><span class="code-details-summary-span">');
71+
rendered = rendered.replace(/\n.*?MARKDOWNSUMMARYEND.*?\n/g, '</span></summary>');
7272
}
7373

7474
return rendered;
@@ -170,10 +170,10 @@ function handleHTMLSplit(tokens, htmlArray, merging) {
170170
}
171171
// finish inline code
172172
else if(merging.length > 0 && tickLength > 1) {
173-
htmlArray.unshift(tickSplit.slice(1, tickLength).join("`"));
174-
merging += tickSplit[0]+"`";
173+
htmlArray.unshift(tickSplit.slice(1, tickLength).join('`'));
174+
merging += tickSplit[0]+'`';
175175
tokens = tokens.concat(parseContent(merging));
176-
merging = "";
176+
merging = '';
177177
} else if (merging.length === 0) {
178178
tokens = tokens.concat(parseContent(htmlItem));
179179
}
@@ -205,7 +205,7 @@ function handleHTML(t) {
205205
if (item.indexOf('```') !== 0) {
206206
// split all html tags
207207
const htmlArray = item.split(/\s*(<[^>]*>)/g).filter(v => (v !== '' && v !== '\n'));
208-
tokens = handleHTMLSplit(tokens, htmlArray, "");
208+
tokens = handleHTMLSplit(tokens, htmlArray, '');
209209
}
210210
// normally parse code block
211211
else {

src/utilities/test-local-storage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @return {undefined|bool} Returns false on error.
66
*/
77
module.exports = function() {
8-
const test = "localStorageTest";
8+
const test = 'localStorageTest';
99
try {
1010
localStorage.setItem(test, test);
1111
localStorage.removeItem(test);

0 commit comments

Comments
 (0)