Skip to content

Commit dbc3541

Browse files
committed
refactor: 修改代码格式化
1 parent f356be7 commit dbc3541

File tree

11 files changed

+406
-83
lines changed

11 files changed

+406
-83
lines changed

Diff for: .eslintrc.js

+26-21
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,42 @@ module.exports = {
1414
ecmaFeatures: {
1515
jsx: true,
1616
},
17+
project: './tsconfig.*?.json',
18+
createDefaultProgram: false,
19+
extraFileExtensions: ['.vue'],
1720
},
1821
extends: ['plugin:vue/vue3-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
22+
plugins: ['vue', '@typescript-eslint', 'import'],
1923
rules: {
20-
'vue/script-setup-uses-vars': 'error',
21-
'@typescript-eslint/ban-ts-ignore': 'off',
22-
'@typescript-eslint/explicit-function-return-type': 'off',
23-
'@typescript-eslint/no-explicit-any': 'off',
24-
'@typescript-eslint/no-var-requires': 'off',
25-
'@typescript-eslint/no-empty-function': 'off',
26-
'vue/custom-event-name-casing': 'off',
24+
'no-unused-vars': 'off',
25+
'no-case-declarations': 'off',
2726
'no-use-before-define': 'off',
28-
'@typescript-eslint/no-use-before-define': 'off',
29-
'@typescript-eslint/ban-ts-comment': 'off',
30-
'@typescript-eslint/ban-types': 'off',
31-
'@typescript-eslint/no-non-null-assertion': 'off',
32-
'@typescript-eslint/explicit-module-boundary-types': 'off',
27+
'space-before-function-paren': 'off',
28+
29+
'import/first': 'error',
30+
'import/newline-after-import': 'error',
31+
'import/no-duplicates': 'error',
32+
3333
'@typescript-eslint/no-unused-vars': [
3434
'error',
3535
{
3636
argsIgnorePattern: '^_',
3737
varsIgnorePattern: '^_',
3838
},
3939
],
40-
'no-unused-vars': [
41-
'error',
42-
{
43-
argsIgnorePattern: '^_',
44-
varsIgnorePattern: '^_',
45-
},
46-
],
47-
'space-before-function-paren': 'off',
48-
40+
'@typescript-eslint/ban-ts-ignore': 'off',
41+
'@typescript-eslint/ban-ts-comment': 'off',
42+
'@typescript-eslint/ban-types': 'off',
43+
'@typescript-eslint/explicit-function-return-type': 'off',
44+
'@typescript-eslint/no-explicit-any': 'off',
45+
'@typescript-eslint/no-var-requires': 'off',
46+
'@typescript-eslint/no-empty-function': 'off',
47+
'@typescript-eslint/no-use-before-define': 'off',
48+
'@typescript-eslint/no-non-null-assertion': 'off',
49+
'@typescript-eslint/explicit-module-boundary-types': 'off',
50+
'vue/script-setup-uses-vars': 'error',
51+
'vue/no-reserved-component-names': 'off',
52+
'vue/custom-event-name-casing': 'off',
4953
'vue/attributes-order': 'off',
5054
'vue/one-component-per-file': 'off',
5155
'vue/html-closing-bracket-newline': 'off',
@@ -69,4 +73,5 @@ module.exports = {
6973
],
7074
'vue/multi-word-component-names': 'off',
7175
},
76+
globals: { defineOptions: 'readonly' },
7277
};

