Skip to content

Commit 38fa5c7

Browse files
committed
eslint fixed
1 parent 10ebbff commit 38fa5c7

Some content is hidden

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

47 files changed

+13085
-662
lines changed

.eslintrc.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ module.exports = {
33
env: {
44
node: true
55
},
6-
extends:
7-
process.env.PLATFORM_ENV === "react"
8-
? ["react-app"]
9-
: ["plugin:vue/essential", "@vue/standard"],
6+
extends: process.env.PLATFORM_ENV === "react" ? ["react-app"] : ["plugin:vue/essential", "@vue/standard"],
107
rules: {
118
"one-var": "off",
129
"no-mixed-operators": "off",
@@ -24,4 +21,4 @@ module.exports = {
2421
parserOptions: {
2522
parser: "babel-eslint"
2623
}
27-
};
24+
}

babel.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
presets: [process.env.PLATFORM_ENV === "react" ? "react-app" : "@vue/app"]
3-
};
2+
presets: [process.env.PLATFORM_ENV === 'react' ? 'react-app' : '@vue/app']
3+
}

config-overrides.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
const path = require("path");
2-
const fs = require("fs");
1+
const path = require('path')
2+
const fs = require('fs')
33

4-
const appDirectory = fs.realpathSync(process.cwd());
5-
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
4+
const appDirectory = fs.realpathSync(process.cwd())
5+
const resolveApp = relativePath => path.resolve(appDirectory, relativePath)
66

77
module.exports = {
88
paths: function(paths, env) {
9-
paths.appBuild = resolveApp("dist/react");
10-
paths.appHtml = resolveApp("public/react.html");
11-
return paths;
9+
paths.appBuild = resolveApp('dist/react')
10+
paths.appHtml = resolveApp('public/react.html')
11+
return paths
1212
}
13-
};
13+
}

http-server.js

+23-27
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,32 @@
1-
var express = require("express");
2-
var compression = require("compression");
3-
var http = require("http");
4-
var path = require("path");
5-
var portrange = 8090;
6-
var app = express();
1+
var express = require('express')
2+
var compression = require('compression')
3+
var http = require('http')
4+
var path = require('path')
5+
var portrange = 8090
6+
var app = express()
77

8-
app.use(compression());
9-
app.use("/", express.static(path.resolve(__dirname, "./dist/")));
8+
app.use(compression())
9+
app.use('/', express.static(path.resolve(__dirname, './dist/')))
1010

1111
function getPort(cb) {
12-
var port = portrange;
13-
portrange += 1;
12+
var port = portrange
13+
portrange += 1
1414

15-
var server = http.createServer();
15+
var server = http.createServer()
1616
server.listen(port, function() {
17-
server.once("close", function() {
18-
cb(port);
19-
});
20-
server.close();
21-
});
22-
server.on("error", function() {
23-
getPort(cb);
24-
});
17+
server.once('close', function() {
18+
cb(port)
19+
})
20+
server.close()
21+
})
22+
server.on('error', function() {
23+
getPort(cb)
24+
})
2525
}
2626

2727
getPort(function(port) {
2828
app.listen(port, function() {
29-
require("child_process").exec(
30-
"start chrome http://localhost:" + port + "/vue"
31-
);
32-
require("child_process").exec(
33-
"start chrome http://localhost:" + port + "/react"
34-
);
35-
});
36-
});
29+
require('child_process').exec('start chrome http://localhost:' + port + '/vue')
30+
require('child_process').exec('start chrome http://localhost:' + port + '/react')
31+
})
32+
})

package.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,16 @@
4545
"@babel/parser": "7.7.5"
4646
},
4747
"browserslist": {
48-
"production": [">0.2%", "not dead", "not op_mini all"],
48+
"production": [
49+
">0.2%",
50+
"not dead",
51+
"not op_mini all"
52+
],
4953
"development": [
5054
"last 1 chrome version",
5155
"last 1 firefox version",
5256
"last 1 safari version"
5357
]
5458
},
5559
"keywords": []
56-
}
60+
}

