Skip to content

Commit be761ef

Browse files
update eslint and apply eslint-config-webpack (#701)
* refactor: no use before define * refactor: fix `react/jsx-key` * refactor: tests * refactor: fix more `react/jsx-key` * refactor: fix more * refactor: add webpack eslint config * refactor: fix problem places * chore: fix lock file * test: fix * chore: build before lint due mapping requires to lib * chore: fix ci * chore: fix lint
1 parent 1c23a2a commit be761ef

Some content is hidden

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

41 files changed

+4592
-4322
lines changed

.eslintignore

Lines changed: 0 additions & 19 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,8 @@ jobs:
4747
- name: Download deps
4848
uses: bahmutov/npm-install@v1
4949

50+
- name: Build sources
51+
run: npm run build
52+
5053
- name: Run lint
5154
run: npm run lint

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ yarn add -D webpack-bundle-analyzer
2424
<h2 align="center">Usage (as a plugin)</h2>
2525

2626
```js
27-
const BundleAnalyzerPlugin =
28-
require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
27+
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
2928

3029
module.exports = {
3130
plugins: [new BundleAnalyzerPlugin()],
@@ -48,6 +47,8 @@ And it also shows their gzipped, Brotli, or Zstandard sizes!
4847

4948
<h2 align="center">Options (for plugin)</h2>
5049

50+
<!-- eslint-skip -->
51+
5152
```js
5253
new BundleAnalyzerPlugin(options?: object)
5354
```

client/components/CheckboxList.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import PureComponent from "../lib/PureComponent.jsx";
2-
import CheckboxListItem from "./CheckboxListItem.jsx";
3-
42
import * as styles from "./CheckboxList.css";
3+
import CheckboxListItem from "./CheckboxListItem.jsx";
54

65
const ALL_ITEM = Symbol("ALL_ITEM");
76

client/components/CheckboxListItem.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { Component } from "preact";
22

33
import Checkbox from "./Checkbox.jsx";
4-
import CheckboxList from "./CheckboxList.jsx";
5-
64
import * as styles from "./CheckboxList.css";
5+
import CheckboxList from "./CheckboxList.jsx";
76

87
export default class CheckboxListItem extends Component {
98
render() {

client/components/ContextMenu.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import cls from "classnames";
22
import PureComponent from "../lib/PureComponent.jsx";
33
import { store } from "../store.js";
44
import { elementIsOutside } from "../utils.js";
5-
import ContextMenuItem from "./ContextMenuItem.jsx";
6-
75
import * as styles from "./ContextMenu.css";
6+
import ContextMenuItem from "./ContextMenuItem.jsx";
87

98
export default class ContextMenu extends PureComponent {
109
componentDidMount() {

client/components/Dropdown.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ export default class Dropdown extends PureComponent {
6363
if (el && event && !el.contains(event.target)) {
6464
this.setState({ showOptions: false });
6565
// If the query is not in the options, reset the selection
66-
if (
67-
this.state.query &&
68-
!this.props.options.some((option) => option === this.state.query)
69-
) {
66+
if (this.state.query && !this.props.options.includes(this.state.query)) {
7067
this.setState({ query: "" });
7168
this.props.onSelectionChange(undefined);
7269
}

client/components/Icon.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import iconPin from "../assets/icon-pin.svg";
55
import iconSun from "../assets/icon-sun.svg";
66
import PureComponent from "../lib/PureComponent.jsx";
77

8-
import * as s from "./Icon.css";
8+
import * as styles from "./Icon.css";
99

1010
const ICONS = {
1111
"arrow-right": {
@@ -28,7 +28,7 @@ const ICONS = {
2828

2929
export default class Icon extends PureComponent {
3030
render({ className }) {
31-
return <i className={cls(s.icon, className)} style={this.style} />;
31+
return <i className={cls(styles.icon, className)} style={this.style} />;
3232
}
3333

3434
get style() {

client/components/ModuleItem.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ export default class ModuleItem extends PureComponent {
2626
onMouseLeave={this.handleMouseLeave}
2727
>
2828
<span dangerouslySetInnerHTML={{ __html: this.titleHtml }} />
29-
{showSize && [" (", <strong>{filesize(module[showSize])}</strong>, ")"]}
29+
{showSize && (
30+
<>
31+
{" ("}
32+
<strong>{filesize(module[showSize])}</strong>
33+
{")"}
34+
</>
35+
)}
3036
</div>
3137
);
3238
}

0 commit comments

Comments
 (0)