Diff for: package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
"eslint": "^8.42.0",
5151
"eslint-config-prettier": "^8.8.0",
5252
"eslint-define-config": "^1.20.0",
53+
"eslint-plugin-import": "^2.27.5",
5354
"eslint-plugin-prettier": "^4.2.1",
55+
"eslint-plugin-simple-import-sort": "^10.0.0",
5456
"eslint-plugin-vue": "^9.14.1",
5557
"husky": "^8.0.3",
5658
"import": "^0.0.6",
@@ -64,14 +66,16 @@
6466
"postcss-html": "^1.5.0",
6567
"postcss-less": "^6.0.0",
6668
"postcss-px-to-viewport": "^1.1.1",
69+
"postcss-scss": "^4.0.6",
6770
"prettier": "^2.8.8",
6871
"rollup-plugin-visualizer": "^5.9.2",
6972
"stylelint": "^15.7.0",
70-
"stylelint-config-prettier": "^9.0.5",
7173
"stylelint-config-recommended": "^12.0.0",
7274
"stylelint-config-recommended-vue": "^1.4.0",
7375
"stylelint-config-standard": "^33.0.0",
76+
"stylelint-config-standard-scss": "^10.0.0",
7477
"stylelint-order": "^6.0.3",
78+
"stylelint-prettier": "^3.0.0",
7579
"typescript": "5.0.4",
7680
"unocss": "^0.53.1",
7781
"unplugin-auto-import": "^0.16.4",
@@ -90,6 +94,7 @@
9094
"vite-plugin-svg-icons": "^2.0.1",
9195
"vite-plugin-vue-images": "^0.6.1",
9296
"vite-plugin-vue-setup-extend": "^0.4.0",
97+
"vue-eslint-parser": "^9.3.1",
9398
"vue-tsc": "^1.7.0"
9499
},
95100
"resolutions": {

Diff for: src/App.vue

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
body {
99
height: 100%;
1010
}
11+
1112
#app {
1213
font-family: Avenir, Helvetica, Arial, sans-serif;
1314
-webkit-font-smoothing: antialiased;

Diff for: src/hooks/loading.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ref } from 'vue';
2+
23
export default function useLoading(initValue = false) {
34
const loading = ref(initValue);
45
const setLoading = (value: boolean) => {

Diff for: src/utils/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { resolve } from 'path';
2+
23
const fs = require('fs');
34

45
function pathResolve(dir: string) {

Diff for: src/views/contain/component/main.vue

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<template>
22
<div class="echart">
3-
<div id="myEChartsBar"></div>
4-
<div id="myEChartsLine"></div>
3+
<div id="my-echartsbar"></div>
4+
<div id="my-echartsline"></div>
55
</div>
66
</template>
77

88
<script setup lang="ts">
99
import echarts from '../../../common/echarts';
10+
1011
const changeBar = (bar) => {
1112
const myEChart = echarts.init(bar);
1213
const option = {
@@ -66,10 +67,11 @@
6667
</script>
6768

6869
<style scoped>
69-
#myEChartsBar {
70+
#my-echartsbar {
7071
height: 300px;
7172
}
72-
#myEChartsLine {
73+
74+
#my-echartsline {
7375
height: 300px;
7476
}
7577
</style>

Diff for: src/views/contain/component/subAside.vue

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// import { ref } from 'vue';
2020
// 拿到父组件传入的值
2121
import SubAside from './subAside.vue';
22+
2223
defineProps({
2324
isCollapse: Boolean,
2425
menu: Object,

Diff for: src/views/contain/index.vue

+2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
<style lang="less" scoped>
2020
.common-layout {
2121
height: 100%;
22+
2223
.el-container {
2324
height: 100%;
2425
}
26+
2527
.el-header {
2628
padding: 0;
2729
}

Diff for: src/views/demo/index.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import { reactive } from 'vue';
33
import Header from '/@/components/Header/index.vue';
4+
45
const title = `通过TailWind快速实现<br>Github2021年年度
56
<a traget="_blank" href="https://octoverse.github.com/"><font>octoverse</font></a>`;
67
const datav = reactive([
@@ -45,11 +46,11 @@
4546
}
4647
4748
.bg-2 {
48-
background-color: rgba(244, 248, 253, 1);
49+
background-color: rgb(244 248 253 / 100%);
4950
}
5051
5152
.bg-3 {
52-
background-color: rgba(240, 248, 246, 1);
53+
background-color: rgb(240 248 246 / 100%);
5354
}
5455
5556
font {

Diff for: stylelint.config.js

+27-36
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,36 @@
11
module.exports = {
22
root: true,
3-
plugins: ['stylelint-order'],
4-
extends: ['stylelint-config-standard', 'stylelint-config-prettier'],
5-
customSyntax: 'postcss-html',
3+
extends: ['stylelint-config-standard'],
4+
plugins: ['stylelint-order', 'stylelint-prettier'],
5+
// customSyntax: 'postcss-html',
6+
overrides: [
7+
{
8+
files: ['**/*.(css|html|vue)'],
9+
customSyntax: 'postcss-html',
10+
},
11+
{
12+
files: ['*.less', '**/*.less'],
13+
customSyntax: 'postcss-less',
14+
extends: ['stylelint-config-standard', 'stylelint-config-recommended-vue'],
15+
},
16+
{
17+
files: ['*.scss', '**/*.scss'],
18+
customSyntax: 'postcss-scss',
19+
extends: ['stylelint-config-standard-scss', 'stylelint-config-recommended-vue/scss'],
20+
rule: {
21+
'scss/percent-placeholder-pattern': null,
22+
},
23+
},
24+
],
625
rules: {
26+
'selector-not-notation': null,
27+
'import-notation': null,
728
'function-no-unknown': null,
829
'selector-class-pattern': null,
930
'selector-pseudo-class-no-unknown': [
1031
true,
1132
{
12-
ignorePseudoClasses: ['global'],
33+
ignorePseudoClasses: ['global', 'deep'],
1334
},
1435
],
1536
'selector-pseudo-element-no-unknown': [
@@ -21,18 +42,14 @@ module.exports = {
2142
'at-rule-no-unknown': [
2243
true,
2344
{
24-
ignoreAtRules: ['tailwind', 'apply', 'variants', 'responsive', 'screen', 'function', 'if', 'each', 'include', 'mixin'],
45+
ignoreAtRules: ['tailwind', 'apply', 'variants', 'responsive', 'screen', 'function', 'if', 'each', 'include', 'mixin', 'extend'],
2546
},
2647
],
2748
'no-empty-source': null,
2849
'string-quotes': null,
2950
'named-grid-areas-no-invalid': null,
30-
'unicode-bom': 'never',
3151
'no-descending-specificity': null,
3252
'font-family-no-missing-generic-family-keyword': null,
33-
'declaration-colon-space-after': 'always-single-line',
34-
'declaration-colon-space-before': 'never',
35-
// 'declaration-block-trailing-semicolon': 'always',
3653
'rule-empty-line-before': [
3754
'always',
3855
{
@@ -56,34 +73,8 @@ module.exports = {
5673
},
5774
'rules',
5875
],
59-
{ severity: 'warning' },
76+
{ severity: 'error' },
6077
],
6178
},
6279
ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts'],
63-
overrides: [
64-
{
65-
files: ['*.vue', '**/*.vue', '*.html', '**/*.html'],
66-
extends: ['stylelint-config-recommended'],
67-
rules: {
68-
'keyframes-name-pattern': null,
69-
'selector-pseudo-class-no-unknown': [
70-
true,
71-
{
72-
ignorePseudoClasses: ['deep', 'global'],
73-
},
74-
],
75-
'selector-pseudo-element-no-unknown': [
76-
true,
77-
{
78-
ignorePseudoElements: ['v-deep', 'v-global', 'v-slotted'],
79-
},
80-
],
81-
},
82-
},
83-
{
84-
files: ['*.less', '**/*.less'],
85-
customSyntax: 'postcss-less',
86-
extends: ['stylelint-config-standard', 'stylelint-config-recommended-vue'],
87-
},
88-
],
8980
};

0 commit comments

Comments
 (0)