【modify】ESLint更迭版本

This commit is contained in:
zer0Black
2023-02-28 23:23:17 +08:00
parent eff3c5e384
commit 694855ae8b
4 changed files with 61 additions and 125 deletions
+6
View File
@@ -37,3 +37,9 @@ indent_size=2
indent_style=space indent_style=space
indent_size=2 indent_size=2
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
-32
View File
@@ -1,32 +0,0 @@
module.exports = {
"env": {
"browser": true,
"node": true,
"es6": true
},
"extends": [
"eslint:recommended",
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "vue-eslint-parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"parser": "babel-eslint"
},
"plugins": [
"vue"
],
"rules": {
'quotes': [2, 'single', {
'avoidEscape': true,
'allowTemplateLiterals': true
}],
'semi': [2, 'never'],
'no-console': 'off',
"no-debugger": "off"
}
}
+16 -53
View File
@@ -3,20 +3,22 @@
"version": "2.4.6", "version": "2.4.6",
"private": true, "private": true,
"scripts": { "scripts": {
"pre": "cnpm install || yarn --registry https://registry.npm.taobao.org || npm install --registry https://registry.npm.taobao.org ",
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build:test": "vue-cli-service build --mode test",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint",
"build:test": "vue-cli-service build --mode test",
"pre": "cnpm install || yarn --registry https://registry.npm.taobao.org || npm install --registry https://registry.npm.taobao.org "
}, },
"dependencies": { "dependencies": {
"@antv/data-set": "^0.11.4", "@antv/data-set": "^0.11.4",
"@tinymce/tinymce-vue": "2.1.0",
"@toast-ui/editor": "^2.1.2", "@toast-ui/editor": "^2.1.2",
"ant-design-vue": "^1.7.2", "ant-design-vue": "^1.7.2",
"china-area-data": "^5.0.1",
"axios": "^0.21.1", "axios": "^0.21.1",
"china-area-data": "^5.0.1",
"clipboard": "^2.0.4", "clipboard": "^2.0.4",
"codemirror": "^5.46.0", "codemirror": "^5.46.0",
"cron-parser": "^2.10.0",
"dayjs": "^1.8.0", "dayjs": "^1.8.0",
"dom-align": "1.12.0", "dom-align": "1.12.0",
"echarts": "^5.0.2", "echarts": "^5.0.2",
@@ -28,7 +30,6 @@
"lodash.pick": "^4.4.0", "lodash.pick": "^4.4.0",
"md5": "^2.2.1", "md5": "^2.2.1",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"@tinymce/tinymce-vue": "2.1.0",
"tinymce": "5.4.1", "tinymce": "5.4.1",
"viser-vue": "^2.4.8", "viser-vue": "^2.4.8",
"vue": "^2.6.10", "vue": "^2.6.10",
@@ -45,65 +46,27 @@
"vuex": "^3.1.0", "vuex": "^3.1.0",
"vxe-table": "2.9.13", "vxe-table": "2.9.13",
"vxe-table-plugin-antd": "1.8.10", "vxe-table-plugin-antd": "1.8.10",
"xe-utils": "2.4.8", "xe-utils": "2.4.8"
"cron-parser": "^2.10.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/polyfill": "^7.2.5", "@babel/polyfill": "^7.2.5",
"@vue/cli-plugin-babel": "^3.3.0", "@vue/cli-plugin-babel": "^3.3.0",
"@vue/cli-plugin-eslint": "^3.3.0", "@vue/cli-plugin-eslint": "~4.2.3",
"@vue/cli-service": "^3.3.0", "@vue/cli-service": "^3.3.0",
"@vue/eslint-config-standard": "^4.0.0", "@vue/eslint-config-standard": "^5.1.0",
"babel-eslint": "7.2.3", "babel-eslint": "^10.0.3",
"compression-webpack-plugin": "^3.1.0", "compression-webpack-plugin": "^3.1.0",
"eslint": "^5.16.0", "eslint": "^6.7.2",
"eslint-plugin-vue": "^5.1.0", "eslint-plugin-import": "^2.20.1",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^6.1.2",
"html-webpack-plugin": "^4.2.0", "html-webpack-plugin": "^4.2.0",
"less": "^3.9.0", "less": "^3.9.0",
"less-loader": "^4.1.0", "less-loader": "^4.1.0",
"vue-template-compiler": "^2.6.10" "vue-template-compiler": "^2.6.10"
}, },
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/strongly-recommended",
"@vue/standard"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {
"generator-star-spacing": "off",
"no-mixed-operators": 0,
"vue/max-attributes-per-line": [
2,
{
"singleline": 5,
"multiline": {
"max": 1,
"allowFirstLine": false
}
}
],
"vue/attribute-hyphenation": 0,
"vue/html-self-closing": 0,
"vue/component-name-in-template-casing": 0,
"vue/html-closing-bracket-spacing": 0,
"vue/singleline-html-element-content-newline": 0,
"vue/no-unused-components": 0,
"vue/multiline-html-element-content-newline": 0,
"vue/no-use-v-if-with-v-for": 0,
"vue/html-closing-bracket-newline": 0,
"vue/no-parsing-error": 0,
"no-tabs": 0,
"indent": ["off", 2],
"no-console": 0,
"space-before-function-paren": 0
}
},
"postcss": { "postcss": {
"plugins": { "plugins": {
"autoprefixer": {} "autoprefixer": {}
+39 -40
View File
@@ -28,8 +28,8 @@
import 'codemirror/lib/codemirror.css' import 'codemirror/lib/codemirror.css'
// 引入主题后还需要在 options 中指定主题才会生效 darcula gruvbox-dark hopscotch monokai // 引入主题后还需要在 options 中指定主题才会生效 darcula gruvbox-dark hopscotch monokai
import 'codemirror/theme/panda-syntax.css' import 'codemirror/theme/panda-syntax.css'
//提示css // 提示css
import "codemirror/addon/hint/show-hint.css"; import 'codemirror/addon/hint/show-hint.css'
// 需要引入具体的语法高亮库才会有对应的语法高亮效果 // 需要引入具体的语法高亮库才会有对应的语法高亮效果
// codemirror 官方其实支持通过 /addon/mode/loadmode.js 和 /mode/meta.js 来实现动态加载对应语法高亮库 // codemirror 官方其实支持通过 /addon/mode/loadmode.js 和 /mode/meta.js 来实现动态加载对应语法高亮库
@@ -64,10 +64,10 @@
type: String, type: String,
default: null default: null
}, },
languageChange:{ languageChange: {
type: Boolean, type: Boolean,
default:false, default: false,
required:false required: false
}, },
placeholder: { placeholder: {
type: String, type: String,
@@ -101,14 +101,14 @@
height: { height: {
type: [String, Number], type: [String, Number],
default: '240px' default: '240px'
}, }
}, },
data () { data () {
return { return {
// 内部真实的内容 // 内部真实的内容
code: '', code: '',
iconType: 'fullscreen', iconType: 'fullscreen',
hasCode:false, hasCode: false,
// 默认的语法类型 // 默认的语法类型
mode: 'javascript', mode: 'javascript',
// 编辑器实例 // 编辑器实例
@@ -126,7 +126,7 @@
users: ['name', 'score', 'birthDate'], users: ['name', 'score', 'birthDate'],
countries: ['name', 'population', 'size'] countries: ['name', 'population', 'size']
} }
}, }
}, },
// 支持切换的语法高亮类型,对应 JS 已经提前引入 // 支持切换的语法高亮类型,对应 JS 已经提前引入
// 使用的是 MIME-TYPE ,不过作为前缀的 text/ 在后面指定时写死了 // 使用的是 MIME-TYPE ,不过作为前缀的 text/ 在后面指定时写死了
@@ -172,12 +172,12 @@
} }
}, },
watch: { watch: {
fullCoder:{ fullCoder: {
handler(value) { handler(value) {
if(value){ if (value) {
this.iconType="fullscreen-exit" this.iconType = 'fullscreen-exit'
}else{ } else {
this.iconType="fullscreen" this.iconType = 'fullscreen'
} }
} }
}, },
@@ -216,7 +216,7 @@
return this.placeholder return this.placeholder
} }
}, },
nullTipStyle(){ nullTipStyle() {
if (this.lineNumbers) { if (this.lineNumbers) {
return { left: '36px' } return { left: '36px' }
} else { } else {
@@ -234,7 +234,7 @@
} }
}, },
isAutoHeight() { isAutoHeight() {
let {autoHeight} = this let { autoHeight } = this
if (typeof autoHeight === 'string' && autoHeight.toLowerCase().trim() === '!ie') { if (typeof autoHeight === 'string' && autoHeight.toLowerCase().trim() === '!ie') {
autoHeight = !(isIE() || isIE11()) autoHeight = !(isIE() || isIE11())
} else { } else {
@@ -251,7 +251,7 @@
}, },
style: {} style: {}
} }
if(isIE() || isIE11()){ if (isIE() || isIE11()) {
props.style['height'] = '240px' props.style['height'] = '240px'
} }
if (this.fullCoder) { if (this.fullCoder) {
@@ -273,53 +273,52 @@
// 初始化编辑器实例,传入需要被实例化的文本域对象和默认配置 // 初始化编辑器实例,传入需要被实例化的文本域对象和默认配置
this.coder = CodeMirror.fromTextArea(this.$refs.textarea, this.coderOptions) this.coder = CodeMirror.fromTextArea(this.$refs.textarea, this.coderOptions)
// 编辑器赋值 // 编辑器赋值
if(this.value||this.code){ if (this.value || this.code) {
this.hasCode=true this.hasCode = true
//this.coder.setValue(this.value || this.code) // this.coder.setValue(this.value || this.code)
this.setCodeContent(this.value || this.code) this.setCodeContent(this.value || this.code)
}else{ } else {
this.coder.setValue('') this.coder.setValue('')
this.hasCode=false this.hasCode = false
} }
// 支持双向绑定 // 支持双向绑定
this.coder.on('change', (coder) => { this.coder.on('change', (coder) => {
this.code = coder.getValue() this.code = coder.getValue()
if(this.code){ if (this.code) {
this.hasCode=true this.hasCode = true
}else{ } else {
this.hasCode=false this.hasCode = false
} }
if (this.$emit) { if (this.$emit) {
this.$emit('input', this.code) this.$emit('input', this.code)
} }
}) })
this.coder.on('focus', () => { this.coder.on('focus', () => {
this.hasCode=true this.hasCode = true
}) })
this.coder.on('blur', () => { this.coder.on('blur', () => {
if(this.code){ if (this.code) {
this.hasCode=true this.hasCode = true
}else{ } else {
this.hasCode=false this.hasCode = false
} }
}) })
/* this.coder.on('cursorActivity',()=>{ /* this.coder.on('cursorActivity',()=>{
this.coder.showHint() this.coder.showHint()
})*/ }) */
}, },
getCodeContent(){ getCodeContent() {
return this.code return this.code
}, },
setCodeContent(val){ setCodeContent(val) {
setTimeout(()=>{ setTimeout(() => {
if(!val){ if (!val) {
this.coder.setValue('') this.coder.setValue('')
}else{ } else {
this.coder.setValue(val) this.coder.setValue(val)
} }
},300) }, 300)
}, },
// 获取当前语法类型 // 获取当前语法类型
_getLanguage (language) { _getLanguage (language) {
@@ -357,7 +356,7 @@
// 允许父容器通过以下函数监听当前的语法值 // 允许父容器通过以下函数监听当前的语法值
this.$emit('language-change', label) this.$emit('language-change', label)
}, },
nullTipClick(){ nullTipClick() {
this.coder.focus() this.coder.focus()
} }
} }
@@ -480,4 +479,4 @@
.CodeMirror-cursor{ .CodeMirror-cursor{
height:18.4px !important; height:18.4px !important;
} }
</style> </style>