Skip to content

Commit 57ab824

Browse files
fix(vue): prop types warning at component level
1 parent 598b18e commit 57ab824

File tree

9 files changed

+131
-151
lines changed

9 files changed

+131
-151
lines changed

packages/vue/.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"es6": true,
66
"node": true
77
},
8-
"extends": ["airbnb-base", "plugin:vue/recommended", "prettier"],
8+
"extends": ["airbnb-base", "plugin:vue/vue3-recommended", "prettier"],
99
"parserOptions": {
1010
"parser": "babel-eslint",
1111
"ecmaVersion": 2017,

packages/vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"eslint": "^4.12.0",
7474
"eslint-config-airbnb-base": "^13.1.0",
7575
"eslint-config-prettier": "^3.1.0",
76-
"eslint-plugin-vue": "^7.20.0",
76+
"eslint-plugin-vue": "^4.7.1",
7777
"nps": "^5.9.3",
7878
"nps-utils": "^1.7.0",
7979
"postcss": "^8.4.31",

packages/vue/src/components/ReactiveBase/index.jsx

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ import Appbase from 'appbase-js';
66
import AppbaseAnalytics from '@appbaseio/analytics';
77
import 'url-search-params-polyfill';
88
import { createCache } from '@appbaseio/vue-emotion';
9-
import { defineComponent } from 'vue';
109
import Provider from '../Provider';
1110
import { composeThemeObject, X_SEARCH_CLIENT } from '../../utils/index';
1211
import types from '../../utils/vueTypes';
1312
import URLParamsProvider from '../URLParamsProvider.jsx';
1413
import getTheme from '../../styles/theme';
1514

1615
const { setValues } = Actions;
17-
const ReactiveBase =defineComponent( {
16+
const ReactiveBase = {
1817
name: 'ReactiveBase',
1918
data() {
2019
this.state = {
@@ -110,10 +109,10 @@ const ReactiveBase =defineComponent( {
110109
...(enableTelemetry === false && { 'X-Enable-Telemetry': false }),
111110
}),
112111
...headers,
113-
...(endpoint
114-
&& endpoint.headers && {
115-
...endpoint.headers,
116-
}),
112+
...(endpoint &&
113+
endpoint.headers && {
114+
...endpoint.headers,
115+
}),
117116
};
118117
},
119118
},
@@ -123,8 +122,8 @@ const ReactiveBase =defineComponent( {
123122
this.key = `${this.state.key}-0`;
124123
},
125124
setStore(props) {
126-
const credentials
127-
= props.url && props.url.trim() !== '' && !props.credentials
125+
const credentials =
126+
props.url && props.url.trim() !== '' && !props.credentials
128127
? null
129128
: props.credentials;
130129
let url = props.url && props.url.trim() !== '' ? props.url : '';
@@ -209,8 +208,8 @@ const ReactiveBase =defineComponent( {
209208
// When endpoint prop is used index is not defined, so we use _default
210209
index: appbaseRef.app || '_default',
211210
globalCustomEvents:
212-
this.$props.reactivesearchAPIConfig
213-
&& this.$props.reactivesearchAPIConfig.customEvents,
211+
this.$props.reactivesearchAPIConfig &&
212+
this.$props.reactivesearchAPIConfig.customEvents,
214213
};
215214

216215
try {
@@ -220,13 +219,13 @@ const ReactiveBase =defineComponent( {
220219
/\/\/(.*?)\/.*/,
221220
'//$1',
222221
);
223-
const headerCredentials
224-
= this.$props.endpoint.headers && this.$props.endpoint.headers.Authorization;
225-
analyticsInitConfig.credentials
226-
= headerCredentials && headerCredentials.replace('Basic ', '');
222+
const headerCredentials =
223+
this.$props.endpoint.headers && this.$props.endpoint.headers.Authorization;
224+
analyticsInitConfig.credentials =
225+
headerCredentials && headerCredentials.replace('Basic ', '');
227226
// Decode the credentials
228-
analyticsInitConfig.credentials
229-
= analyticsInitConfig.credentials && atob(analyticsInitConfig.credentials);
227+
analyticsInitConfig.credentials =
228+
analyticsInitConfig.credentials && atob(analyticsInitConfig.credentials);
230229
}
231230
} catch (e) {
232231
console.error('Endpoint not set correctly for analytics');
@@ -288,7 +287,7 @@ const ReactiveBase =defineComponent( {
288287
</Provider>
289288
);
290289
},
291-
});
290+
};
292291
ReactiveBase.install = function (Vue) {
293292
Vue.component(ReactiveBase.name, ReactiveBase);
294293
};

packages/vue/src/components/maps/GoogleMapMarkers.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ const GoogleMapMarkers = {
5353
const { openMarkers } = this;
5454
const markerProps = {
5555
openMarkers,
56-
setMarkerOnTop: this.setMarkerOnTop,
5756
setOpenMarkers: this.setOpenMarkers,
5857
getPosition: this.getPosition,
5958
renderItem: this.renderItem,

packages/vue/src/components/maps/ReactiveMap.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ const ReactiveMap = {
146146
currentPageState,
147147
mapBoxBounds: null,
148148
markersData: null,
149+
filteredResults: null
149150
};
150151
return this.__state;
151152
},

packages/vue/src/components/range/RangeSlider.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import VueTypes from 'vue-types';
22
import { Actions, helper } from '@appbaseio/reactivecore';
33
import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
44
// eslint-disable-next-line import/extensions
5-
import VueSlider from 'vue-slider-component/dist-css/vue-slider-component.umd.min.js'
6-
import 'vue-slider-component/dist-css/vue-slider-component.css'
7-
import 'vue-slider-component/theme/default.css'
5+
import VueSlider from 'vue-slider-component/dist-css/vue-slider-component.umd.min.js';
6+
import 'vue-slider-component/dist-css/vue-slider-component.css';
7+
import 'vue-slider-component/theme/default.css';
88
import Container from '../../styles/Container';
99
import { connect, updateCustomQuery, isQueryIdentical } from '../../utils/index';
1010
import ComponentWrapper from '../basic/ComponentWrapper.jsx';

packages/vue/src/components/search/AIAnswer.jsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,36 +118,24 @@ const AIAnswer = defineComponent({
118118
enableAI: VueTypes.bool.def(true),
119119
AIConfig: types.AIConfig,
120120
iconPosition: types.iconPosition.def('left'),
121-
themePreset: types.themePreset,
122-
theme: types.style,
123121
icon: types.children,
124122
iconURL: VueTypes.string.def(''),
125123
renderMic: types.func,
126124
getMicInstance: types.func,
127125
innerClass: types.style,
128126
placeholder: VueTypes.string.def('Ask a question'),
129127
title: types.title,
130-
AIResponse: types.componentObject,
131-
isAIResponseLoading: VueTypes.bool.def(false),
132-
AIResponseError: types.componentObject,
133-
getAIResponse: types.func.isRequired,
134128
enterButton: types.bool,
135129
renderEnterButton: types.title,
136130
showInput: VueTypes.bool.def(true),
137131
clearSessionOnDestroy: VueTypes.bool.def(true),
138-
rawData: types.rawData,
139132
render: types.func,
140133
onError: types.func,
141134
renderError: types.title,
142-
isLoading: types.boolRequired,
143-
sessionIdFromStore: VueTypes.string,
144-
showComponent: types.boolRequired,
145-
componentError: types.componentObject,
146135
style: types.style,
147136
showSourceDocuments: VueTypes.bool.def(false),
148137
renderSourceDocument: types.func,
149138
onSourceClick: types.func,
150-
isAITyping: types.boolRequired,
151139
triggerOn: VueTypes.string.def(AI_TRIGGER_MODES.ALWAYS),
152140
renderTriggerMessage: types.func,
153141
},
@@ -216,7 +204,7 @@ const AIAnswer = defineComponent({
216204
this.$emit('on-data', {
217205
data: this.messages,
218206
rawData: newVal,
219-
loading: this.$props.isAIResponseLoading || this.$props.isLoading,
207+
loading: this.isAIResponseLoading || this.$props.isLoading,
220208
error: this.$props.AIResponseError,
221209
});
222210

packages/vue/src/utils/vueTypes.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ function validateLocation(value) {
3939
const types = {
4040
any: VueTypes.any,
4141
bool: VueTypes.bool,
42-
boolRequired: VueTypes.bool.isRequired,
42+
boolRequired: {
43+
type: Boolean,
44+
required: true
45+
},
4346
components: VueTypes.arrayOf(VueTypes.string),
4447
compoundClause: VueTypes.oneOf(['filter', 'must']),
4548
children: VueTypes.any,
@@ -114,7 +117,10 @@ const types = {
114117
type: String,
115118
required: false
116119
},
117-
stringArray: VueTypes.arrayOf(VueTypes.string),
120+
stringArray: {
121+
type: [String],
122+
required: false
123+
},
118124
stringOrArray: VueTypes.oneOfType([VueTypes.string, VueTypes.arrayOf(VueTypes.string)]),
119125
stringRequired: VueTypes.string.isRequired,
120126
style: VueTypes.object,

0 commit comments

Comments
 (0)