Skip to content

Commit 76c5cc3

Browse files
author
MQuy
committed
Upgrade sample's package to latest, add prettier, and bump 0.1.15
1 parent 655c716 commit 76c5cc3

File tree

17 files changed

+8487
-7079
lines changed

17 files changed

+8487
-7079
lines changed

.prettierrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"printWidth": 120,
3+
"useTabs": true,
4+
"tabWidth": 2,
5+
"singleQuote": false,
6+
"trailingComma": "all",
7+
"jsxBracketSameLine": false,
8+
"semi": true,
9+
"bracketSpacing": true,
10+
"arrowParens": "avoid"
11+
}

package.json

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
{
2-
"name": "webpack-deadcode-plugin",
3-
"version": "0.1.14",
4-
"description": "Webpack plugin to detect unused files and unused exports in used files",
5-
"repository": "https://github.com/MQuy/webpack-deadcode-plugin",
6-
"main": "src/index.js",
7-
"keywords": [
8-
"webpack",
9-
"plugin",
10-
"unused",
11-
"deadcode"
12-
],
13-
"author": "MQuy",
14-
"license": "MIT",
15-
"peerDependencies": {
16-
"webpack": "> 3"
17-
},
18-
"engines": {
19-
"node": ">=6.11.5"
20-
},
21-
"dependencies": {
22-
"chalk": "^3.0.0",
23-
"fast-glob": "^3.1.1"
24-
}
2+
"name": "webpack-deadcode-plugin",
3+
"version": "0.1.15",
4+
"description": "Webpack plugin to detect unused files and unused exports in used files",
5+
"repository": "https://github.com/MQuy/webpack-deadcode-plugin",
6+
"main": "src/index.js",
7+
"keywords": [
8+
"webpack",
9+
"plugin",
10+
"unused",
11+
"deadcode"
12+
],
13+
"author": "MQuy",
14+
"license": "MIT",
15+
"peerDependencies": {
16+
"webpack": "> 3"
17+
},
18+
"engines": {
19+
"node": ">=6.11.5"
20+
},
21+
"dependencies": {
22+
"chalk": "^3.0.0",
23+
"fast-glob": "^3.1.1"
24+
}
2525
}

samples/app.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.abcdef {
2-
display: inline;
2+
display: inline;
33
}
44

55
.xxx {
6-
composes: zzzz from './vendor.css';
7-
float: left;
8-
}
6+
composes: zzzz from "./vendor.css";
7+
float: left;
8+
}

samples/app.js

Lines changed: 61 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -8,78 +8,77 @@ demo();
88
xyz();
99

1010
class App extends Component {
11-
constructor(props) {
12-
super(props);
11+
constructor(props) {
12+
super(props);
1313

14-
this.state = {
15-
stories: [
16-
{
17-
id: 1,
18-
name: "[Webpack] — Smart Loading Assets For Production",
19-
url:
20-
"https://hackernoon.com/webpack-smart-loading-assets-for-production-3571e0a29c2e"
21-
},
22-
{
23-
id: 2,
24-
name: "V8 Engine Overview",
25-
url: "https://medium.com/@MQuy90/v8-engine-overview-7c965731ced4"
26-
}
27-
]
28-
};
29-
}
30-
render() {
31-
const { stories } = this.state;
14+
this.state = {
15+
stories: [
16+
{
17+
id: 1,
18+
name: "[Webpack] — Smart Loading Assets For Production",
19+
url: "https://hackernoon.com/webpack-smart-loading-assets-for-production-3571e0a29c2e",
20+
},
21+
{
22+
id: 2,
23+
name: "V8 Engine Overview",
24+
url: "https://medium.com/@MQuy90/v8-engine-overview-7c965731ced4",
25+
},
26+
],
27+
};
28+
}
29+
render() {
30+
const { stories } = this.state;
3231

33-
return (
34-
<div>
35-
<ul>
36-
{stories.map((story, index) => (
37-
<Story key={index} story={story} onRemove={this.removeStory} />
38-
))}
39-
</ul>
40-
</div>
41-
);
42-
}
43-
removeStory = story => () => {
44-
const { stories } = this.state;
32+
return (
33+
<div>
34+
<ul>
35+
{stories.map((story, index) => (
36+
<Story key={index} story={story} onRemove={this.removeStory} />
37+
))}
38+
</ul>
39+
</div>
40+
);
41+
}
42+
removeStory = story => () => {
43+
const { stories } = this.state;
4544

46-
const index = stories.findIndex(s => s.id == story.id);
47-
stories.splice(index, 1);
45+
const index = stories.findIndex(s => s.id == story.id);
46+
stories.splice(index, 1);
4847

49-
this.setState(stories);
50-
};
48+
this.setState(stories);
49+
};
5150
}
5251

5352
class Story extends Component {
54-
constructor(props) {
55-
super(props);
53+
constructor(props) {
54+
super(props);
5655

57-
this.state = { likes: Math.ceil(Math.random() * 100) };
58-
}
59-
render() {
60-
const { story, onRemove } = this.props;
61-
const { likes } = this.state;
56+
this.state = { likes: Math.ceil(Math.random() * 100) };
57+
}
58+
render() {
59+
const { story, onRemove } = this.props;
60+
const { likes } = this.state;
6261

63-
return (
64-
<li className={styles.notExist}>
65-
<button onClick={this.handleClick}>
66-
{likes}
67-
❤️
68-
</button>
69-
<a className={styles.xxx} href={story.url}>
70-
{story.name}
71-
</a>
72-
<button onClick={onRemove(story)}>Remove</button>
73-
</li>
74-
);
75-
}
76-
handleClick = () => {
77-
this.setState({
78-
likes: this.state.likes + 1
79-
});
80-
};
62+
return (
63+
<li className={styles.notExist}>
64+
<button onClick={this.handleClick}>
65+
{likes}
66+
❤️
67+
</button>
68+
<a className={styles.xxx} href={story.url}>
69+
{story.name}
70+
</a>
71+
<button onClick={onRemove(story)}>Remove</button>
72+
</li>
73+
);
74+
}
75+
handleClick = () => {
76+
this.setState({
77+
likes: this.state.likes + 1,
78+
});
79+
};
8180
}
8281

8382
export function reload() {
84-
render(<App />, document.getElementById("root"));
83+
render(<App />, document.getElementById("root"));
8584
}

0 commit comments

Comments
 (0)