{"id":10841,"library":"eslint-plugin-vue-types","title":"ESLint Plugin for Vue Types","description":"eslint-plugin-vue-types integrates `vue-types` with `eslint-plugin-vue`, specifically addressing the `vue/require-default-prop` rule. It prevents ESLint from reporting errors for props defined using `vue-types` validators (e.g., `VueTypes.string` or `string().isRequired`). The plugin's current stable version is 2.1.0. It primarily serves environments using `eslint-plugin-vue` versions older than 7.0.0. For `eslint-plugin-vue@7` and later, this plugin is generally not needed as the upstream `vue/require-default-prop` rule inherently ignores call expressions and object properties, negating the problem this plugin solves. Its release cadence is sporadic, reacting to changes in its peer dependencies, especially `eslint-plugin-vue` and `vue-types`. A key differentiator is its focused scope on a single `vue-types`-specific rule extension.","status":"maintenance","version":"2.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/dwightjack/eslint-plugin-vue-types","tags":["javascript","vue","vuejs","vue-types","eslint","eslintplugin","eslint-plugin","eslint-config"],"install":[{"cmd":"npm install eslint-plugin-vue-types","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-vue-types","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-vue-types","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for ESLint functionality","package":"eslint","optional":false},{"reason":"Peer dependency for extending Vue-specific ESLint rules","package":"eslint-plugin-vue","optional":false}],"imports":[{"note":"The plugin is typically applied via an `extends` configuration preset, not directly via the `plugins` array. Ensure it's placed AFTER `plugin:vue/*` presets.","wrong":"{ \"plugins\": [\"vue-types\"] }","symbol":"plugin configuration","correct":"{ \"extends\": [\"plugin:vue/recommended\", \"plugin:vue-types/recommended\"] }"},{"note":"Custom namespaces for `vue-types` validators are configured via the `settings` object in `.eslintrc.json`, not directly in the rule configuration.","wrong":"{ \"rules\": { \"vue-types/require-default-prop\": [\"error\", { \"namespace\": [\"AppTypes\"] }] } }","symbol":"settings.vue-types/namespace","correct":"{ \"settings\": { \"vue-types/namespace\": [\"AppTypes\"] } }"},{"note":"Custom import sources for individual `vue-types` validators are configured via the `settings` object in `.eslintrc.json`.","wrong":"{ \"rules\": { \"vue-types/require-default-prop\": [\"error\", { \"sources\": [\"~/utils/prop-types\"] }] } }","symbol":"settings.vue-types/sources","correct":"{ \"settings\": { \"vue-types/sources\": [\"~/utils/prop-types\"] } }"}],"quickstart":{"code":"{\n  \"root\": true,\n  \"env\": {\n    \"node\": true\n  },\n  \"extends\": [\n    \"plugin:vue/recommended\",\n    \"plugin:vue-types/recommended\"\n  ],\n  \"parserOptions\": {\n    \"ecmaVersion\": 2020\n  },\n  \"rules\": {\n    \"vue/require-default-prop\": \"error\" // Ensure the base rule is active\n  },\n  \"settings\": {\n    \"vue-types/namespace\": [\"AppTypes\"],\n    \"vue-types/sources\": [\"./src/prop-validators\"]\n  }\n}\n\n// src/App.vue\n<template>\n  <div>{{ msg1 }} {{ msg2 }}</div>\n</template>\n\n<script>\nimport VueTypes, { string } from 'vue-types';\nimport { customProp } from './prop-validators';\n\nconst AppTypes = {\n  theme: VueTypes.oneOf(['dark', 'light'])\n};\n\nexport default {\n  props: {\n    msg1: string().isRequired, // No error with plugin\n    msg2: VueTypes.string,     // No error with plugin\n    msg3: AppTypes.theme,      // No error with custom namespace\n    msg4: customProp().isRequired // No error with custom source\n  }\n};\n</script>\n\n// src/prop-validators.js\nimport VueTypes from 'vue-types';\nexport const customProp = () => VueTypes.bool;\n","lang":"javascript","description":"Demonstrates the `.eslintrc.json` configuration for `eslint-plugin-vue-types` and a Vue component showcasing how the plugin prevents `vue/require-default-prop` errors for `vue-types` definitions, including custom namespaces and import sources."},"warnings":[{"fix":"Upgrade Node.js to version 10 or higher, or downgrade `eslint-plugin-vue-types` to a version prior to 1.0.0.","message":"Version 1.0.0 dropped support for Node.js 4. Users on older Node.js versions must remain on `eslint-plugin-vue-types` < 1.0.0.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Consider upgrading `eslint-plugin-vue` to version 7 or later. If you do, you can likely remove `eslint-plugin-vue-types` from your project as it will no longer be necessary.","message":"This plugin is largely obsolete for users running `eslint-plugin-vue@7` or higher. The upstream `vue/require-default-prop` rule in newer `eslint-plugin-vue` versions inherently ignores prop assignments by call expressions or object properties, making this plugin's functionality redundant.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Always place `.isRequired` at the very end of your `vue-types` validator chain, e.g., `shape({}).loose.isRequired` is correct, while `shape({}).isRequired.loose` is incorrect.","message":"The `.isRequired` flag must always be the last call in the chain of `vue-types` validators for this plugin to correctly suppress `vue/require-default-prop` errors. Incorrect ordering, such as `.isRequired` followed by other modifiers (e.g., `.loose`), will result in an ESLint error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Add `\"vue-types/namespace\": [\"MyCustomNamespace\"]` to the `settings` object in your ESLint configuration.","message":"If using custom `vue-types` namespaces (e.g., `AppTypes.theme`), you must explicitly configure these namespaces in the plugin's `settings` via `vue-types/namespace` in your `.eslintrc.json` file. Without this, the plugin will not recognize them and will report `vue/require-default-prop` errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Add `\"vue-types/sources\": [\"~/utils/prop-types\"]` to the `settings` object in your ESLint configuration, pointing to your custom validator modules.","message":"When importing individual `vue-types` validators from a custom module (not `vue-types` itself), you need to specify these custom import sources in the plugin's `settings` via `vue-types/sources` in your `.eslintrc.json`. Otherwise, `vue/require-default-prop` errors will be reported.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Upgrade `eslint-plugin-vue-types` to version 1.0.1 or newer to resolve the `@typescript-eslint/parser` compatibility bug.","cause":"Early versions (prior to 1.0.1) of `eslint-plugin-vue-types` had compatibility issues when used alongside `@typescript-eslint/parser`.","error":"Error: Failed to load parser '@typescript-eslint/parser' declared in '.eslintrc.js'."},{"fix":"Ensure `plugin:vue-types/recommended` is included in your `extends` array *after* any `plugin:vue/*` presets. Verify that `eslint-plugin-vue` is at least version `^6.0.0` as required by peer dependencies. Also, check `.isRequired` placement and custom settings.","cause":"The `vue/require-default-prop` rule from `eslint-plugin-vue` is active and not correctly suppressed by `eslint-plugin-vue-types` for `vue-types` definitions, often due to incorrect configuration or a too-old `eslint-plugin-vue` version.","error":"Missing required prop: \"myProp\" vue/require-default-prop"}],"ecosystem":"npm"}