Support extracting GraphQL documents from `vue`/`svelte` files
See original GitHub issueDescribe the bug Linting vue files with the graphql plugin enabled leads to the following error:
[graphql-eslint/processor]: Unable to process file "D:\Programming\JabRefOnline\pages\user\register.vue": SyntaxError: Unexpected token, expected "</>/<=/>=" (3:12)
at Object._raise (D:\Programming\JabRefOnline\node_modules\@graphql-tools\graphql-tag-pluck\node_modules\@babel\parser\lib\index.js:776:17)
at Object.raiseWithData (D:\Programming\JabRefOnline\node_modules\@graphql-tools\graphql-tag-pluck\node_modules\@babel\parser\lib\index.js:769:17)
at Object.raise (D:\Programming\JabRefOnline\node_modules\@graphql-tools\graphql-tag-pluck\node_modules\@babel\parser\lib\index.js:737:17)
at Object.unexpected (D:\Programming\JabRefOnline\node_modules\@graphql-tools\graphql-tag-pluck\node_modules\@babel\parser\lib\index.js:9253:16)
at Object.expectRelational (D:\Programming\JabRefOnline\node_modules\@graphql-tools\graphql-tag-pluck\node_modules\@babel\parser\lib\index.js:9191:12)
at Object.tsParseTypeAssertion (D:\Programming\JabRefOnline\node_modules\@graphql-tools\graphql-tag-pluck\node_modules\@babel\parser\lib\index.js:6182:10)
at Object.parseMaybeUnary (D:\Programming\JabRefOnline\node_modules\@graphql-tools\graphql-tag-pluck\node_modules\@babel\parser\lib\index.js:7224:19)
at Object.tsParseTypeAssertion (D:\Programming\JabRefOnline\node_modules\@graphql-tools\graphql-tag-pluck\node_modules\@babel\parser\lib\index.js:6183:28)
at Object.parseMaybeUnary (D:\Programming\JabRefOnline\node_modules\@graphql-tools\graphql-tag-pluck\node_modules\@babel\parser\lib\index.js:7224:19)
at Object.parseExprOps (D:\Programming\JabRefOnline\node_modules\@graphql-tools\graphql-tag-pluck\node_modules\@babel\parser\lib\index.js:10141:23) {
loc: Position { line: 3, column: 12 },
pos: 33
}
To Reproduce Enable linting of vue files using the plugin by specifying the following override:
{
files: ['*.tsx', '*.ts', '*.jsx', '*.js', '*.vue'],
processor: '@graphql-eslint/graphql',
},
and invoke eslint --ext .graphql,.vue
. The error appears and points to the first instance where a html tag has some attribute, e.g. the above error is created by the following register.vue file:
<template>
<div>
<Portal to="header">
....
Expected behavior No error, and linting of the vue file proceeds.
Environment:
- OS: Win 10
@graphql-eslint/...
: 1.0.1- NodeJS: 14
Additional context
According to the documentation, graphql-tag-pluck
should be able to parse vue files so hopefully this is only a config problem.
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Guide: React and Vue - GraphQL Code Generator
Docs ; Guides; React / Vue. Guide: React and Vue. GraphQL Code Generator provides an unified way to get TypeScript types from GraphQL...
Read more >dotansimha/graphql-typed-document-node - GitHub
graphql -typed-document-node is a development tool for creating fully typed DocumentNode objects. It means that just by passing the GraphQL query/mutation/ ...
Read more >Building a GraphQL Application with Vue 3 and Apollo
Store the queries and mutations within a single file. This application requires only one query and two mutations: search - A query for ......
Read more >GraphQL Queries to fetch data - Hasura
In GraphQL, you fetch data with the help of queries. A query is a GraphQL Operation that allows you to retrieve specific data...
Read more >Migrating from Vue 2 to Svelte - Escape - GraphQL Security
With Svelte, it is possible to import enums from other files and use them in the template, which is not the case for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay, here you go: https://stackblitz.com/edit/github-7j6u77?file=.eslintrc.cjs,test.vue I’ve only added the small processor config to the basic example. This is already enough to trigger the issue.
Closing due to inactivity. Please feel free to reopen if you still need help.