Skip to content

Commit 021c62b

Browse files
committed
feat(eslint): add more rules
1 parent c48b8f9 commit 021c62b

File tree

5 files changed

+87
-64
lines changed

5 files changed

+87
-64
lines changed

.eslintrc.js

+83-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,91 @@ module.exports = {
1111
extends: [
1212
'@nuxtjs',
1313
'plugin:nuxt/recommended',
14-
'prettier'
14+
'plugin:vue/strongly-recommended',
15+
'plugin:vue/recommended',
16+
'prettier',
1517
],
1618
plugins: [
1719
],
1820
// add your custom rules here
19-
rules: {}
21+
rules: {
22+
'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 1 }],
23+
'padding-line-between-statements': [
24+
'error',
25+
{ blankLine: 'always', prev: '*', next: 'return' },
26+
{ blankLine: 'always', prev: '*', next: 'export' },
27+
],
28+
'vue/component-definition-name-casing': 'error',
29+
'vue/array-bracket-spacing': 'error',
30+
'vue/arrow-spacing': 'error',
31+
'vue/block-spacing': 'error',
32+
'vue/brace-style': 'error',
33+
'vue/camelcase': 'error',
34+
'vue/comma-dangle': ['error', 'always-multiline'],
35+
'vue/eqeqeq': [
36+
'error',
37+
'always',
38+
{
39+
null: 'always',
40+
},
41+
],
42+
'vue/key-spacing': 'error',
43+
'vue/keyword-spacing': 'error',
44+
'vue/no-boolean-default': ['error', 'default-false'],
45+
'vue/no-deprecated-scope-attribute': 'error',
46+
'vue/no-empty-pattern': 'error',
47+
'vue/object-curly-spacing': ['error', 'always'],
48+
'vue/padding-line-between-blocks': 'error',
49+
'vue/space-infix-ops': 'error',
50+
'vue/space-unary-ops': 'error',
51+
'vue/v-on-function-call': 'error',
52+
'vue/order-in-components': 'error',
53+
'vue/v-slot-style': [
54+
'error',
55+
{
56+
atComponent: 'v-slot',
57+
default: 'v-slot',
58+
named: 'longform',
59+
},
60+
],
61+
'vue/valid-v-slot': [
62+
'error',
63+
{
64+
allowModifiers: true,
65+
},
66+
],
67+
'vue/require-default-prop': 'off',
68+
'vue/singleline-html-element-content-newline': 'off',
69+
'vue/html-self-closing': [
70+
'error',
71+
{
72+
html: {
73+
void: 'any',
74+
normal: 'always',
75+
component: 'always',
76+
},
77+
svg: 'always',
78+
math: 'always',
79+
},
80+
],
81+
'vue/custom-event-name-casing': ['error', 'kebab-case'],
82+
'vue/v-on-event-hyphenation': ['error', 'always'],
83+
'vue/attribute-hyphenation': ['error', 'always'],
84+
'vue/prop-name-casing': ['error', 'camelCase'],
85+
'vue/no-lone-template': 'off',
86+
'vue/html-indent': 'error',
87+
'vue/max-attributes-per-line': ['error', {
88+
singleline: {
89+
max: 3,
90+
allowFirstLine: true,
91+
},
92+
multiline: {
93+
max: 1,
94+
allowFirstLine: false,
95+
},
96+
}],
97+
'quote-props': [2, 'consistent-as-needed'],
98+
'vue/component-name-in-template-casing': ['error', 'PascalCase'],
99+
'vue/dot-location': ['error', 'property'],
100+
}
20101
}

components/base/ExampleBase.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
</template>
44

55
<script>
6-
import { defineComponent } from '@nuxtjs/composition-api';
6+
import { defineComponent } from '@nuxtjs/composition-api'
77
88
export default defineComponent({
99
name: '',
1010
props: {},
1111
setup() {},
12-
});
12+
})
1313
</script>

components/base/NuxtLogo.vue

-11
This file was deleted.

components/base/Tutorial.vue

-46
This file was deleted.

pages/index.vue

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
>
1111
{{ $t('changeLocale') }}
1212
</el-button>
13-
1413
<el-button
1514
v-else
1615
key="vi-button"
@@ -30,11 +29,11 @@
3029
</template>
3130

3231
<script lang="ts">
33-
import { defineComponent } from '@nuxtjs/composition-api';
32+
import { defineComponent } from '@nuxtjs/composition-api'
3433
3534
export default defineComponent({
3635
name: 'IndexPage',
37-
});
36+
})
3837
</script>
3938

4039
<style lang="scss" module>

0 commit comments

Comments
 (0)