dwightjack / eslint-plugin-vue-types Goto Github PK
View Code? Open in Web Editor NEWESLint plugin for vue-types and eslint-plugin-vue
License: MIT License
ESLint plugin for vue-types and eslint-plugin-vue
License: MIT License
require-default-prop
warns when using shape()
, string()
, etc. rather than VueTypes.shape
, VueTypes.string
, etc.
import VueTypes, { shape } from 'vue-types';
const MyComponent = Vue.extend({
props: {
data: shape({}).isRequired, // ESLint: Prop 'data' requires default value to be set.(vue-types/require-default-prop)
data2: VueTypes.shape({}).isRequired, // this is fine
},
});
First of all: Thanks for the great vue-types
plugin!
Using @vue/cli-plugin-eslint 3.0.0-beta.15
, I have installed eslint-plugin-vue-types
alongside with vue-types
and have configured Eslint like this:
extends: [
'plugin:vue/essential',
'@vue/prettier',
'@vue/typescript',
'plugin:vue-types/strongly-recommended'
],
I get this error:
error: Prop 'href' requires default value to be set (vue-types/require-default-prop) at src/components/_BaseLink.vue:21:5:
19 | export default Vue.extend({
20 | props: {
> 21 | href: VueTypes.string.def('test')
| ^
22 | }
23 | })
24 | </script>
Once I removed '@vue/typescript'
everything is working fine.
So it seems there is a conflict between the two plugins?
Hi Marco, thanks for the plugin again.
I am implementing a more "strong" linter and i am finding issues with the vue-types plugin.
I have a folder where i store common types and re-use them across the application: now it's kind of an issue with the linter because the linter think i'm missing the prop definition.
the only whitelisting feature doesn't really scale tbh. is there another way to do this without whitelisting all the files I am using?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.