Skip to content

Commit de2a67c

Browse files
committed
refactoring
1 parent 0511193 commit de2a67c

37 files changed

+1078
-1192
lines changed

.babelrc

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

.eslintrc.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ extends:
55
- plugin:@mysticatea/+browser
66

77
rules:
8-
require-unicode-regexp: off
8+
no-trailing-spaces: error
9+
require-unicode-regexp: "off"
910

1011
overrides:
1112
- files: "*.vue"

package.json

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
"dependencies": {},
1212
"devDependencies": {
1313
"@babel/core": "^7.1.2",
14+
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
15+
"@babel/plugin-transform-runtime": "^7.1.0",
16+
"@babel/polyfill": "^7.0.0",
1417
"@babel/preset-env": "^7.1.0",
18+
"@babel/runtime": "^7.1.2",
1519
"@mysticatea/eslint-plugin": "^6.0.0",
1620
"appcache-manifest": "^2.1.0",
1721
"babel-eslint": "^10.0.1",
@@ -21,39 +25,41 @@
2125
"css-loader": "^1.0.0",
2226
"eslint": "^5.7.0",
2327
"eslint-plugin-vue": "^5.0.0-beta.3",
28+
"eslint4b": "^5.7.0",
2429
"file-loader": "^2.0.0",
25-
"lodash": "^4.17.4",
2630
"material-design-icons": "^3.0.1",
27-
"monaco-editor": "^0.10.1",
2831
"npm-run-all": "^4.1.2",
2932
"pako": "^1.0.6",
33+
"postcss-loader": "^3.0.0",
34+
"postcss-preset-env": "^6.1.2",
3035
"rimraf": "^2.6.2",
3136
"shelljs": "^0.8.2",
3237
"string-replace-loader": "^1.3.0",
38+
"url-loader": "^1.1.2",
3339
"vue": "^2.5.9",
40+
"vue-eslint-editor": "^0.1.1",
3441
"vue-eslint-parser": "^3.2.2",
3542
"vue-loader": "^15.4.2",
3643
"vue-template-compiler": "^2.5.9",
3744
"webpack": "^4.21.0",
45+
"webpack-cli": "^3.1.2",
3846
"webpack-dev-server": "^3.1.9"
3947
},
4048
"scripts": {
41-
"build": "cross-env NODE_ENV=production run-s clean build:*",
49+
"build": "run-s -s clean build:*",
4250
"build:html": "appcache-manifest-fixer src/index.html -o dist/index.html",
43-
"build:js": "webpack --progress --hide-modules",
44-
"build:monaco": "node scripts/copy-monaco",
51+
"build:js": "webpack --env.production --progress",
4552
"build:manifest": "appcache-manifest \"dist/**/*.{css,html,js,svg,eot,ttf,woff,woff2}\" --prefix /vue-eslint-demo --network-star -o dist/index.appcache",
4653
"build:versions": "node scripts/make-versions",
4754
"clean": "rimraf dist",
4855
"deploy": "node scripts/deploy",
4956
"lint": "eslint . --ext .js,.vue --rulesdir eslint-rules",
50-
"preversion": "run-s lint build -s",
57+
"preversion": "run-s -s lint build",
5158
"postversion": "git push --tags && git push",
5259
"update-deps": "npm install eslint@latest eslint-plugin-vue@latest vue-eslint-parser@latest babel-eslint@latest",
53-
"watch": "cross-env NODE_ENV=development run-p watch:* -s",
60+
"watch": "run-p -s watch:*",
5461
"watch:html": "cpx src/index.html dist --watch",
55-
"watch:js": "webpack-dev-server --open --hot",
56-
"watch:monaco": "node scripts/copy-monaco --watch"
62+
"watch:js": "webpack-dev-server --open --hot"
5763
},
5864
"repository": {
5965
"type": "git",

scripts/copy-monaco.js

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

src/actions/edit-code.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Edit code.
3+
* @param {State} state The previous state
4+
* @param {string} code The new code.
5+
* @returns {State} The next state.
6+
*/
7+
export function editCode(state, code) {
8+
state.code = code
9+
}

src/actions/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export * from "./edit-code"
2+
export * from "./select-indent-size"
3+
export * from "./select-indent-type"
4+
export * from "./select-parser"
5+
export * from "./select-rule-severity"

src/actions/select-indent-size.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Select indent size.
3+
* @param {State} state The previous state
4+
* @param {number} indentSize The new indent size.
5+
* @returns {State} The next state.
6+
*/
7+
export function selectIndentSize(state, indentSize) {
8+
state.indentSize = indentSize
9+
}

src/actions/select-indent-type.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Select indent type.
3+
* @param {State} state The previous state
4+
* @param {string} indentType The new indent type.
5+
* @returns {State} The next state.
6+
*/
7+
export function selectIndentType(state, indentType) {
8+
state.indentType = indentType
9+
}

src/actions/select-parser.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Select parser.
3+
* @param {State} state The previous state
4+
* @param {string} parserId The new parser ID.
5+
* @returns {State} The next state.
6+
*/
7+
export function selectParser(state, parserId) {
8+
state.config.parserOptions.parser = parserId
9+
}

src/actions/select-rule-severity.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Select rule's severity.
3+
* @param {State} state The previous state
4+
* @param {string|string[]} ruleIdOrRuleIds The rule ID to update severity.
5+
* @param {number} severity The new severity.
6+
* @returns {State} The next state.
7+
*/
8+
export function selectRuleSeverity(state, ruleIdOrRuleIds, severity) {
9+
const severityMap = state.config.rules
10+
11+
if (Array.isArray(ruleIdOrRuleIds)) {
12+
for (const ruleId of ruleIdOrRuleIds) {
13+
severityMap[ruleId] = severity
14+
}
15+
} else {
16+
const ruleId = ruleIdOrRuleIds
17+
severityMap[ruleId] = severity
18+
}
19+
}

0 commit comments

Comments
 (0)