You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What actually happened? Please include the actual, raw output from ESLint.
Looks like the check here is a little too trusting.
I can open a fix, but I'm also not sure what the recommended behavior is. What I was trying to do (spread inside the prop) was a little wacky and I changed it, but eslint probably shouldn't just crash.
austin@oswald:~/projects/eslint-vue-spread-breaks$ ./node_modules/.bin/eslint test.jsx
Cannot read property 'name' of undefined
TypeError: Cannot read property 'name' of undefined
at prop.value.properties.find.p (/home/austin/projects/eslint-vue-spread-breaks/node_modules/eslint-plugin-vue/lib/rules/require-default-prop.js:52:25)
at Array.find (native)
at propHasDefault (/home/austin/projects/eslint-vue-spread-breaks/node_modules/eslint-plugin-vue/lib/rules/require-default-prop.js:52:10)
at propsNode.value.properties.filter.filter.prop (/home/austin/projects/eslint-vue-spread-breaks/node_modules/eslint-plugin-vue/lib/rules/require-default-prop.js:70:44)
at Array.filter (<anonymous>)
at findPropsWithoutDefaultValue (/home/austin/projects/eslint-vue-spread-breaks/node_modules/eslint-plugin-vue/lib/rules/require-default-prop.js:65:10)
at utils.executeOnVue (/home/austin/projects/eslint-vue-spread-breaks/node_modules/eslint-plugin-vue/lib/rules/require-default-prop.js:89:35)
at ExportDefaultDeclaration:exit (/home/austin/projects/eslint-vue-spread-breaks/node_modules/eslint-plugin-vue/lib/utils/index.js:467:9)
at listeners.(anonymous function).forEach.listener (/home/austin/projects/eslint-vue-spread-breaks/node_modules/eslint/lib/util/safe-emitter.js:47:58)
at Array.forEach (<anonymous>)
The text was updated successfully, but these errors were encountered:
Hey @austindebruyn , thanks for posting this issue. Eslint shouldn't crash - it's true. We didn't handle this case before, as it's a little bit abstract and as you already said wacky, props definitions should be simple. If you have time we would appreciate a fix though :) Feel free to open a PR.
Tell us about your environment
Please show your full configuration:
Here's a minimal repro: https://github.com/austindebruyn/eslintvuespread-repro
What did you do? Please include the actual source code causing the issue.
Including a spread operator inside your prop delcaration makes the
require-default-prop
rule crash.What did you expect to happen?
Not crash
What actually happened? Please include the actual, raw output from ESLint.
Looks like the check here is a little too trusting.
I can open a fix, but I'm also not sure what the recommended behavior is. What I was trying to do (spread inside the prop) was a little wacky and I changed it, but eslint probably shouldn't just crash.
The text was updated successfully, but these errors were encountered: