Skip to content

Commit 7ace091

Browse files
fix: eslint-deps leading to prop type warnings in console
1 parent 385447c commit 7ace091

File tree

5 files changed

+923
-1066
lines changed

5 files changed

+923
-1066
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/recommended", "plugin:vue-types/recommended", "prettier"],
99
"parserOptions": {
1010
"parser": "babel-eslint",
1111
"ecmaVersion": 2017,

packages/vue/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"vue-highlight-words": "^1.2.0",
5555
"vue-no-ssr": "^1.1.0",
5656
"vue-slider-component": "next",
57-
"vue-types": "^5.0.2"
57+
"vue-types": "^5.1.1"
5858
},
5959
"peerDependencies": {
6060
"vue": "^3.1.0"
@@ -73,7 +73,8 @@
7373
"eslint": "^4.12.0",
7474
"eslint-config-airbnb-base": "^13.1.0",
7575
"eslint-config-prettier": "^3.1.0",
76-
"eslint-plugin-vue": "^4.7.1",
76+
"eslint-plugin-vue": "^9.19.2",
77+
"eslint-plugin-vue-types": "^2.1.0",
7778
"nps": "^5.9.3",
7879
"nps-utils": "^1.7.0",
7980
"postcss": "^8.4.31",
@@ -89,6 +90,6 @@
8990
"rollup-plugin-terser": "^5.1.1",
9091
"rollup-plugin-vue": "^6.0.0",
9192
"typescript": "^5.0.0",
92-
"vue-eslint-parser": "^3.2.2"
93+
"vue-eslint-parser": "^9.3.2"
9394
}
9495
}

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

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ 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';
910
import Provider from '../Provider';
1011
import { composeThemeObject, X_SEARCH_CLIENT } from '../../utils/index';
1112
import types from '../../utils/vueTypes';
1213
import URLParamsProvider from '../URLParamsProvider.jsx';
1314
import getTheme from '../../styles/theme';
1415

1516
const { setValues } = Actions;
16-
const ReactiveBase = {
17+
const ReactiveBase =defineComponent( {
1718
name: 'ReactiveBase',
1819
data() {
1920
this.state = {
@@ -109,10 +110,10 @@ const ReactiveBase = {
109110
...(enableTelemetry === false && { 'X-Enable-Telemetry': false }),
110111
}),
111112
...headers,
112-
...(endpoint &&
113-
endpoint.headers && {
114-
...endpoint.headers,
115-
}),
113+
...(endpoint
114+
&& endpoint.headers && {
115+
...endpoint.headers,
116+
}),
116117
};
117118
},
118119
},
@@ -122,8 +123,8 @@ const ReactiveBase = {
122123
this.key = `${this.state.key}-0`;
123124
},
124125
setStore(props) {
125-
const credentials =
126-
props.url && props.url.trim() !== '' && !props.credentials
126+
const credentials
127+
= props.url && props.url.trim() !== '' && !props.credentials
127128
? null
128129
: props.credentials;
129130
let url = props.url && props.url.trim() !== '' ? props.url : '';
@@ -208,8 +209,8 @@ const ReactiveBase = {
208209
// When endpoint prop is used index is not defined, so we use _default
209210
index: appbaseRef.app || '_default',
210211
globalCustomEvents:
211-
this.$props.reactivesearchAPIConfig &&
212-
this.$props.reactivesearchAPIConfig.customEvents,
212+
this.$props.reactivesearchAPIConfig
213+
&& this.$props.reactivesearchAPIConfig.customEvents,
213214
};
214215

215216
try {
@@ -219,13 +220,13 @@ const ReactiveBase = {
219220
/\/\/(.*?)\/.*/,
220221
'//$1',
221222
);
222-
const headerCredentials =
223-
this.$props.endpoint.headers && this.$props.endpoint.headers.Authorization;
224-
analyticsInitConfig.credentials =
225-
headerCredentials && headerCredentials.replace('Basic ', '');
223+
const headerCredentials
224+
= this.$props.endpoint.headers && this.$props.endpoint.headers.Authorization;
225+
analyticsInitConfig.credentials
226+
= headerCredentials && headerCredentials.replace('Basic ', '');
226227
// Decode the credentials
227-
analyticsInitConfig.credentials =
228-
analyticsInitConfig.credentials && atob(analyticsInitConfig.credentials);
228+
analyticsInitConfig.credentials
229+
= analyticsInitConfig.credentials && atob(analyticsInitConfig.credentials);
229230
}
230231
} catch (e) {
231232
console.error('Endpoint not set correctly for analytics');
@@ -271,6 +272,7 @@ const ReactiveBase = {
271272
render() {
272273
const children = this.$slots.default;
273274
const { style, className } = this.$props;
275+
window.console.log('🚀 ~ file: pppppppp');
274276
return (
275277
<Provider store={this.store} analyticsRef={this.analyticsRef}>
276278
<URLParamsProvider
@@ -287,7 +289,7 @@ const ReactiveBase = {
287289
</Provider>
288290
);
289291
},
290-
};
292+
});
291293
ReactiveBase.install = function (Vue) {
292294
Vue.component(ReactiveBase.name, ReactiveBase);
293295
};

packages/vue/src/utils/vueTypes.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ const types = {
5656
excludeFields: VueTypes.arrayOf(VueTypes.string),
5757
fieldWeights: VueTypes.arrayOf(VueTypes.number),
5858
filterLabel: VueTypes.string,
59-
func: VueTypes.func,
59+
func: {
60+
type: Function,
61+
required: false
62+
},
6063
funcRequired: VueTypes.func.isRequired,
6164
fuzziness: VueTypes.oneOf([0, 1, 2, 'AUTO']),
6265
headers: VueTypes.object,
@@ -107,7 +110,10 @@ const types = {
107110
),
108111
sortByWithCount: VueTypes.oneOf(['asc', 'desc', 'count']),
109112
stats: VueTypes.arrayOf(VueTypes.object),
110-
string: VueTypes.string,
113+
string: {
114+
type: String,
115+
required: false
116+
},
111117
stringArray: VueTypes.arrayOf(VueTypes.string),
112118
stringOrArray: VueTypes.oneOfType([VueTypes.string, VueTypes.arrayOf(VueTypes.string)]),
113119
stringRequired: VueTypes.string.isRequired,

0 commit comments

Comments
 (0)