1
1
/* eslint-env node */
2
2
3
- const CODE_EXT = "js,jsx,cjs,mjs,ts,tsx,cts,mts"
4
-
5
- const MARKDOWN_EXT = "md,mdx"
3
+ const CODE_EXT = "js,jsx,cjs,mjs,ts,tsx,cts,mts" ;
4
+ const MARKDOWN_EXT = "md,mdx" ;
6
5
7
6
module . exports = {
8
7
root : true ,
8
+ plugins : [ "@graphql-eslint" , "mdx" , "@typescript-eslint" , "tailwindcss" ] ,
9
9
overrides : [
10
10
{
11
11
files : [ `**/*.{${ CODE_EXT } }` ] ,
12
- // TODO: extract graphql documents from code files
13
- // to lint graphql documents marked with /* GraphQL */ comments inside js/ts codeblocks in markdown
14
- // processor: '@graphql-eslint/graphql',
15
- // plugins: ['@graphql-eslint'],
16
12
extends : [
17
13
"eslint:recommended" ,
18
14
"plugin:@typescript-eslint/recommended" ,
@@ -34,7 +30,6 @@ module.exports = {
34
30
} ,
35
31
] ,
36
32
"prefer-const" : [ "error" , { destructuring : "all" } ] ,
37
- // TODO: fix below
38
33
"prefer-rest-params" : "off" ,
39
34
"@typescript-eslint/no-explicit-any" : "off" ,
40
35
"@typescript-eslint/no-unused-vars" : "off" ,
@@ -51,27 +46,45 @@ module.exports = {
51
46
{
52
47
files : [ `**/*.{${ MARKDOWN_EXT } }` ] ,
53
48
parser : "eslint-mdx" ,
49
+ extends : [ "plugin:mdx/recommended" ] ,
54
50
processor : "mdx/remark" ,
55
- plugins : [ "mdx" ] ,
56
51
parserOptions : {
57
52
ecmaVersion : 13 ,
58
53
sourceType : "module" ,
59
54
} ,
60
55
settings : {
61
56
"mdx/code-blocks" : true ,
57
+ "mdx/language-mapper" : {
58
+ js : "espree" ,
59
+ graphql : "@graphql-eslint/parser" ,
60
+ ts : "@typescript-eslint/parser" ,
61
+ typescript : "@typescript-eslint/parser" ,
62
+ } ,
62
63
} ,
63
64
rules : {
64
65
"mdx/remark" : "error" ,
65
66
} ,
66
67
} ,
67
68
{
68
- files : [ `**/*.{${ MARKDOWN_EXT } }/*.{${ CODE_EXT } }` ] ,
69
+ files : [ "**/*.graphql" ] ,
70
+ parser : "@graphql-eslint/parser" ,
69
71
rules : {
70
- "no-unused-labels" : "off" ,
71
- "no-undef" : "off" ,
72
- "no-redeclare" : "off" ,
73
- "no-import-assign" : "off" ,
74
- "no-prototype-builtins" : "off" ,
72
+ "@graphql-eslint/no-syntax-errors" : "error" ,
73
+ "@graphql-eslint/unique-operation-name" : "error" ,
74
+ "@graphql-eslint/unique-fragment-name" : "error" ,
75
+ "@graphql-eslint/no-anonymous-operations" : "warn" ,
76
+ "@graphql-eslint/lone-anonymous-operation" : "error" ,
77
+ "@graphql-eslint/no-duplicate-fields" : "error" ,
78
+ "@graphql-eslint/no-unused-fragments" : "warn" ,
79
+ "@graphql-eslint/no-duplicate-fragment-names" : "error" ,
80
+ "@graphql-eslint/no-undefined-variables" : "error" ,
81
+ "@graphql-eslint/unique-variable-names" : "error"
82
+ } ,
83
+ } ,
84
+ {
85
+ files : [ `**/*.{${ CODE_EXT } }` , `**/*.{${ MARKDOWN_EXT } }` ] ,
86
+ parserOptions : {
87
+ plugins : [ "graphql" ] ,
75
88
} ,
76
89
} ,
77
90
{
@@ -84,9 +97,5 @@ module.exports = {
84
97
"mdx/remark" : "off" ,
85
98
} ,
86
99
} ,
87
- {
88
- files : [ "**/*.graphql" ] ,
89
- parser : "@graphql-eslint/eslint-plugin" ,
90
- } ,
91
100
] ,
92
- }
101
+ } ;
0 commit comments