Skip to content

Commit 8e8d7cf

Browse files
authored
[website] rename schema and documents to schema and operations (#2784)
1 parent 045121f commit 8e8d7cf

File tree

4 files changed

+17
-98
lines changed

4 files changed

+17
-98
lines changed

website/app/_meta.global.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default {
3838
},
3939
graphql: '',
4040
js: '',
41-
'schema-and-documents': '',
41+
'schema-and-operations': '',
4242
'multiple-projects': '',
4343
programmatic: '',
4444
_2: {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
sidebarTitle: Schema and Documents
2+
sidebarTitle: Schema and Operations
33
icon: HalfIcon
44
---
55

6-
# Usage to lint both schema/documents
6+
# Usage to lint both schema/operations
77

88
<ESLintConfigs gitFolder="monorepo" graphqlConfigFile="graphql.config.js" />

website/content/docs/usage/vue.mdx

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -5,72 +5,4 @@ icon: VueIcon
55

66
# Usage with `.vue` files
77

8-
<OfficialExampleCallout gitFolder="vue-code-file" />
9-
10-
`graphql-eslint` can lint GraphQL documents inside Vue Single-File Components (`.vue` files). It
11-
does this in two steps: (1) extract the GraphQL documents from the Vue (or `.js`/`.ts`) file, and
12-
(2) lint the extracted GraphQL documents.
13-
14-
If you don't embed GraphQL documents in your Vue files, you can skip this page.
15-
16-
> [!WARNING]
17-
>
18-
> Due to
19-
> [a limitation in `graphql-tag-pluck`](https://github.com/dimaMachina/graphql-eslint/issues/2103),
20-
> lint violations will show up at the top of the Vue document, on the first character, not inline.
21-
22-
## Configuration
23-
24-
Add the following configuration to your `eslint.config.js` file to setup `@graphql-eslint` plugin.
25-
The intermediate graphql files always have the `.graphql` extension. Make sure the second block
26-
matches those files, even if you use another extension for your project's GraphQL (e.g. `.gql`).
27-
28-
> [!WARNING]
29-
>
30-
> Make sure the first section, which extracts GraphQL from Vue files, comes **before** any other Vue
31-
> rules. Otherwise, eslint may incorrectly rewrite all error messages to say only "clear".
32-
33-
```js filename="eslint.config.js"
34-
import graphqlPlugin from '@graphql-eslint/eslint-plugin'
35-
36-
export default [
37-
{
38-
// NOTE: Order matters! This has to happen FIRST, before any block that
39-
// includes the Vue parser (including e.g. recommended Vue ESLint rules).
40-
// It also has to be before the .graphql block, below
41-
//
42-
// Extract GraphQL from files for linting -- this creates .graphql files
43-
// that are then linted below
44-
//
45-
// graphql-eslint scans all files (using the processor listed) and outputs
46-
// an intermediate file with the extracted GraphQL. That intermediate file
47-
// is then linted, generating the errors we see. The intermediate file has
48-
// a fixed .graphql extension, so you need to include that extension below
49-
// or these files won't be linted.
50-
files: ['**/*.js', '**/*.ts', '**/*.vue'],
51-
processor: graphqlPlugin.processor
52-
// NOTE: While you CAN put rules here to affect JS/TS/Vue files, those
53-
// rules won't affect GraphQL. To modify rules that effect GraphQL inside
54-
// these files, add those to the block for .graphql files, below.
55-
},
56-
// ...other config
57-
{
58-
// Lint all GraphQL files, including the intermediate ones above. If you
59-
// want to tune the rules that appear in your files, even Vue/JS/TS files,
60-
// put those rule changes HERE
61-
files: ['**/*.graphql'], // Add .gql extension if you use that
62-
languageOptions: {
63-
parser: graphqlPlugin.parser
64-
},
65-
66-
// Any rule overrides for GraphQL go HERE. For example, to enable
67-
// recommended operations rules
68-
plugins: { '@graphql-eslint': graphqlPlugin },
69-
rules: {
70-
...graphqlESLint.configs['flat/operations-recommended'].rules
71-
// Can also override the recommended rules here, e.g.:
72-
// "@graphql-eslint/naming-convention": ["off"],
73-
}
74-
}
75-
]
76-
```
8+
<ESLintConfigs gitFolder="vue-code-file" />

website/mdx-components.tsx

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,13 @@ import {
88
} from '@theguild/components/server';
99

1010
const docsComponents = getDocsMDXComponents({
11-
async OfficialExampleCallout({ gitFolder }) {
11+
async ESLintConfigs({ gitFolder, graphqlConfigFile = '' }) {
1212
const user = 'dimaMachina';
1313
const repo = 'graphql-eslint';
1414
const branch = 'master';
15-
const docsPath = `examples/${gitFolder}/`;
16-
return (
17-
<MDXRemote
18-
compiledSource={await compileMdx(`
19-
> [!NOTE]
20-
>
21-
> Check out
22-
> [the official examples](https://github.com/${user}/${repo}/tree/${branch}/${docsPath})
23-
> for
24-
> [ESLint Flat Config](https://github.com/${user}/${repo}/blob/${branch}/${docsPath}eslint.config.js)
25-
> or
26-
> [ESLint Legacy Config](https://github.com/${user}/${repo}/blob/${branch}/${docsPath}/.eslintrc.cjs)
27-
> .`)}
28-
/>
29-
);
30-
},
31-
// WIP() {
32-
// return (
33-
// <Callout type="warning" emoji="🚧">
34-
// This page is under construction. Help us improve the content by submitting a PR.
35-
// </Callout>
36-
// );
37-
// },
38-
async ESLintConfigs({ gitFolder, graphqlConfigFile = '' }) {
3915
const docsPath = path.join(process.cwd(), '..', 'examples', gitFolder);
4016
const { ext } = path.parse(graphqlConfigFile);
17+
4118
const graphqlConfig =
4219
graphqlConfigFile &&
4320
`
@@ -47,10 +24,20 @@ const docsComponents = getDocsMDXComponents({
4724
${(await fs.readFile(`${docsPath}/${graphqlConfigFile}`, 'utf8')).trim()}
4825
\`\`\`
4926
`;
27+
5028
return (
5129
<MDXRemote
5230
compiledSource={await compileMdx(`
53-
<OfficialExampleCallout gitFolder="${gitFolder}" />
31+
> [!NOTE]
32+
>
33+
> Check out
34+
> [the official examples](https://github.com/${user}/${repo}/tree/${branch}/examples/${gitFolder})
35+
> for
36+
> [ESLint Flat Config](https://github.com/${user}/${repo}/blob/${branch}/examples/${gitFolder}/eslint.config.js)
37+
> or
38+
> [ESLint Legacy Config](https://github.com/${user}/${repo}/blob/${branch}/examples/${gitFolder}/.eslintrc.cjs)
39+
> .
40+
5441
${graphqlConfig}
5542
## ESLint Flat Config
5643
\`\`\`js filename="eslint.config.js"

0 commit comments

Comments
 (0)