Skip to content

Commit 15ef610

Browse files
committed
refactor(project): Lint the whole project
1 parent 99a35c4 commit 15ef610

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+340
-242
lines changed

.eslintignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
node_modules
22
dist
33
src/tests/unit/coverage
4+
docs/.vuepress/.cache
5+
docs/.vuepress/.temp
6+
example/demo.js
7+
example/demo.js.map
8+
example-e2e/app.js
9+
example-e2e/app.js.map

.eslintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"plugin:vue/vue3-recommended",
1111
"prettier"
1212
],
13+
"ignorePatterns": ["!.vuepress"],
1314
"plugins": ["import", "html", "vue", "vitest"],
1415
"settings": {
1516
"import/resolver": {
@@ -21,6 +22,7 @@
2122
"rules": {
2223
"vue/max-attributes-per-line": "off",
2324
"vue/html-self-closing": "off",
25+
"vue/singleline-html-element-content-newline": "off",
2426
"import/prefer-default-export": "off",
2527
"import/extensions": [
2628
"error",
@@ -92,7 +94,7 @@
9294
},
9395
"overrides": [
9496
{
95-
"files": ["*.spec.js", "*.config.js"],
97+
"files": ["*.spec.js", "test/e2e/specs/*/index.js", "*.config.js"],
9698
"rules": {
9799
"max-lines-per-function": "off",
98100
"max-statements": "off",

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"quoteProps": "consistent",
44
"trailingComma": "all",
55
"singleQuote": true,
6+
"singleAttributePerLine": true,
67
"htmlWhitespaceSensitivity": "ignore",
78
"htmlSingleAttributePerLine": true
89
}

docs/.vuepress/client.js

Lines changed: 50 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
// import { getDirname, path } from '@vuepress/utils'
22
// import { searchPlugin } from '@vuepress/plugin-search'
3-
import VeeValidate from 'vee-validate'
3+
// import VeeValidate from 'vee-validate'
44
import Cleave from 'cleave.js'
5-
import * as lang from '../../dist/locale/index.mjs'
6-
import Datepicker from '../../dist/vue-datepicker.mjs'
7-
import AppendToBody from './components/Datepicker/AppendToBody.vue'
8-
import OpenDate from './components/Datepicker/OpenDate.vue'
9-
import Rtl from './components/Datepicker/Rtl.vue'
10-
import UseUtc from './components/Datepicker/UseUtc.vue'
11-
import VModel from './components/Datepicker/VModel.vue'
12-
import YearPickerRange from './components/Datepicker/YearPickerRange.vue'
13-
import Disabled from './components/Disabled.vue'
14-
import Highlighted from './components/Highlighted.vue'
15-
import Formatting from './components/Formatting.vue'
16-
import Language from './components/Language.vue'
17-
import Typeable from './components/Typeable.vue'
185
import { defineClientConfig } from '@vuepress/client'
6+
import * as lang from '../../dist/locale/index.mjs'
7+
import DatePicker from '../../dist/vue-datepicker.mjs'
8+
import AppendToBody from './components/DatePicker/AppendToBody.vue'
9+
import OpenDate from './components/DatePicker/OpenDate.vue'
10+
import RtlLanguage from './components/DatePicker/RtlLanguage.vue'
11+
import UseUtc from './components/DatePicker/UseUtc.vue'
12+
import VModel from './components/DatePicker/VModel.vue'
13+
import YearPickerRange from './components/DatePicker/YearPickerRange.vue'
14+
import DateDisabled from './components/DateDisabled.vue'
15+
import DateHighlighted from './components/DateHighlighted.vue'
16+
import DateFormatting from './components/DateFormatting.vue'
17+
import DateLanguage from './components/DateLanguage.vue'
18+
import DateTypeable from './components/DateTypeable.vue'
1919
// import { registerComponentsPlugin } from '@vuepress/plugin-register-components'
2020

2121
// export default ({ Vue }) => {
@@ -37,8 +37,8 @@ import { defineClientConfig } from '@vuepress/client'
3737
// }
3838
//
3939
// Vue.use(VeeValidate, config)
40-
// Vue.component('Datepicker', Datepicker)
41-
// Vue.prototype.$datepickerLocals = lang
40+
// Vue.component('DatePicker', DatePicker)
41+
// Vue.prototype.$datepickerLocales = lang
4242
//
4343
// Vue.directive('cleave', {
4444
// inserted(el, binding) {
@@ -61,22 +61,22 @@ import { defineClientConfig } from '@vuepress/client'
6161

6262
// const __dirname = getDirname(import.meta.url)
6363

64-
const config = {
65-
aria: true,
66-
classNames: {},
67-
classes: true,
68-
delay: 0,
69-
dictionary: null,
70-
errorBagName: 'errors', // change if property conflicts
71-
events: 'input|blur',
72-
fieldsBagName: 'fields',
73-
i18n: null, // the vue-i18n plugin instance
74-
i18nRootKey: 'validations', // the key under which nested validation messages will be located
75-
inject: true,
76-
locale: 'en',
77-
validity: false,
78-
useConstraintAttrs: true,
79-
}
64+
// const config = {
65+
// aria: true,
66+
// classNames: {},
67+
// classes: true,
68+
// delay: 0,
69+
// dictionary: null,
70+
// errorBagName: 'errors', // change if property conflicts
71+
// events: 'input|blur',
72+
// fieldsBagName: 'fields',
73+
// i18n: null, // the vue-i18n plugin instance
74+
// i18nRootKey: 'validations', // the key under which nested validation messages will be located
75+
// inject: true,
76+
// locale: 'en',
77+
// validity: false,
78+
// useConstraintAttrs: true,
79+
// }
8080

8181
export default defineClientConfig({
8282
// plugins: [
@@ -88,28 +88,31 @@ export default defineClientConfig({
8888

8989
// enhance({ app, router, siteData }) {},
9090

91+
// eslint-disable-next-line max-statements, no-param-reassign
9192
enhance({ app }) {
92-
app.component('Datepicker', Datepicker)
93-
app.component('Datepicker-AppendToBody', AppendToBody)
94-
app.component('Datepicker-OpenDate', OpenDate)
95-
app.component('Datepicker-Rtl', Rtl)
96-
app.component('Datepicker-UseUtc', UseUtc)
97-
app.component('Datepicker-VModel', VModel)
98-
app.component('Datepicker-YearPickerRange', YearPickerRange)
99-
app.component('Disabled', Disabled)
100-
app.component('Highlighted', Highlighted)
101-
app.component('Formatting', Formatting)
102-
app.component('Language', Language)
103-
app.component('Typeable', Typeable)
104-
app.component('VeeValidate', VeeValidate)
93+
app.component('DatePicker', DatePicker)
94+
app.component('DatePickerAppendToBody', AppendToBody)
95+
app.component('DatePickerOpenDate', OpenDate)
96+
app.component('DatePickerRtlLanguage', RtlLanguage)
97+
app.component('DatePickerUseUtc', UseUtc)
98+
app.component('DatePickerVModel', VModel)
99+
app.component('DatePickerYearPickerRange', YearPickerRange)
100+
app.component('DateDisabled', DateDisabled)
101+
app.component('DateHighlighted', DateHighlighted)
102+
app.component('DateFormatting', DateFormatting)
103+
app.component('DateLanguage', DateLanguage)
104+
app.component('DateTypeable', DateTypeable)
105+
// app.component('DateVeeValidate', DateVeeValidate)
105106

106107
// app.use(VeeValidate, config)
107-
app.config.globalProperties.$datepickerLocals = lang
108+
// eslint-disable-next-line no-param-reassign
109+
app.config.globalProperties.$datepickerLocales = lang
108110
app.directive('cleave', {
109111
inserted(el, binding) {
110112
// If the bound element is not an input field, search for one.
111113
// This is for cases where the input is inside a wrapper
112114
if (el.tagName !== 'INPUT') {
115+
// eslint-disable-next-line no-param-reassign
113116
el = el.querySelector('input')
114117
}
115118
// Only apply Cleave if it is an input field and the options are set
@@ -118,6 +121,7 @@ export default defineClientConfig({
118121
Object.keys(binding.value).length !== 0 &&
119122
binding.value.constructor === Object
120123
) {
124+
// eslint-disable-next-line no-new
121125
new Cleave(el, binding.value)
122126
}
123127
},

docs/.vuepress/components/Cleave.vue renamed to docs/.vuepress/components/DateCleave.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="example">
3-
<Datepicker
3+
<DatePicker
44
v-model="model"
55
v-cleave="options"
66
:typeable="true"
@@ -13,7 +13,8 @@
1313

1414
<script>
1515
export default {
16-
name: 'Cleave',
16+
name: 'DateCleave',
17+
inject: ['$validator'],
1718
data() {
1819
return {
1920
model: '',
@@ -26,7 +27,6 @@ export default {
2627
},
2728
}
2829
},
29-
inject: ['$validator'],
3030
}
3131
</script>
3232
<style>

docs/.vuepress/components/Disabled.vue renamed to docs/.vuepress/components/DateDisabled.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
<div>
33
<div class="example">
44
<h3>With minimum and maximum date range</h3>
5-
<Datepicker :disabled-dates="disabledDates" />
5+
<DatePicker :disabled-dates="disabledDates" />
66
<code>
77
&lt;datepicker :disabled-dates="disabledDates"&gt;&lt;/datepicker&gt;
88
</code>
99
<div class="settings">
1010
<h5>Settings</h5>
1111
<div class="form-group">
1212
<label>Disabled to:</label>
13-
<Datepicker @selected="disableTo" />
13+
<DatePicker @selected="disableTo" />
1414
</div>
1515
<div class="form-group">
1616
<label>Disabled from:</label>
17-
<Datepicker @selected="disableFrom" />
17+
<DatePicker @selected="disableFrom" />
1818
</div>
1919
<div class="form-group">
2020
<label>Disabled Days of Month:</label>
@@ -31,7 +31,7 @@
3131

3232
<div class="example">
3333
<h3>Disabled dates</h3>
34-
<Datepicker :disabled-dates="disabledFn" />
34+
<DatePicker :disabled-dates="disabledFn" />
3535
<code>
3636
&lt;datepicker :disabled-dates="disabledFn"&gt;&lt;/datepicker&gt;
3737
</code>
@@ -65,7 +65,7 @@
6565

6666
<script>
6767
export default {
68-
name: 'Disabled',
68+
name: 'DateDisabled',
6969
data() {
7070
return {
7171
disabledDates: {},

docs/.vuepress/components/Formats.vue renamed to docs/.vuepress/components/DateFormats.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22
<div class="form-group">
33
<label>Format</label>
44
<select v-model="format">
5-
<option v-for="format in formats" :value="format.value">
6-
{{ format.text }}
5+
<option v-for="(fmt, key) in formats" :key="key" :value="fmt.value">
6+
{{ fmt.text }}
77
</option>
88
</select>
99
</div>
1010
</template>
1111

1212
<script>
1313
export default {
14-
name: 'Formats',
14+
name: 'DateFormats',
1515
props: {
1616
formatInit: {
1717
type: String,
1818
required: true,
1919
},
2020
},
21+
emits: ['selected'],
2122
data() {
2223
return {
2324
format: '',
@@ -53,14 +54,14 @@ export default {
5354
],
5455
}
5556
},
56-
mounted() {
57-
this.format = this.formatInit
58-
},
5957
watch: {
6058
format(newVal) {
6159
this.$emit('selected', newVal)
6260
},
6361
},
62+
mounted() {
63+
this.format = this.formatInit
64+
},
6465
}
6566
</script>
6667

docs/.vuepress/components/Formatting.vue renamed to docs/.vuepress/components/DateFormatting.vue

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,37 @@
22
<div class="example">
33
<div class="settings">
44
<h5>Settings</h5>
5-
<Format @selected="selected" :format-init="format" />
5+
<DateFormats
6+
:format-init="format"
7+
@selected="selected"
8+
/>
69
</div>
710
<h3>Default formatter</h3>
8-
<Datepicker :format="format" />
9-
<code>&lt;Datepicker :format="format"/&gt;</code>
11+
<DatePicker
12+
:format="format"
13+
placeholder="Datepicker based on settings above..."
14+
/>
15+
<code>&lt;DatePicker :format="format"/&gt;</code>
1016
<h3>Custom formatter</h3>
11-
<Datepicker
17+
<DatePicker
1218
:format="customFormatter"
1319
:parser="customParser"
1420
:typeable="true"
1521
/>
1622
<code>
17-
&lt;Datepicker :format="customFormatter" :parser="customParser"/&gt;
23+
&lt;DatePicker :format="customFormatter" :parser="customParser"/&gt;
1824
</code>
1925
</div>
2026
</template>
2127

2228
<script>
23-
import Format from '../components/Formats.vue'
2429
import { format, parse } from 'date-fns'
30+
import DateFormats from './DateFormats.vue'
2531
2632
export default {
27-
name: 'Formatting',
33+
name: 'DateFormatting',
2834
components: {
29-
Format,
35+
DateFormats,
3036
},
3137
data() {
3238
return {

docs/.vuepress/components/Highlighted.vue renamed to docs/.vuepress/components/DateHighlighted.vue

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div>
33
<div class="example">
44
<h3>Highlighting Dates</h3>
5-
<Datepicker :highlighted="highlighted" />
5+
<DatePicker :highlighted="highlighted" />
66

77
<code>
88
&lt;datepicker :highlighted="highlighted"&gt;&lt;/datepicker&gt;
@@ -11,11 +11,11 @@
1111
<h5>Settings</h5>
1212
<div class="form-group">
1313
<label>Highlight from:</label>
14-
<Datepicker @selected="highlightFrom" />
14+
<DatePicker @selected="highlightFrom" />
1515
</div>
1616
<div class="form-group">
1717
<label>Highlight to:</label>
18-
<Datepicker @selected="highlightTo" />
18+
<DatePicker @selected="highlightTo" />
1919
</div>
2020
<div class="form-group">
2121
<label>Highlight Days of Month:</label>
@@ -27,7 +27,7 @@
2727

2828
<div class="example">
2929
<h3>Highlighting Dates Matching Given Function</h3>
30-
<Datepicker :highlighted="highlightedFn" />
30+
<DatePicker :highlighted="highlightedFn" />
3131
<code>
3232
&lt;datepicker :highlighted="highlightedFn"&gt;&lt;/datepicker&gt;
3333
</code>
@@ -50,13 +50,12 @@
5050

5151
<script>
5252
export default {
53-
name: 'Highlighted',
53+
name: 'DateHighlighted',
5454
data() {
5555
return {
5656
highlightedFn: {
5757
customPredictor(date) {
58-
return date.getDate() % 4 === 0;
59-
58+
return date.getDate() % 4 === 0
6059
},
6160
},
6261
highlighted: {},
@@ -87,7 +86,9 @@ export default {
8786
if (elem.target.value === 'undefined') {
8887
return
8988
}
90-
const highlightedDays = elem.target.value.split(',').map(day => parseInt(day, 10))
89+
const highlightedDays = elem.target.value
90+
.split(',')
91+
.map((day) => parseInt(day, 10))
9192
this.highlighted = {
9293
from: this.highlighted.from,
9394
to: this.highlighted.to,

0 commit comments

Comments
 (0)