如何在 VS Code 中支持 EsLint 和 Prettier 的“.gql”文件

How to support '.gql' files for EsLint and Prettier in VS Code

提问人:meez 提问时间:11/17/2023 更新时间:11/17/2023 访问量:13

问:

在我的项目中,我有一些文件:.gqlsrc/components/mycomponent/MyComponent.gql

import { gql } from '@apollo/client';

export default gql`
  query MyQuery {
    myQuery {
      test
    }
  }
`

在我的 VS Code 设置文件中,我添加了:

// .vscode/settings.json
{
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "astro",
    "typescript",
    "typescriptreact",
    "gql"
  ],

 // rest of the config
}

在我添加到包括:tsconfig.json"src/**/*.gql",

"include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.astro",
    "src/**/*.gql",
    "test/*.ts",
    "globals.d.ts",
    "*.cjs",
    ".*.cjs",
    "vitest.config.ts",
    "astro.config.mjs",
    "codegen.ts"
  ]

不知何故,VS Code Eslint 和 Prettier 忽略了这个文件?如何解决这个问题?

visual-studio-code graphql 更漂亮的 打字稿-eslint

评论


答: 暂无答案