Skip to content

Commit 906fe32

Browse files
committed
style: eslint test
1 parent 6faba36 commit 906fe32

File tree

9 files changed

+122
-97
lines changed

9 files changed

+122
-97
lines changed

.eslintignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ run/
99
public/
1010
node_modules/
1111
app/mocks
12-
app/web/store
12+
app/web
1313
plugins/
1414
app/web/asset/
1515
app/view/
1616
test.js
17-
script/webpack4/
17+
script/webpack4/.eslintrc

.eslintrc

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

.eslintrc.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
module.exports = {
2+
parser: 'babel-eslint',
3+
parserOptions: {
4+
ecmaVersion: 6,
5+
sourceType: 'module',
6+
},
7+
rules: {
8+
indent: ['error', 2, { SwitchCase: 1 }],
9+
quotes: ['error', 'single'],
10+
"comma-dangle": [2, "never"],
11+
'valid-jsdoc': 'off',
12+
'eol-last': 'off',
13+
'array-bracket-spacing': 'off',
14+
'no-unused-vars': 0,
15+
'no-else-return': 'off',
16+
'comma-dangle': [
17+
'error',
18+
{
19+
arrays: 'only-multiline',
20+
objects: 'only-multiline',
21+
},
22+
],
23+
},
24+
env: {
25+
browser: true,
26+
node: true,
27+
commonjs: true,
28+
jquery: true,
29+
es6: true,
30+
},
31+
globals: {
32+
EASY_ENV_IS_PROD: true,
33+
EASY_ENV_IS_NODE: true,
34+
EASY_ENV_IS_BROWSER: true,
35+
EASY_ENV_IS_DEV: true,
36+
},
37+
};

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ artifacts.json
1313
*tmp
1414
_site
1515
logs
16-
.vscode
1716
config/buildConfig.json
1817
config/manifest.json
1918
config/manifest-dll.json

.vscode/launch.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": "1.0.0",
3+
"configurations": [
4+
{
5+
"name": "Launch Egg React",
6+
"type": "node",
7+
"request": "launch",
8+
"cwd": "${workspaceRoot}",
9+
"runtimeExecutable": "npm",
10+
"windows": { "runtimeExecutable": "npm.cmd" },
11+
"runtimeArgs": [ "run", "debug" ],
12+
"console": "integratedTerminal",
13+
"protocol": "auto",
14+
"restart": true,
15+
"port": 9229,
16+
"autoAttachChildProcesses": true
17+
}
18+
]
19+
}

.vscode/settings.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"eslint.enable": true,
3+
"eslint.run": "onSave",
4+
"editor.codeActionsOnSave": {
5+
"source.fixAll.eslint": false
6+
},
7+
"eslint.validate": [
8+
"javascript",
9+
"vue-html",
10+
{
11+
"language": "vue",
12+
"autoFix": true
13+
}
14+
],
15+
"files.exclude": {
16+
"**/node_modules/_**": true
17+
}
18+
}

app/controller/test.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
'usestrict';
1+
'use strict';
22
const egg = require('egg');
33
module.exports = class TestController extends egg.Controller {
4-
54
async index() {
65
await this.ctx.render('test.js', {
76
meta: {
87
title: 'Egg Vue SSR',
98
keywords: 'egg,vue,vue sse,easyjs',
10-
description: '基于 Egg + Vue + Webpack SSR 服务端渲染和 CSR 前端渲染工程骨架项目,包括前台系统(SSR MPA)和后台管理系统(SSR SPA)'
9+
description:
10+
'基于 Egg + Vue + Webpack SSR 服务端渲染和 CSR 前端渲染工程骨架项目,包括前台系统(SSR MPA)和后台管理系统(SSR SPA)',
1111
},
1212
site: {
1313
name: 'easyjs',
14-
url: 'https://easyjs.cn'
15-
}
14+
url: 'https://easyjs.cn',
15+
},
1616
});
1717
}
18-
19-
};
18+
};

app/router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
module.exports = app => {
33
const { router, controller } = app;
4-
router.get('/', controller.index.index.ssr);
4+
router.get('/', controller.index.index.ssr);
55
router.get('/csr', controller.index.index.csr);
66
router.get('/list', controller.index.index.list);
77
router.get('/about', controller.index.index.about);

babel.config.js

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,52 @@
11
module.exports = {
2-
"env": {
3-
"node": {
4-
"presets": [
2+
env: {
3+
node: {
4+
presets: [
55
[
6-
"@babel/preset-env",
6+
'@babel/preset-env',
77
{
8-
"modules": false,
9-
"targets": {
10-
"node": "current"
11-
}
12-
}
13-
]
8+
modules: false,
9+
targets: {
10+
node: 'current',
11+
},
12+
},
13+
],
1414
],
15-
"plugins": [
15+
plugins: [
1616
[
17-
"component",
17+
'component',
1818
{
19-
"libraryName": "element-ui",
20-
"styleLibraryName": "theme-chalk"
21-
}
22-
],
23-
"@babel/plugin-syntax-dynamic-import"
24-
]
19+
libraryName: 'element-ui',
20+
styleLibraryName: 'theme-chalk',
21+
},
22+
],
23+
'@babel/plugin-syntax-dynamic-import',
24+
],
2525
},
26-
"web": {
27-
"presets": [
26+
web: {
27+
presets: [
2828
[
29-
"@babel/preset-env",
29+
'@babel/preset-env',
3030
{
31-
"modules": false,
32-
"targets": {
33-
"browsers": [
34-
"last 2 versions",
35-
"safari >= 7"
36-
]
37-
}
38-
}
39-
]
31+
modules: false,
32+
targets: {
33+
browsers: ['last 2 versions', 'safari >= 7'],
34+
},
35+
},
36+
],
4037
],
41-
"plugins": [
38+
plugins: [
4239
[
43-
"component",
40+
'component',
4441
{
45-
"libraryName": "element-ui",
46-
"styleLibraryName": "theme-chalk"
47-
}
42+
libraryName: 'element-ui',
43+
styleLibraryName: 'theme-chalk',
44+
},
4845
],
49-
"@babel/plugin-proposal-object-rest-spread",
50-
"@babel/plugin-syntax-dynamic-import",
51-
"@babel/plugin-transform-object-assign"
52-
]
53-
}
54-
}
55-
}
46+
'@babel/plugin-proposal-object-rest-spread',
47+
'@babel/plugin-syntax-dynamic-import',
48+
'@babel/plugin-transform-object-assign',
49+
],
50+
},
51+
},
52+
};

0 commit comments

Comments
 (0)