Skip to content

Commit 0bd1e54

Browse files
committed
aa
1 parent af5784d commit 0bd1e54

File tree

7 files changed

+41
-21
lines changed

7 files changed

+41
-21
lines changed

examples/custom-rules/eslint.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import graphqlPlugin from '@graphql-eslint/eslint-plugin';
2-
import { rule } from './my-rule.js'
2+
import { rule } from './my-rule.js';
33

44
export default [
55
{
@@ -10,8 +10,8 @@ export default [
1010
plugins: {
1111
'@internal': {
1212
rules: {
13-
'my-rule': rule
14-
}
13+
'my-rule': rule,
14+
},
1515
},
1616
},
1717
rules: {

examples/custom-rules/my-rule.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ export const rule = {
55
if (!node.name?.value) {
66
context.report({
77
node,
8-
message: 'Oops, name is required!'
9-
})
8+
message: 'Oops, name is required!',
9+
});
1010
}
11-
}
12-
}
13-
}
14-
}
11+
},
12+
};
13+
},
14+
};

examples/custom-rules/test.graphql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
query { foo }
1+
query {
2+
foo
3+
}

packages/plugin/__tests__/examples.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ describe('Examples', () => {
127127
const flatResults = getFlatESLintOutput(cwd);
128128
expect(normalizeResults(flatResults)).toMatchSnapshot();
129129
expect(countErrors(flatResults)).toBe(1);
130-
})
130+
});
131131
});
132132

133133
function testESLintOutput(cwd: string, errorCount: number): void {

website/content/docs/usage/graphql.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ icon: GraphQLIcon
55

66
# Usage with `.graphql` files
77

8-
<ESLintConfigs gitFolder="graphql-config" additionalFiles={{ 'GraphQL Config': 'graphql.config.js' }} />
8+
<ESLintConfigs
9+
gitFolder="graphql-config"
10+
additionalFiles={{ 'GraphQL Config': 'graphql.config.js' }}
11+
/>

website/content/docs/usage/multiple-projects.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ icon: StackIcon
55

66
# Usage to lint different schemas
77

8-
<ESLintConfigs gitFolder="multiple-projects-graphql-config" additionalFiles={{ 'GraphQL Config': 'graphql.config.ts' }} />
8+
<ESLintConfigs
9+
gitFolder="multiple-projects-graphql-config"
10+
additionalFiles={{ 'GraphQL Config': 'graphql.config.ts' }}
11+
/>

website/mdx-components.tsx

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

1010
const docsComponents = getDocsMDXComponents({
11-
async ESLintConfigs({ gitFolder, additionalFiles }: { gitFolder: string, additionalFiles: Record<string, string> }) {
11+
async ESLintConfigs({
12+
gitFolder,
13+
additionalFiles,
14+
}: {
15+
gitFolder: string;
16+
additionalFiles: Record<string, string>;
17+
}) {
1218
const user = 'dimaMachina';
1319
const repo = 'graphql-eslint';
1420
const branch = 'master';
1521
const docsPath = path.join(process.cwd(), '..', 'examples', gitFolder);
1622

1723
const promises = Object.entries({
1824
...additionalFiles,
19-
'ESLint Flat Config': 'eslint.config.js'
25+
'ESLint Flat Config': 'eslint.config.js',
2026
}).map(async ([heading, filePath]) => {
2127
const { ext } = path.parse(filePath);
2228
return `## ${heading}
2329
2430
\`\`\`${ext.slice(1)} filename="${filePath}"
2531
${(await fs.readFile(`${docsPath}/${filePath}`, 'utf8')).trim()}
26-
\`\`\``
27-
})
28-
const files = await Promise.all(promises)
32+
\`\`\``;
33+
});
34+
const files = await Promise.all(promises);
2935

30-
const hasLegacyConfig = await fs.access(`${docsPath}/.eslintrc.cjs`).then(() => true).catch(() => '')
36+
const hasLegacyConfig = await fs
37+
.access(`${docsPath}/.eslintrc.cjs`)
38+
.then(() => true)
39+
.catch(() => '');
3140

3241
return (
3342
<MDXRemote
@@ -42,7 +51,9 @@ ${hasLegacyConfig ? `> or [ESLint Legacy Config](https://github.com/${user}/${re
4251
4352
${files.join('\n')}
4453
45-
${hasLegacyConfig && `
54+
${
55+
hasLegacyConfig &&
56+
`
4657
## ESLint Legacy Config
4758
4859
> [!WARNING]
@@ -51,7 +62,8 @@ ${hasLegacyConfig && `
5162
5263
\`\`\`js filename=".eslintrc.cjs"
5364
${(await fs.readFile(`${docsPath}/.eslintrc.cjs`, 'utf8')).trim()}
54-
\`\`\``}
65+
\`\`\``
66+
}
5567
`)}
5668
/>
5769
);

0 commit comments

Comments
 (0)