Skip to content

Commit 04f6153

Browse files
authored
chore: add rule for eslint curly braces && lint them all (#186)
1 parent f7674a8 commit 04f6153

File tree

16 files changed

+113
-108
lines changed

16 files changed

+113
-108
lines changed

.babelrc

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"presets": [
3-
"@babel/preset-react",
4-
"@babel/preset-env"
5-
],
2+
"presets": ["@babel/preset-react", "@babel/preset-env"],
63
"plugins": [
7-
["@babel/plugin-proposal-class-properties", {
8-
"loose": true
9-
}]
4+
[
5+
"@babel/plugin-proposal-class-properties",
6+
{
7+
"loose": true
8+
}
9+
]
1010
]
1111
}

.eslintrc.js

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ module.exports = {
2121
jest: true,
2222
},
2323
rules: {
24+
curly: 'error',
25+
2426
// I'll probably add some typescript types instead
2527
'react/prop-types': 'off',
2628
},

.github/workflows/cd.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
env:
99
APP_NAME: Testing Playground
10-
NODE_VERSION: "12.x"
10+
NODE_VERSION: '12.x'
1111

1212
jobs:
1313
create-release:
@@ -25,7 +25,7 @@ jobs:
2525

2626
- uses: actions/setup-node@v1
2727
with:
28-
node-version: "${{ env.NODE_VERSION }}"
28+
node-version: '${{ env.NODE_VERSION }}'
2929

3030
- name: Cache node modules
3131
id: cache

.github/workflows/ci.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
types: [opened, synchronize, reopened]
66

77
env:
8-
NODE_VERSION: "12.x"
8+
NODE_VERSION: '12.x'
99

1010
jobs:
1111
setup:
@@ -17,7 +17,7 @@ jobs:
1717

1818
- uses: actions/setup-node@v1
1919
with:
20-
node-version: "${{ env.NODE_VERSION }}"
20+
node-version: '${{ env.NODE_VERSION }}'
2121

2222
- name: Cache node modules
2323
id: cache
@@ -42,7 +42,7 @@ jobs:
4242

4343
- uses: actions/setup-node@v1
4444
with:
45-
node-version: "${{ env.NODE_VERSION }}"
45+
node-version: '${{ env.NODE_VERSION }}'
4646

4747
- name: Fetch all branches
4848
run: |
@@ -67,7 +67,7 @@ jobs:
6767

6868
- uses: actions/setup-node@v1
6969
with:
70-
node-version: "${{ env.NODE_VERSION }}"
70+
node-version: '${{ env.NODE_VERSION }}'
7171

7272
- name: Cache node modules
7373
uses: actions/cache@v1
@@ -76,4 +76,4 @@ jobs:
7676
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
7777

7878
- name: Run Tests
79-
run: npm run ci:test
79+
run: npm run ci:test

.lintstagedrc.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ module.exports = {
33
`eslint --quiet --fix ${files.join(' ')}`,
44
`jest --passWithNoTests`,
55
],
6-
'**/*.{md,js}': (files) => [`prettier --write ${files.join(' ')}`],
6+
'**/*.{md,js,json,yml,html,css,pcss}': (files) => [
7+
`prettier --write ${files.join(' ')}`,
8+
],
79
};

CODE_OF_CONDUCT.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
30-
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
32-
professional setting
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
3333

3434
## Our Responsibilities
3535

MAINTAINING.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ to release. See the next section on Releases for more about that.
5050
Our releases are automatic. They happen whenever code lands into `master`. A
5151
netlify build gets kicked off, and when tagged a changelog is published on
5252
GitHub. The changelog is generated based on the git commit messages. With this
53-
in mind, **please brush up on [the commit message convention][commit] which
53+
in mind, **please brush up on [the commit message convention][commit] which
5454
drives our releases.**
5555

5656
> One important note about this: Please make sure that commit messages do NOT
@@ -63,5 +63,4 @@ drives our releases.**
6363

6464
Thank you so much for helping to maintain this project!
6565

66-
[commit]:
67-
https://github.com/conventional-changelog-archived-repos/conventional-changelog-angular/blob/ed32559941719a130bb0327f886d6a32a8cbc2ba/convention.md
66+
[commit]: https://github.com/conventional-changelog-archived-repos/conventional-changelog-angular/blob/ed32559941719a130bb0327f886d6a32a8cbc2ba/convention.md

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ practices.
1313
<hr />
1414

