Skip to content

Commit fd766cd

Browse files
authored
ensure code blocks doesn't contains validation errrors / fix hydration errors on some of graphql-js pages (graphql#1668)
* mdx * aa * aa * more * more * more * more * more * more * more * more
1 parent 62c97a9 commit fd766cd

14 files changed

+499
-203
lines changed

.eslintrc.cjs

+28-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
/* eslint-env node */
22

3+
const CODE_EXT = "js,jsx,cjs,mjs,ts,tsx,cts,mts"
4+
5+
const MARKDOWN_EXT = "md,mdx"
6+
37
module.exports = {
48
root: true,
59
overrides: [
610
{
7-
files: ["**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts}"],
11+
files: [`**/*.{${CODE_EXT}}`],
812
extends: [
913
"eslint:recommended",
1014
"plugin:@typescript-eslint/recommended",
1115
"plugin:tailwindcss/recommended",
1216
"prettier",
1317
],
14-
parser: "@typescript-eslint/parser",
15-
parserOptions: {
16-
sourceType: "module",
17-
ecmaVersion: "latest",
18-
},
1918
rules: {
2019
"tailwindcss/classnames-order": "off",
2120
"@typescript-eslint/no-restricted-imports": [
@@ -48,5 +47,28 @@ module.exports = {
4847
},
4948
},
5049
},
50+
{
51+
files: [`**/*.{${MARKDOWN_EXT}}`],
52+
parser: "eslint-mdx",
53+
processor: "mdx/remark",
54+
plugins: ["mdx"],
55+
parserOptions: {
56+
ecmaVersion: 13,
57+
sourceType: "module",
58+
},
59+
settings: {
60+
"mdx/code-blocks": true,
61+
},
62+
},
63+
{
64+
files: [`**/*.{${MARKDOWN_EXT}}/*.{${CODE_EXT}}`],
65+
rules: {
66+
"no-unused-labels": "off",
67+
"no-undef": "off",
68+
"no-redeclare": "off",
69+
"no-import-assign": "off",
70+
"no-prototype-builtins": "off",
71+
},
72+
},
5173
],
5274
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"@typescript-eslint/parser": "7.4.0",
7070
"eslint": "8.57.0",
7171
"eslint-config-prettier": "^9.1.0",
72+
"eslint-plugin-mdx": "^3.1.5",
7273
"eslint-plugin-tailwindcss": "3.15.1",
7374
"prettier": "3.2.5",
7475
"typescript": "^5.4.3"

0 commit comments

Comments
 (0)