Skip to content

Commit b98d467

Browse files
refactor: apply prettier
1 parent 90951ad commit b98d467

71 files changed

Lines changed: 2139 additions & 1752 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.babelrc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
// Compiles sources, gulpfile and tests
33
{
44
"presets": [
5-
["@babel/preset-env", {
6-
"targets": {"node": "16.20.2"}
7-
}]
5+
[
6+
"@babel/preset-env",
7+
{
8+
"targets": { "node": "16.20.2" }
9+
}
10+
]
811
]
912
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/samples
44
node_modules
55
npm-debug.log
6+
.eslintcache

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
test/bundles/**
2+
test/stats/**
3+
test/output/**
4+
samples/**
5+
CHANGELOG.md

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ _Note: Gaps between patch versions are faulty, broken or test releases._
1616
* Add support for Zstandard compression ([#693](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/693) by [@bjohansebas](https://github.com/bjohansebas))
1717

1818
* **Internal**
19+
* Prettier applied to the code base ([#693](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/693) by [@alexander-akait](https://github.com/alexander-akait))
1920
* Update `sirv` dependency ([#692](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/692) by [@bjohansebas](https://github.com/bjohansebas))
2021
* Update `ws` dependency ([#691](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/691) by [@bjohansebas](https://github.com/bjohansebas))
2122

README.md

Lines changed: 26 additions & 29 deletions
Large diffs are not rendered by default.

client/.eslintrc.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
2-
"extends": [
3-
"th0r-react",
4-
"../.eslintrc.json"
5-
],
2+
"extends": ["th0r-react", "../.eslintrc.json"],
63
"settings": {
74
"react": {
85
"version": "16.2"

client/components/Button.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
font: var(--main-font);
88
outline: none;
99
padding: 5px 7px;
10-
transition: background .3s ease, border-color .3s ease, color .3s ease;
10+
transition:
11+
background 0.3s ease,
12+
border-color 0.3s ease,
13+
color 0.3s ease;
1114
white-space: nowrap;
1215
color: var(--text-primary);
1316
}

client/components/Button.jsx

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,38 @@
1-
import cls from 'classnames';
2-
import s from './Button.css';
3-
import PureComponent from '../lib/PureComponent';
1+
import cls from "classnames";
2+
import s from "./Button.css";
3+
import PureComponent from "../lib/PureComponent";
44

55
export default class Button extends PureComponent {
6-
render({active, toggle, className, children, ...props}) {
6+
render({ active, toggle, className, children, ...props }) {
77
const classes = cls(className, {
88
[s.button]: true,
99
[s.active]: active,
10-
[s.toggle]: toggle
10+
[s.toggle]: toggle,
1111
});
1212

1313
return (
14-
<button {...props}
14+
<button
15+
{...props}
1516
ref={this.saveRef}
1617
type="button"
1718
className={classes}
1819
disabled={this.disabled}
19-
onClick={this.handleClick}>
20+
onClick={this.handleClick}
21+
>
2022
{children}
2123
</button>
2224
);
2325
}
2426

2527
get disabled() {
26-
const {props} = this;
27-
return (
28-
props.disabled ||
29-
(props.active && !props.toggle)
30-
);
28+
const { props } = this;
29+
return props.disabled || (props.active && !props.toggle);
3130
}
3231

3332
handleClick = (event) => {
3433
this.elem.blur();
3534
this.props.onClick(event);
36-
}
35+
};
3736

38-
saveRef = elem => this.elem = elem;
37+
saveRef = (elem) => (this.elem = elem);
3938
}

client/components/Checkbox.jsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
1-
import {Component} from 'preact';
2-
import cls from 'classnames';
1+
import { Component } from "preact";
2+
import cls from "classnames";
33

4-
import s from './Checkbox.css';
4+
import s from "./Checkbox.css";
55

66
export default class Checkbox extends Component {
7-
87
render() {
9-
const {checked, className, children} = this.props;
8+
const { checked, className, children } = this.props;
109

1110
return (
1211
<label className={cls(s.label, className)}>
13-
<input className={s.checkbox}
12+
<input
13+
className={s.checkbox}
1414
type="checkbox"
1515
checked={checked}
16-
onChange={this.handleChange}/>
17-
<span className={s.itemText}>
18-
{children}
19-
</span>
16+
onChange={this.handleChange}
17+
/>
18+
<span className={s.itemText}>{children}</span>
2019
</label>
2120
);
2221
}
2322

2423
handleChange = () => {
2524
this.props.onChange(!this.props.checked);
26-
}
27-
25+
};
2826
}

client/components/CheckboxList.jsx

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,88 @@
1-
import CheckboxListItem from './CheckboxListItem';
2-
import s from './CheckboxList.css';
3-
import PureComponent from '../lib/PureComponent';
1+
import CheckboxListItem from "./CheckboxListItem";
2+
import s from "./CheckboxList.css";
3+
import PureComponent from "../lib/PureComponent";
44

5-
const ALL_ITEM = Symbol('ALL_ITEM');
5+
const ALL_ITEM = Symbol("ALL_ITEM");
66

77
export default class CheckboxList extends PureComponent {
8-
98
static ALL_ITEM = ALL_ITEM;
109

1110
constructor(props) {
1211
super(props);
1312
this.state = {
14-
checkedItems: props.checkedItems || props.items
13+
checkedItems: props.checkedItems || props.items,
1514
};
1615
}
1716

1817
componentWillReceiveProps(newProps) {
1918
if (newProps.items !== this.props.items) {
2019
if (this.isAllChecked()) {
2120
// Preserving `all checked` state
22-
this.setState({checkedItems: newProps.items});
21+
this.setState({ checkedItems: newProps.items });
2322
this.informAboutChange(newProps.items);
2423
} else if (this.state.checkedItems.length) {
2524
// Checking only items that are in the new `items` array
26-
const checkedItems = newProps.items.filter(item =>
27-
this.state.checkedItems.find(checkedItem => checkedItem.label === item.label)
25+
const checkedItems = newProps.items.filter((item) =>
26+
this.state.checkedItems.find(
27+
(checkedItem) => checkedItem.label === item.label,
28+
),
2829
);
2930

30-
this.setState({checkedItems});
31+
this.setState({ checkedItems });
3132
this.informAboutChange(checkedItems);
3233
}
3334
} else if (newProps.checkedItems !== this.props.checkedItems) {
34-
this.setState({checkedItems: newProps.checkedItems});
35+
this.setState({ checkedItems: newProps.checkedItems });
3536
}
3637
}
3738

3839
render() {
39-
const {label, items, renderLabel} = this.props;
40+
const { label, items, renderLabel } = this.props;
4041

4142
return (
4243
<div className={s.container}>
43-
<div className={s.label}>
44-
{label}:
45-
</div>
44+
<div className={s.label}>{label}:</div>
4645
<div>
47-
<CheckboxListItem item={ALL_ITEM}
46+
<CheckboxListItem
47+
item={ALL_ITEM}
4848
checked={this.isAllChecked()}
49-
onChange={this.handleToggleAllCheck}>
49+
onChange={this.handleToggleAllCheck}
50+
>
5051
{renderLabel}
5152
</CheckboxListItem>
52-
{items.map(item =>
53-
<CheckboxListItem key={item.label}
53+
{items.map((item) => (
54+
<CheckboxListItem
55+
key={item.label}
5456
item={item}
5557
checked={this.isItemChecked(item)}
56-
onChange={this.handleItemCheck}>
58+
onChange={this.handleItemCheck}
59+
>
5760
{renderLabel}
5861
</CheckboxListItem>
59-
)}
62+
))}
6063
</div>
6164
</div>
6265
);
6366
}
6467

6568
handleToggleAllCheck = () => {
6669
const checkedItems = this.isAllChecked() ? [] : this.props.items;
67-
this.setState({checkedItems});
70+
this.setState({ checkedItems });
6871
this.informAboutChange(checkedItems);
6972
};
7073

71-
handleItemCheck = item => {
74+
handleItemCheck = (item) => {
7275
let checkedItems;
7376

7477
if (this.isItemChecked(item)) {
75-
checkedItems = this.state.checkedItems.filter(checkedItem => checkedItem !== item);
78+
checkedItems = this.state.checkedItems.filter(
79+
(checkedItem) => checkedItem !== item,
80+
);
7681
} else {
7782
checkedItems = [...this.state.checkedItems, item];
7883
}
7984

80-
this.setState({checkedItems});
85+
this.setState({ checkedItems });
8186
this.informAboutChange(checkedItems);
8287
};
8388

@@ -86,11 +91,10 @@ export default class CheckboxList extends PureComponent {
8691
}
8792

8893
isAllChecked() {
89-
return (this.props.items.length === this.state.checkedItems.length);
94+
return this.props.items.length === this.state.checkedItems.length;
9095
}
9196

9297
informAboutChange(checkedItems) {
9398
setTimeout(() => this.props.onChange(checkedItems));
9499
}
95-
96100
}

0 commit comments

Comments
 (0)