build: 配置代码格式化

This commit is contained in:
陈凯龙 2021-12-07 17:16:17 +08:00
parent ced99de9b1
commit ffdb556a09
7 changed files with 4886 additions and 1190 deletions

View File

@ -1,7 +1,79 @@
module.exports = {
extends: ['@antfu'],
// @ts-check
const { defineConfig } = require('eslint-define-config')
module.exports = defineConfig({
root: true,
env: {
browser: true,
node: true,
es6: true
},
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 2020,
sourceType: 'module',
jsxPragma: 'React',
ecmaFeatures: {
jsx: true
}
},
extends: [
'plugin:vue/vue3-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended'
],
rules: {
'comma-dangle': [2, 'never'],
curly: [2, 'multi-line']
'vue/script-setup-uses-vars': 'error',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-empty-function': 'off',
'vue/custom-event-name-casing': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_'
}
],
'no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_'
}
],
'space-before-function-paren': 'off',
'vue/attributes-order': 'off',
'vue/one-component-per-file': 'off',
'vue/html-closing-bracket-newline': 'off',
'vue/max-attributes-per-line': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/attribute-hyphenation': 'off',
'vue/require-default-prop': 'off',
'vue/require-explicit-emits': 'off',
'vue/html-self-closing': [
'error',
{
html: {
void: 'always',
normal: 'never',
component: 'always'
},
svg: 'always',
math: 'always'
}
],
'vue/multi-word-component-names': 'off'
}
}
})

View File

@ -26,7 +26,6 @@
"vue-router": "^4.0.12"
},
"devDependencies": {
"@antfu/eslint-config": "^0.12.1",
"@commitlint/cli": "^15.0.0",
"@commitlint/config-conventional": "^15.0.0",
"@typescript-eslint/eslint-plugin": "^5.6.0",
@ -38,17 +37,19 @@
"eslint": "^8.4.1",
"eslint-config-prettier": "^8.3.0",
"eslint-define-config": "^1.2.0",
"eslint-plugin-jest": "^25.3.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.2.0",
"husky": "^7.0.4",
"less": "^4.1.2",
"lint-staged": "^12.1.2",
"postcss": "^8.4.4",
"postcss-html": "^1.3.0",
"postcss-less": "^5.0.0",
"prettier": "^2.5.1",
"pretty-quick": "^3.1.2",
"rimraf": "^3.0.2",
"stylelint": "^14.1.0",
"stylelint-config-html": "^1.0.0",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-standard": "^24.0.0",
"stylelint-order": "^5.0.0",
@ -59,8 +60,7 @@
"vite-plugin-eslint": "^1.3.0",
"vite-plugin-vue-setup-extend": "^0.1.0",
"vite-plugin-windicss": "^1.5.4",
"vue-eslint-parser": "^8.0.1",
"vue-tsc": "^0.3.0",
"windicss": "^3.2.1"
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -6,20 +6,23 @@ import HelloWorld from './components/HelloWorld.vue'
<template>
<div>sss</div>
<div v:bg="blue-400 hover:blue-500 dark:blue-500 dark:hover:blue-600">
sssss
</div>
<img alt="Vue logo" src="./assets/logo.png">
<div v:bg="blue-400 hover:blue-500 dark:blue-500 dark:hover:blue-600"> sssss </div>
<img alt="Vue logo" src="./assets/logo.png" />
<div>sss</div>
<HelloWorld msg="Hello Vue 3 + TypeScript + Vite" />
</template>
<style>
<style scoped>
#app {
margin-top: 60px;
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
text-align: center;
}
div {
color: #2c3e50;
}
</style>

View File

@ -19,16 +19,12 @@ const count = ref(0)
<p>See <code>README.md</code> for more information.</p>
<p>
<a href="https://vitejs.dev/guide/features.html" target="_blank">
Vite Docs
</a>
<a href="https://vitejs.dev/guide/features.html" target="_blank"> Vite Docs </a>
|
<a href="https://v3.vuejs.org/" target="_blank">Vue 3 Docs</a>
</p>
<button type="button" @click="count++">
count is: {{ count }}
</button>
<button type="button" @click="count++"> count is: {{ count }} </button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test hot module replacement.
@ -46,9 +42,9 @@ label {
}
code {
background-color: #eee;
padding: 2px 4px;
border-radius: 4px;
color: #304455;
background-color: #eee;
border-radius: 4px;
}
</style>

View File

@ -1,6 +1,7 @@
module.exports = {
root: true,
plugins: ['stylelint-order'],
customSyntax: 'postcss-html',
extends: ['stylelint-config-standard', 'stylelint-config-prettier'],
rules: {
'selector-pseudo-class-no-unknown': [
@ -15,7 +16,6 @@ module.exports = {
ignoreAtRules: ['function', 'if', 'each', 'include', 'mixin']
}
],
'function-calc-no-invalid': null,
'no-empty-source': null,
'named-grid-areas-no-invalid': null,
'unicode-bom': 'never',
@ -206,5 +206,26 @@ module.exports = {
'speak'
]
},
ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts']
ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts'],
overrides: [
{
files: ['*.vue', '**/*.vue', '*.html', '**/*.html'],
extends: ['stylelint-config-recommended', 'stylelint-config-html'],
rules: {
'keyframes-name-pattern': null,
'selector-pseudo-class-no-unknown': [
true,
{
ignorePseudoClasses: ['deep', 'global']
}
],
'selector-pseudo-element-no-unknown': [
true,
{
ignorePseudoElements: ['v-deep', 'v-global', 'v-slotted']
}
]
}
}
]
}

View File

@ -64,7 +64,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
css: {
preprocessorOptions: {
less: {
additionalData: '@import "./src/styles/variables.less";',
// additionalData: '@import "./src/styles/variables.less";',
javascriptEnabled: true
}
}