@graphql-eslint/eslint-plugin 3.11.2 → 3.12.0-alpha-20220929103858-c00a837
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +29 -2
- package/index.mjs +29 -2
- package/package.json +1 -1
- package/rules/match-document-filename.d.ts +1 -0
package/index.js
CHANGED
@@ -1212,6 +1212,32 @@ const rule$3 = {
|
|
1212
1212
|
fullName
|
1213
1213
|
}
|
1214
1214
|
}
|
1215
|
+
`,
|
1216
|
+
},
|
1217
|
+
{
|
1218
|
+
title: 'Correct',
|
1219
|
+
usage: [{ fragment: { style: 'kebab-case', suffix: 'Mutation', prefix: 'mutation.' } }],
|
1220
|
+
name: 'mutation.add-alert.graphql',
|
1221
|
+
code: /* GraphQL */ `
|
1222
|
+
# mutation.add-alert.graphql
|
1223
|
+
mutation addAlert($input: AddAlertInput!) {
|
1224
|
+
addAlert(input: $input) {
|
1225
|
+
...AlertFields
|
1226
|
+
}
|
1227
|
+
}
|
1228
|
+
`,
|
1229
|
+
},
|
1230
|
+
{
|
1231
|
+
title: 'Correct',
|
1232
|
+
usage: [{ fragment: { prefix: 'query.' } }],
|
1233
|
+
name: 'query.me.graphql',
|
1234
|
+
code: /* GraphQL */ `
|
1235
|
+
# query.me.graphql
|
1236
|
+
query me {
|
1237
|
+
me {
|
1238
|
+
...UserFields
|
1239
|
+
}
|
1240
|
+
}
|
1215
1241
|
`,
|
1216
1242
|
},
|
1217
1243
|
],
|
@@ -1241,6 +1267,7 @@ const rule$3 = {
|
|
1241
1267
|
properties: {
|
1242
1268
|
style: { enum: CASE_STYLES },
|
1243
1269
|
suffix: { type: 'string' },
|
1270
|
+
prefix: { type: 'string' },
|
1244
1271
|
},
|
1245
1272
|
},
|
1246
1273
|
},
|
@@ -1306,13 +1333,13 @@ const rule$3 = {
|
|
1306
1333
|
option = { style: option };
|
1307
1334
|
}
|
1308
1335
|
const expectedExtension = options.fileExtension || fileExtension;
|
1309
|
-
let expectedFilename;
|
1336
|
+
let expectedFilename = option.prefix || '';
|
1310
1337
|
if (option.style) {
|
1311
1338
|
expectedFilename =
|
1312
1339
|
option.style === 'matchDocumentStyle' ? docName : convertCase(option.style, docName);
|
1313
1340
|
}
|
1314
1341
|
else {
|
1315
|
-
expectedFilename
|
1342
|
+
expectedFilename += filename;
|
1316
1343
|
}
|
1317
1344
|
expectedFilename += (option.suffix || '') + expectedExtension;
|
1318
1345
|
const filenameWithExtension = filename + expectedExtension;
|
package/index.mjs
CHANGED
@@ -1206,6 +1206,32 @@ const rule$3 = {
|
|
1206
1206
|
fullName
|
1207
1207
|
}
|
1208
1208
|
}
|
1209
|
+
`,
|
1210
|
+
},
|
1211
|
+
{
|
1212
|
+
title: 'Correct',
|
1213
|
+
usage: [{ fragment: { style: 'kebab-case', suffix: 'Mutation', prefix: 'mutation.' } }],
|
1214
|
+
name: 'mutation.add-alert.graphql',
|
1215
|
+
code: /* GraphQL */ `
|
1216
|
+
# mutation.add-alert.graphql
|
1217
|
+
mutation addAlert($input: AddAlertInput!) {
|
1218
|
+
addAlert(input: $input) {
|
1219
|
+
...AlertFields
|
1220
|
+
}
|
1221
|
+
}
|
1222
|
+
`,
|
1223
|
+
},
|
1224
|
+
{
|
1225
|
+
title: 'Correct',
|
1226
|
+
usage: [{ fragment: { prefix: 'query.' } }],
|
1227
|
+
name: 'query.me.graphql',
|
1228
|
+
code: /* GraphQL */ `
|
1229
|
+
# query.me.graphql
|
1230
|
+
query me {
|
1231
|
+
me {
|
1232
|
+
...UserFields
|
1233
|
+
}
|
1234
|
+
}
|
1209
1235
|
`,
|
1210
1236
|
},
|
1211
1237
|
],
|
@@ -1235,6 +1261,7 @@ const rule$3 = {
|
|
1235
1261
|
properties: {
|
1236
1262
|
style: { enum: CASE_STYLES },
|
1237
1263
|
suffix: { type: 'string' },
|
1264
|
+
prefix: { type: 'string' },
|
1238
1265
|
},
|
1239
1266
|
},
|
1240
1267
|
},
|
@@ -1300,13 +1327,13 @@ const rule$3 = {
|
|
1300
1327
|
option = { style: option };
|
1301
1328
|
}
|
1302
1329
|
const expectedExtension = options.fileExtension || fileExtension;
|
1303
|
-
let expectedFilename;
|
1330
|
+
let expectedFilename = option.prefix || '';
|
1304
1331
|
if (option.style) {
|
1305
1332
|
expectedFilename =
|
1306
1333
|
option.style === 'matchDocumentStyle' ? docName : convertCase(option.style, docName);
|
1307
1334
|
}
|
1308
1335
|
else {
|
1309
|
-
expectedFilename
|
1336
|
+
expectedFilename += filename;
|
1310
1337
|
}
|
1311
1338
|
expectedFilename += (option.suffix || '') + expectedExtension;
|
1312
1339
|
const filenameWithExtension = filename + expectedExtension;
|
package/package.json
CHANGED