1515
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
16+
1617
[![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors-)
18+
1719
<!-- ALL-CONTRIBUTORS-BADGE:END -->
1820

1921
**Playground for [testing-library/dom]**
@@ -122,6 +124,7 @@ Thanks goes to these people ([emoji key][emojis]):
122124

123125
<!-- markdownlint-enable -->
124126
<!-- prettier-ignore-end -->
127+
125128
<!-- ALL-CONTRIBUTORS-LIST:END -->
126129

127130
This project follows the [all-contributors][all-contributors] specification.

devtools/src/devtools/main.html

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html>
3-
<head>
4-
<meta charset="utf-8">
5-
</head>
6-
<body>
3+
<head>
4+
<meta charset="utf-8" />
5+
</head>
6+
<body>
77
<script src="main.js"></script>
8-
</body>
9-
</html>
8+
</body>
9+
</html>

devtools/src/devtools/pane.html

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html>
3-
<head>
4-
<meta charset="utf8">
3+
<head>
4+
<meta charset="utf8" />
55
<link rel="stylesheet" href="../../../src/styles/index.css" />
6-
</head>
7-
<body>
6+
</head>
7+
<body>
88
<div id="app" />
99
<script src="pane.js"></script>
10-
</body>
11-
</html>
10+
</body>
11+
</html>

devtools/src/devtools/panel.html

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html>
3-
<head>
4-
<meta charset="utf8">
3+
<head>
4+
<meta charset="utf8" />
55
<link rel="stylesheet" href="../../../src/styles/index.css" />
6-
</head>
7-
<body>
6+
</head>
7+
<body>
88
<div id="app" />
99
<script src="panel.js"></script>
10-
</body>
11-
</html>
10+
</body>
11+
</html>

devtools/src/manifest.json

+2-8
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
}
2424
},
2525

26-
"web_accessible_resources": [
27-
"window/testing-library.js"
28-
],
26+
"web_accessible_resources": ["window/testing-library.js"],
2927

3028
"devtools_page": "devtools/main.html",
3129

@@ -36,11 +34,7 @@
3634
"persistent": false
3735
},
3836

39-
"permissions": [
40-
"<all_urls>",
41-
"activeTab",
42-
"clipboardWrite"
43-
],
37+
"permissions": ["<all_urls>", "activeTab", "clipboardWrite"],
4438

4539
"content_scripts": [
4640
{

src/components/Editor.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ function getQueryHints(cm) {
5858
let start = cursor.ch;
5959
let end = cursor.ch;
6060

61-
while (start && /\w|\./.test(line.charAt(start - 1))) --start;
62-
while (end < line.length && /\w|\./.test(line.charAt(end))) ++end;
61+
while (start && /\w|\./.test(line.charAt(start - 1))) {
62+
--start;
63+
}
64+
while (end < line.length && /\w|\./.test(line.charAt(end))) {
65+
++end;
66+
}
6367

6468
const word = line.slice(start, end).toLowerCase();
6569
const offset = word.lastIndexOf('.') + 1;
@@ -169,7 +173,9 @@ function Editor({ onLoad, onChange, mode, initialValue }) {
169173
}, [mode]);
170174

171175
useEffect(() => {
172-
if (!editor.current || typeof onChange !== 'function') return;
176+
if (!editor.current || typeof onChange !== 'function') {
177+
return;
178+
}
173179

174180
editor.current.on(
175181
'changes',

src/embed.html

+1-6
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,7 @@
3535
</script>
3636
</template>
3737

38-
<template
39-
data-testing-playground
40-
data-panes="query, result, markup"
41-
data-height="250"
42-
data-width="80%"
43-
>
38+
<template data-testing-playground data-panes="query, result, markup" data-height="250" data-width="80%">
4439
<script type="text/html">
4540
<button>one</button>
4641
</script>

src/styles/app.pcss

+12-10
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ body:not(.embedded) {
1717
}
1818

1919
/* purgecss ignore */
20-
body.embedded, body.embedded #app {
20+
body.embedded,
21+
body.embedded #app {
2122
@apply h-full overflow-hidden p-1;
2223
}
2324

@@ -30,7 +31,7 @@ nav a:not(.title):hover {
3031
}
3132

3233
.footer:not(:hover) {
33-
opacity: .3;
34+
opacity: 0.3;
3435
}
3536

3637
.footer > div > span {
@@ -81,7 +82,7 @@ blockquote:before {
8182
font-size: 80px;
8283
display: block;
8384
padding-left: 10px;
84-
content: "\201C";
85+
content: '\201C';
8586
position: absolute;
8687
left: -20px;
8788
top: -32px;
@@ -92,24 +93,24 @@ blockquote cite {
9293
}
9394

9495
blockquote cite:before {
95-
content: "\2014 \2009";
96+
content: '\2014 \2009';
9697
}
9798

9899
.field {
99100
@apply relative cursor-default p-1 rounded border border-transparent;
100101
z-index: 0;
101-
transition: background-color .2s ease;
102+
transition: background-color 0.2s ease;
102103
}
103104

104-
.field[data-clickable="false"]:hover {
105+
.field[data-clickable='false']:hover {
105106
@apply bg-gray-100;
106107
}
107108

108-
.field[data-clickable="true"] {
109+
.field[data-clickable='true'] {
109110
@apply cursor-pointer bg-blue-100;
110111
}
111112

112-
.field[data-clickable="true"]:hover {
113+
.field[data-clickable='true']:hover {
113114
@apply bg-blue-200;
114115
}
115116

@@ -129,7 +130,7 @@ blockquote cite:before {
129130
}
130131

131132
button:disabled {
132-
opacity: .2;
133+
opacity: 0.2;
133134
}
134135

135136
/**
@@ -160,7 +161,8 @@ button:disabled {
160161
@apply block appearance-none border rounded w-full py-2 px-3 mb-2 text-gray-700 leading-tight;
161162
}
162163

163-
.preview input:focus, .preview button:focus {
164+
.preview input:focus,
165+
.preview button:focus {
164166
@apply outline-none border border-gray-700;
165167
}
166168

0 commit comments

Comments
 (0)