public/card.js

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/react.ico

-1.5 KB
Binary file not shown.

public/vue.ico

-1.29 KB
Binary file not shown.

src/App.jsx

+27-52
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,47 @@
1-
import React, { useState } from "react";
2-
import { changeTheme, supportCssVars, enableCssVars, themeVars } from "./theme";
3-
import Todo from "./views/Todo";
4-
import tagVars from "./theme/Tag";
5-
import todoVars from "./theme/Todo";
6-
import "./style/app.scss";
1+
import React, { useState } from 'react'
2+
import { changeTheme, supportCssVars, enableCssVars, themeVars } from './theme'
3+
import Todo from './views/Todo'
4+
import tagVars from './theme/Tag'
5+
import todoVars from './theme/Todo'
6+
import './style/app.scss'
77

88
export default () => {
9-
const [todoColor, setTodoColor] = useState(() =>
10-
themeVars(Object.keys(todoVars)[0])
11-
);
12-
const [tagColor, setTagColor] = useState(() =>
13-
themeVars(Object.keys(tagVars)[0])
14-
);
15-
const [fontSize, setFontSize] = useState(() => themeVars("aui-font-size"));
16-
const [theme, setTheme] = useState(themeVars());
17-
const [title] = useState("New Tag");
9+
const [todoColor, setTodoColor] = useState(() => themeVars(Object.keys(todoVars)[0]))
10+
const [tagColor, setTagColor] = useState(() => themeVars(Object.keys(tagVars)[0]))
11+
const [fontSize, setFontSize] = useState(() => themeVars('aui-font-size'))
12+
const [theme, setTheme] = useState(themeVars())
13+
const [title] = useState('New Tag')
1814

1915
const change = e => {
2016
const apply = () => {
21-
const { name, value } = e.target;
17+
const { name, value } = e.target
2218

23-
name === "aui-tag-color" && setTagColor(value);
24-
name === "aui-todo-color" && setTodoColor(value);
25-
name === "aui-font-size" && setFontSize(value);
19+
name === 'aui-tag-color' && setTagColor(value)
20+
name === 'aui-todo-color' && setTodoColor(value)
21+
name === 'aui-font-size' && setFontSize(value)
2622

27-
setTheme(Object.assign(theme, { [name]: value }));
28-
changeTheme(theme);
29-
};
23+
setTheme(Object.assign(theme, { [name]: value }))
24+
changeTheme(theme)
25+
}
3026

31-
if (
32-
!supportCssVars() &&
33-
window.confirm("当前浏览器不支持主题切换,要启用兼容程序吗?")
34-
) {
35-
enableCssVars().then(apply);
27+
if (!supportCssVars() && window.confirm('当前浏览器不支持主题切换,要启用兼容程序吗?')) {
28+
enableCssVars().then(apply)
3629
} else {
37-
apply();
30+
apply()
3831
}
39-
};
32+
}
4033

4134
return (
4235
<div id="app">
4336
<div id="nav">
4437
<span>更改 Tag 颜色 </span>
45-
<input
46-
name="aui-tag-color"
47-
type="color"
48-
size="4"
49-
value={tagColor}
50-
onChange={change}
51-
/>
38+
<input name="aui-tag-color" type="color" size="4" value={tagColor} onChange={change} />
5239
<span>更改 {title} 颜色 </span>
53-
<input
54-
name="aui-todo-color"
55-
type="color"
56-
size="4"
57-
value={todoColor}
58-
onChange={change}
59-
/>
40+
<input name="aui-todo-color" type="color" size="4" value={todoColor} onChange={change} />
6041
<span>更改字体大小 </span>
61-
<input
62-
name="aui-font-size"
63-
type="text"
64-
size="2"
65-
value={fontSize}
66-
onChange={change}
67-
/>
42+
<input name="aui-font-size" type="text" size="2" value={fontSize} onChange={change} />
6843
</div>
6944
<Todo />
7045
</div>
71-
);
72-
};
46+
)
47+
}

0 commit comments

Comments
 (0)