@graphql-eslint/eslint-plugin 3.10.8-alpha-20220804122234-d96a19a → 4.0.0-alpha-20220821140530-e968cfc

Sign up to get free protection for your applications and to get access to all the features.
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 = option.style === 'matchDocumentStyle' ? docName : convertCase(option.style, docName);
1254
+ expectedFilename += option.style === 'matchDocumentStyle' ? docName : convertCase(option.style, docName);
1228
1255
  }
1229
1256
  else {
1230
- expectedFilename = filename;
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 = option.style === 'matchDocumentStyle' ? docName : convertCase(option.style, docName);
1248
+ expectedFilename += option.style === 'matchDocumentStyle' ? docName : convertCase(option.style, docName);
1222
1249
  }
1223
1250
  else {
1224
- expectedFilename = filename;
1251
+ expectedFilename += filename;
1225
1252
  }
1226
1253
  expectedFilename += (option.suffix || '') + expectedExtension;
1227
1254
  const filenameWithExtension = filename + expectedExtension;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "3.10.8-alpha-20220804122234-d96a19a",
3
+ "version": "4.0.0-alpha-20220821140530-e968cfc",
4
4
  "description": "GraphQL plugin for ESLint",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -12,7 +12,7 @@
12
12
  "@graphql-tools/graphql-tag-pluck": "^7.2.6",
13
13
  "@graphql-tools/utils": "^8.6.9",
14
14
  "chalk": "^4.1.2",
15
- "debug": "^4",
15
+ "debug": "^4.3.4",
16
16
  "fast-glob": "^3.2.11",
17
17
  "graphql-config": "^4.3.0",
18
18
  "graphql-depth-limit": "^1.1.0",
@@ -5,6 +5,7 @@ declare const ACCEPTED_EXTENSIONS: ['.gql', '.graphql'];
5
5
  declare type PropertySchema = {
6
6
  style?: CaseStyle;
7
7
  suffix?: string;
8
+ prefix?: string;
8
9
  };
9
10
  export declare type MatchDocumentFilenameRuleConfig = {
10
11
  fileExtension?: typeof ACCEPTED_EXTENSIONS[number];