@graphql-eslint/eslint-plugin 3.10.6 → 4.0.0-alpha-20220821140530-e968cfc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +30 -3
- package/index.mjs +30 -3
- package/package.json +1 -1
- package/rules/match-document-filename.d.ts +1 -0
- package/testkit.d.ts +1 -0
package/index.js
CHANGED
@@ -1128,6 +1128,32 @@ const rule$3 = {
|
|
1128
1128
|
fullName
|
1129
1129
|
}
|
1130
1130
|
}
|
1131
|
+
`,
|
1132
|
+
},
|
1133
|
+
{
|
1134
|
+
title: 'Correct',
|
1135
|
+
usage: [{ fragment: { style: 'kebab-case', suffix: 'Mutation', prefix: 'mutation.' } }],
|
1136
|
+
name: 'mutation.add-alert.graphql',
|
1137
|
+
code: /* GraphQL */ `
|
1138
|
+
# mutation.add-alert.graphql
|
1139
|
+
mutation addAlert($input: AddAlertInput!) {
|
1140
|
+
addAlert(input: $input) {
|
1141
|
+
...AlertFields
|
1142
|
+
}
|
1143
|
+
}
|
1144
|
+
`,
|
1145
|
+
},
|
1146
|
+
{
|
1147
|
+
title: 'Correct',
|
1148
|
+
usage: [{ fragment: { prefix: 'query.' } }],
|
1149
|
+
name: 'query.me.graphql',
|
1150
|
+
code: /* GraphQL */ `
|
1151
|
+
# query.me.graphql
|
1152
|
+
query me {
|
1153
|
+
me {
|
1154
|
+
...UserFields
|
1155
|
+
}
|
1156
|
+
}
|
1131
1157
|
`,
|
1132
1158
|
},
|
1133
1159
|
],
|
@@ -1157,6 +1183,7 @@ const rule$3 = {
|
|
1157
1183
|
properties: {
|
1158
1184
|
style: { enum: CASE_STYLES },
|
1159
1185
|
suffix: { type: 'string' },
|
1186
|
+
prefix: { type: 'string' },
|
1160
1187
|
},
|
1161
1188
|
},
|
1162
1189
|
},
|
@@ -1222,12 +1249,12 @@ const rule$3 = {
|
|
1222
1249
|
option = { style: option };
|
1223
1250
|
}
|
1224
1251
|
const expectedExtension = options.fileExtension || fileExtension;
|
1225
|
-
let expectedFilename;
|
1252
|
+
let expectedFilename = option.prefix || '';
|
1226
1253
|
if (option.style) {
|
1227
|
-
expectedFilename
|
1254
|
+
expectedFilename += option.style === 'matchDocumentStyle' ? docName : convertCase(option.style, docName);
|
1228
1255
|
}
|
1229
1256
|
else {
|
1230
|
-
expectedFilename
|
1257
|
+
expectedFilename += filename;
|
1231
1258
|
}
|
1232
1259
|
expectedFilename += (option.suffix || '') + expectedExtension;
|
1233
1260
|
const filenameWithExtension = filename + expectedExtension;
|
package/index.mjs
CHANGED
@@ -1122,6 +1122,32 @@ const rule$3 = {
|
|
1122
1122
|
fullName
|
1123
1123
|
}
|
1124
1124
|
}
|
1125
|
+
`,
|
1126
|
+
},
|
1127
|
+
{
|
1128
|
+
title: 'Correct',
|
1129
|
+
usage: [{ fragment: { style: 'kebab-case', suffix: 'Mutation', prefix: 'mutation.' } }],
|
1130
|
+
name: 'mutation.add-alert.graphql',
|
1131
|
+
code: /* GraphQL */ `
|
1132
|
+
# mutation.add-alert.graphql
|
1133
|
+
mutation addAlert($input: AddAlertInput!) {
|
1134
|
+
addAlert(input: $input) {
|
1135
|
+
...AlertFields
|
1136
|
+
}
|
1137
|
+
}
|
1138
|
+
`,
|
1139
|
+
},
|
1140
|
+
{
|
1141
|
+
title: 'Correct',
|
1142
|
+
usage: [{ fragment: { prefix: 'query.' } }],
|
1143
|
+
name: 'query.me.graphql',
|
1144
|
+
code: /* GraphQL */ `
|
1145
|
+
# query.me.graphql
|
1146
|
+
query me {
|
1147
|
+
me {
|
1148
|
+
...UserFields
|
1149
|
+
}
|
1150
|
+
}
|
1125
1151
|
`,
|
1126
1152
|
},
|
1127
1153
|
],
|
@@ -1151,6 +1177,7 @@ const rule$3 = {
|
|
1151
1177
|
properties: {
|
1152
1178
|
style: { enum: CASE_STYLES },
|
1153
1179
|
suffix: { type: 'string' },
|
1180
|
+
prefix: { type: 'string' },
|
1154
1181
|
},
|
1155
1182
|
},
|
1156
1183
|
},
|
@@ -1216,12 +1243,12 @@ const rule$3 = {
|
|
1216
1243
|
option = { style: option };
|
1217
1244
|
}
|
1218
1245
|
const expectedExtension = options.fileExtension || fileExtension;
|
1219
|
-
let expectedFilename;
|
1246
|
+
let expectedFilename = option.prefix || '';
|
1220
1247
|
if (option.style) {
|
1221
|
-
expectedFilename
|
1248
|
+
expectedFilename += option.style === 'matchDocumentStyle' ? docName : convertCase(option.style, docName);
|
1222
1249
|
}
|
1223
1250
|
else {
|
1224
|
-
expectedFilename
|
1251
|
+
expectedFilename += filename;
|
1225
1252
|
}
|
1226
1253
|
expectedFilename += (option.suffix || '') + expectedExtension;
|
1227
1254
|
const filenameWithExtension = filename + expectedExtension;
|
package/package.json
CHANGED
package/testkit.d.ts
CHANGED
@@ -11,6 +11,7 @@ export declare type GraphQLValidTestCase<Options> = Omit<RuleTester.ValidTestCas
|
|
11
11
|
};
|
12
12
|
export declare type GraphQLInvalidTestCase<T> = GraphQLValidTestCase<T> & {
|
13
13
|
errors: number | (RuleTester.TestCaseError | string)[];
|
14
|
+
output?: string | null;
|
14
15
|
};
|
15
16
|
export declare class GraphQLRuleTester extends RuleTester {
|
16
17
|
config: {
|