Commit 63ccbf59 authored by lipengcheng 's avatar lipengcheng

lint

parent 144f7d03
...@@ -3,15 +3,10 @@ module.exports = { ...@@ -3,15 +3,10 @@ module.exports = {
env: { env: {
node: true node: true
}, },
extends: [ extends: ['plugin:vue/essential', 'eslint:recommended', '@vue/prettier'],
"plugin:vue/essential", plugins: [],
"eslint:recommended",
"plugin:prettier/recommended",
"@vue/prettier",
"prettier"
],
parserOptions: { parserOptions: {
parser: "babel-eslint" parser: 'babel-eslint'
}, },
/**add your custom rules here /**add your custom rules here
* 下面这些rules是用来设置从插件来的规范代码的规则,使用必须去掉前缀eslint-plugin- * 下面这些rules是用来设置从插件来的规范代码的规则,使用必须去掉前缀eslint-plugin-
...@@ -21,221 +16,10 @@ module.exports = { ...@@ -21,221 +16,10 @@ module.exports = {
* "error" 或 2 - 开启规则,使用错误级别的错误:error (当被触发的时候,程序会退出) * "error" 或 2 - 开启规则,使用错误级别的错误:error (当被触发的时候,程序会退出)
*/ */
rules: { rules: {
// 是否开启prettier校验,默认开启 // 是否开启prettier校验,默认开启.可选 warn / error / off
"prettier/prettier": "warn", // "prettier/prettier": "warn",
// "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", // "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-console": [0, { llow: ["warn", "error"] }], 'no-console': [0, { llow: ['warn', 'error'] }],
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off", 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
//缩进风格.默认4,否则会报错
indent: [
2,
4,
{
SwitchCase: 1 // 针对switch case的缩进
}
],
"linebreak-style": ["warn", "unix"],
"no-irregular-whitespace": [
1,
{ skipComments: true, skipTemplates: true, skipRegExps: true }
],
// 强制双引号
// "quotes": ["error", "double"],
// 语句强制分号结尾
// "semi": ["warn", "always"],
// 不检查语句是否以分号结尾
semi: 0,
// 分号前后空格。默认选项禁止分号之前有空格,强制分号之后有空格。
"semi-spacing": [
1,
{
before: false,
after: true
}
],
// 变量声明后必须使用;参数arg不做限制
"no-unused-vars": [
1,
{
vars: "all",
args: "none"
}
],
// 禁止对原生对象或只读的全局对象进行赋值
"no-native-reassign": 2,
// 变量声明、数组字面量、对象字面量、函数参数 和 序列中的逗号前不能有空格,后面必须有一个空格
"comma-spacing": [
1,
{
before: false,
after: true
}
],
// 是否用驼峰风格命名变量:never || always
camelcase: ["error", { properties: "never" }],
// 强制函数括号之前的空格的一致性.
// 每个选项可以设置为 "always"、"never" 或 "ignore"
"space-before-function-paren": [
"warn",
{
// 针对匿名函数表达式 (比如 function () {})
anonymous: "always",
// 针对命名的函数表达式 (比如 function foo () {})。
named: "never",
// 针对异步的箭头函数表达式(比如 async () => {})
asyncArrow: "always"
}
],
// 该规则禁止在 return、throw、continue 和 break 语句后出现不可达代码。
"no-unreachable": 1,
// 消除非故意 case 落空行为
"no-fallthrough": 1,
// 在条件语句中,很容易将一个比较运算符(像 ==)错写成赋值运算符(如 =)
// 所以,该规则禁止在 if、for、while 和 do...while 语句中出现模棱两可的赋值操作符
"no-cond-assign": [2, "always"],
// 强制多行的三目运算符换行
"multiline-ternary": [1, "always-multiline"],
// else关键字要与花括号保持在同一行。
// 'brace-style': 1,
// 'block-spacing': 1, //单行代码块两边加空格。
// 'spaced-comment': 1, //注释首尾留空格
"vue/html-indent": [
"error",
4,
{
attribute: 1,
baseIndent: 1,
closeBracket: 0,
alignAttributesVertically: true,
ignores: []
}
],
// 是否禁止在正则表达式中出现控制字符
"no-control-regex": 0,
// 指定html各种元素、svg、vue组件自闭和标签的规则
"vue/html-self-closing": [
"error",
{
html: {
void: "never",
normal: "never",
component: "never"
},
svg: "always",
math: "always"
}
],
// 每一行的属性数量
"vue/max-attributes-per-line": [
"error",
{
// 单行的话,每行属性的数量
singleline: 2,
// 多行的话,每行属性的数量
multiline: {
max: 1,
// 第一个属性是否与开始标签在同一行
allowFirstLine: false
}
}
],
"vue/multiline-html-element-content-newline": [
"error",
{
ignoreWhenEmpty: true,
ignores: ["pre", "textarea"],
allowEmptyLines: false
}
],
// 单行元素内容是否换行
"vue/singleline-html-element-content-newline": [
0,
{
ignoreWhenEmpty: true,
ignores: ["pre", "textarea"],
ignoreWhenNoAttributes: true
}
],
// 多行元素闭合标签(右括号)换行规则
"vue/html-closing-bracket-newline": [
"error",
{
singleline: "never",
multiline: "never"
}
],
// 单行元素闭合标签(右括号)换行规则
"vue/html-closing-bracket-spacing": [
"error",
{
startTag: "never",
endTag: "never",
selfClosingTag: "never"
}
],
// 属性值引号:"double" | "single"
"vue/html-quotes": ["warn", "double"],
// 组件name属性值的格式
// PascalCase:驼峰 || kebab-case:连接线
"vue/name-property-casing": ["warn", "PascalCase"],
// v-bind写法。shorthand:简写 || longform:不缩写
"vue/v-bind-style": ["error", "shorthand"],
"vue/v-on-style": ["error", "shorthand"],
// html元素中属性顺序
"vue/attributes-order": [
"warn",
{
order: [
"DEFINITION",
"LIST_RENDERING",
"CONDITIONALS",
"RENDER_MODIFIERS",
"GLOBAL",
"UNIQUE",
"TWO_WAY_BINDING",
"OTHER_DIRECTIVES",
"OTHER_ATTR",
"EVENTS",
"CONTENT"
]
}
],
// 组件中属性的顺序
"vue/order-in-components": [
"warn",
{
order: [
"el",
"name",
"parent",
"functional",
["delimiters", "comments"],
["components", "directives", "filters"],
"extends",
"mixins",
"inheritAttrs",
"model",
["props", "propsData"],
"data",
"computed",
"watch",
"LIFECYCLE_HOOKS",
"methods",
["template", "render"],
"renderError"
]
}
],
// 强制在v-on方法后加括号
"vue/v-on-function-call": [2, "never"],
// 报告<template>中的语法错误
"vue/no-parsing-error": [
2,
{
"x-invalid-end-tag": false
}
],
// 去掉检测无用转义的规则
"no-useless-escape": [0]
} }
} }
...@@ -4,7 +4,7 @@ module.exports = { ...@@ -4,7 +4,7 @@ module.exports = {
// 与eslint集成(让prettier使用eslint的代码格式进行校验) // 与eslint集成(让prettier使用eslint的代码格式进行校验)
eslintIntegration: true, eslintIntegration: true,
// 换行长度 // 换行长度
printWidth: 100, printWidth: 150,
// tab缩进大小,默认为2 // tab缩进大小,默认为2
tabWidth: 4, tabWidth: 4,
// 使用tab缩进,默认false // 使用tab缩进,默认false
...@@ -12,7 +12,7 @@ module.exports = { ...@@ -12,7 +12,7 @@ module.exports = {
// 是否使用分号, 默认true // 是否使用分号, 默认true
semi: false, semi: false,
// 是否使用单引号, 默认false(在jsx中配置无效, 默认都是双引号) // 是否使用单引号, 默认false(在jsx中配置无效, 默认都是双引号)
singleQuote: false, singleQuote: true,
// 行尾逗号,默认none,可选 none|es5|all // 行尾逗号,默认none,可选 none|es5|all
// es5 包括es5中的数组、对象 // es5 包括es5中的数组、对象
// all 包括函数对象等所有可选 // all 包括函数对象等所有可选
......
module.exports = { module.exports = {
presets: ["@vue/cli-plugin-babel/preset"] presets: ['@vue/cli-plugin-babel/preset']
} }
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
}, },
"lint-staged": { "lint-staged": {
"**/*.{js,vue}": [ "**/*.{js,vue}": [
"prettier --write", "prettier --write",
"eslint --fix" "eslint --fix"
] ]
}, },
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
"lint-staged": "^10.2.11", "lint-staged": "^10.2.11",
"node-sass": "^4.12.0", "node-sass": "^4.12.0",
"prettier": "^1.19.1", "prettier": "^1.19.1",
"prettier-eslint": "^11.0.0",
"sass-loader": "^8.0.2", "sass-loader": "^8.0.2",
"serve": "^11.3.2", "serve": "^11.3.2",
"standard-version": "^9.0.0", "standard-version": "^9.0.0",
......
...@@ -5,30 +5,27 @@ ...@@ -5,30 +5,27 @@
<side-nav></side-nav> <side-nav></side-nav>
<router-view style="flex:1;border: 1px solid #666;"></router-view> <router-view style="flex:1;border: 1px solid #666;"></router-view>
<right-panel></right-panel> <right-panel></right-panel>
<!-- <video <video src="baidsfsfsdfsdfsdfsdfsdfsdfsfsdfsfsfsefsfsfsdfsdfdsfsdfu.com/mp4" a="afasfsafdfasdfsfadfd"></video>
src="baidsfsfsdfsdfsdfsdfsdfsdfsfsdfsfsfsefsfsfsdfsdfdsfsdfu.com/mp4" <input id="" type="text" name="" />
a="afasfsafdfasdfsfad"></video>
<input id="" type="text"
name=""/> -->
</body> </body>
</div> </div>
</template> </template>
<script> <script>
import CommonHeader from "@/components/header/index.vue" import CommonHeader from '@/components/header/index.vue'
export default { export default {
components: { components: {
CommonHeader, CommonHeader,
SideNav: () => import("@/components/sideNav/index.vue"), SideNav: () => import('@/components/sideNav/index.vue'),
RightPanel: () => import("@/components/rightPanel/index.vue") RightPanel: () => import('@/components/rightPanel/index.vue')
}, },
data() { data() {
return {} return {}
}, },
async created() { async created() {
console.log("this.$http:", this.$http) console.log('this.$http:', this.$http)
let result = await this.$http.get("/webapi/home/banner?type=1&category=18") let result = await this.$http.get('/webapi/home/banner?type=1&category=18')
console.log("result:", result) console.log('result:', result)
} }
} }
</script> </script>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<script> <script>
export default { export default {
components: { components: {
tipPanel: () => import("@/components/header/tipPanel.vue") tipPanel: () => import('@/components/header/tipPanel.vue')
}, },
data() { data() {
return {} return {}
......
import Vue from "vue" import Vue from 'vue'
import App from "./App.vue" import App from './App.vue'
import router from "./router" import router from './router'
import store from "./store" import store from './store'
import "./registerServiceWorker" import './registerServiceWorker'
import axios from "axios" import axios from 'axios'
import baseURL from "../config/baseUrl.js" import baseURL from '../config/baseUrl.js'
console.log("baseURL:", baseURL) console.log('baseURL:', baseURL)
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.$http = axios Vue.prototype.$http = axios
...@@ -15,4 +15,4 @@ new Vue({ ...@@ -15,4 +15,4 @@ new Vue({
router, router,
store, store,
render: (h) => h(App) render: (h) => h(App)
}).$mount("#app") }).$mount('#app')
/* eslint-disable no-console */ /* eslint-disable no-console */
import { register } from "register-service-worker" import { register } from 'register-service-worker'
if (process.env.NODE_ENV === "production") { if (process.env.NODE_ENV === 'production') {
register(`${process.env.BASE_URL}service-worker.js`, { register(`${process.env.BASE_URL}service-worker.js`, {
ready() { ready() {
console.log( console.log('App is being served from cache by a service worker.\n' + 'For more details, visit https://goo.gl/AFskqB')
"App is being served from cache by a service worker.\n" +
"For more details, visit https://goo.gl/AFskqB"
)
}, },
registered() { registered() {
console.log("Service worker has been registered.") console.log('Service worker has been registered.')
}, },
cached() { cached() {
console.log("Content has been cached for offline use.") console.log('Content has been cached for offline use.')
}, },
updatefound() { updatefound() {
console.log("New content is downloading.") console.log('New content is downloading.')
}, },
updated() { updated() {
console.log("New content is available; please refresh.") console.log('New content is available; please refresh.')
}, },
offline() { offline() {
console.log("No internet connection found. App is running in offline mode.") console.log('No internet connection found. App is running in offline mode.')
}, },
error(error) { error(error) {
console.error("Error during service worker registration:", error) console.error('Error during service worker registration:', error)
} }
}) })
} }
import Vue from "vue" import Vue from 'vue'
import VueRouter from "vue-router" import VueRouter from 'vue-router'
import Bao3 from "../views/bao3.vue" import Bao3 from '../views/bao3.vue'
import Screenshot from "../views/screenshot.vue" import Screenshot from '../views/screenshot.vue'
import screenshotPanel from "../components/rightPanel/screenshotPanel.vue" import screenshotPanel from '../components/rightPanel/screenshotPanel.vue'
Vue.use(VueRouter) Vue.use(VueRouter)
const routes = [ const routes = [
{ {
path: "/", path: '/',
name: "Bao3", name: 'Bao3',
component: Bao3 component: Bao3
}, },
{ {
path: "/about", path: '/about',
name: "About", name: 'About',
// route level code-splitting // route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route // this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited. // which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ "../views/About.vue") component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
}, },
{ {
path: "/cutter", path: '/cutter',
name: "Cutter", name: 'Cutter',
component: () => import(/* webpackChunkName: "bao1" */ "../views/videoCutter.vue") component: () => import(/* webpackChunkName: "bao1" */ '../views/videoCutter.vue')
}, },
{ {
path: "/bao2", path: '/bao2',
name: "Bao2", name: 'Bao2',
component: () => import(/* webpackChunkName: "bao2" */ "../views/bao2.vue") component: () => import(/* webpackChunkName: "bao2" */ '../views/bao2.vue')
}, },
{ {
path: "/screenshot", path: '/screenshot',
components: { components: {
default: Screenshot, default: Screenshot,
panel: screenshotPanel panel: screenshotPanel
...@@ -40,7 +40,7 @@ const routes = [ ...@@ -40,7 +40,7 @@ const routes = [
] ]
const router = new VueRouter({ const router = new VueRouter({
mode: "history", mode: 'history',
base: process.env.BASE_URL, base: process.env.BASE_URL,
routes routes
}) })
......
import Vue from "vue" import Vue from 'vue'
import Vuex from "vuex" import Vuex from 'vuex'
Vue.use(Vuex) Vue.use(Vuex)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<script> <script>
export default { export default {
name: "Screenshot", name: 'Screenshot',
data() { data() {
return {} return {}
}, },
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<script> <script>
export default { export default {
name: "VideoConverterBaby", name: 'VideoConverterBaby',
components: {}, components: {},
props: {}, props: {},
data() { data() {
......
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
</template> </template>
<script> <script>
import VideoPlayer from "@/components/videoCutter/videoPlayer.vue" import VideoPlayer from '@/components/videoCutter/videoPlayer.vue'
export default { export default {
components: { components: {
VideoPlayer VideoPlayer
}, },
data() { data() {
return { return {
name: "" name: ''
} }
}, },
created() {}, created() {},
......
// console.log(`process.env1:`, process.env) // console.log(`process.env1:`, process.env)
console.log(`process.env.NODE_ENV1:`, process.env.NODE_ENV) console.log(`process.env.NODE_ENV1:`, process.env.NODE_ENV)
//
module.exports = { module.exports = {
// outputDir: process.env.outputDir, // outputDir: process.env.outputDir,
// assetsDir: 'static', // assetsDir: 'static',
publicPath: "/", publicPath: '/',
devServer: { devServer: {
open: true, open: true,
// host: '0.0.0.0', // host: '0.0.0.0',
...@@ -13,10 +13,10 @@ module.exports = { ...@@ -13,10 +13,10 @@ module.exports = {
hotOnly: false, hotOnly: false,
proxy: { proxy: {
webapi: { webapi: {
target: "https://test2.laihua.com/", target: 'https://test2.laihua.com/',
ws: true, ws: true,
changeOrigin: true, changeOrigin: true,
pathRewrite: { "^/webapi": "/" } pathRewrite: { '^/webapi': '/' }
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment