@graphql-eslint/eslint-plugin 3.14.0-alpha-20221220171818-aa4bda7 → 3.14.0-alpha-20221220173226-ecd822d
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 +20 -0
- package/index.mjs +20 -0
- package/package.json +1 -1
- package/rules/alphabetize.d.ts +16 -0
- package/rules/index.d.ts +2 -0
package/index.js
CHANGED
@@ -782,6 +782,8 @@ const schema = {
|
|
782
782
|
description: 'Definitions – `type`, `interface`, `enum`, `scalar`, `input`, `union` and `directive`.',
|
783
783
|
default: false,
|
784
784
|
},
|
785
|
+
ignorePrefix: ARRAY_DEFAULT_OPTIONS,
|
786
|
+
ignoreSuffix: ARRAY_DEFAULT_OPTIONS,
|
785
787
|
},
|
786
788
|
},
|
787
789
|
};
|
@@ -947,6 +949,24 @@ const rule = {
|
|
947
949
|
const prevName = ('alias' in prevNode && ((_c = prevNode.alias) === null || _c === void 0 ? void 0 : _c.value)) ||
|
948
950
|
('name' in prevNode && ((_d = prevNode.name) === null || _d === void 0 ? void 0 : _d.value));
|
949
951
|
if (prevName) {
|
952
|
+
if ((opts.ignorePrefix || []).length > 0) {
|
953
|
+
const shouldSkipIgnorePrefix = opts.ignorePrefix.some(prefix => prefix === prevName ||
|
954
|
+
prefix === currName ||
|
955
|
+
prevName.startsWith(prefix) ||
|
956
|
+
currName.startsWith(prefix));
|
957
|
+
if (shouldSkipIgnorePrefix) {
|
958
|
+
continue;
|
959
|
+
}
|
960
|
+
}
|
961
|
+
if ((opts.ignoreSuffix || []).length > 0) {
|
962
|
+
const shouldSkipIgnoreSuffix = opts.ignoreSuffix.some(suffix => suffix === prevName ||
|
963
|
+
suffix === currName ||
|
964
|
+
prevName.endsWith(suffix) ||
|
965
|
+
currName.endsWith(suffix));
|
966
|
+
if (shouldSkipIgnoreSuffix) {
|
967
|
+
continue;
|
968
|
+
}
|
969
|
+
}
|
950
970
|
// Compare with lexicographic order
|
951
971
|
const compareResult = prevName.localeCompare(currName);
|
952
972
|
const shouldSort = compareResult === 1;
|
package/index.mjs
CHANGED
@@ -776,6 +776,8 @@ const schema = {
|
|
776
776
|
description: 'Definitions – `type`, `interface`, `enum`, `scalar`, `input`, `union` and `directive`.',
|
777
777
|
default: false,
|
778
778
|
},
|
779
|
+
ignorePrefix: ARRAY_DEFAULT_OPTIONS,
|
780
|
+
ignoreSuffix: ARRAY_DEFAULT_OPTIONS,
|
779
781
|
},
|
780
782
|
},
|
781
783
|
};
|
@@ -941,6 +943,24 @@ const rule = {
|
|
941
943
|
const prevName = ('alias' in prevNode && ((_c = prevNode.alias) === null || _c === void 0 ? void 0 : _c.value)) ||
|
942
944
|
('name' in prevNode && ((_d = prevNode.name) === null || _d === void 0 ? void 0 : _d.value));
|
943
945
|
if (prevName) {
|
946
|
+
if ((opts.ignorePrefix || []).length > 0) {
|
947
|
+
const shouldSkipIgnorePrefix = opts.ignorePrefix.some(prefix => prefix === prevName ||
|
948
|
+
prefix === currName ||
|
949
|
+
prevName.startsWith(prefix) ||
|
950
|
+
currName.startsWith(prefix));
|
951
|
+
if (shouldSkipIgnorePrefix) {
|
952
|
+
continue;
|
953
|
+
}
|
954
|
+
}
|
955
|
+
if ((opts.ignoreSuffix || []).length > 0) {
|
956
|
+
const shouldSkipIgnoreSuffix = opts.ignoreSuffix.some(suffix => suffix === prevName ||
|
957
|
+
suffix === currName ||
|
958
|
+
prevName.endsWith(suffix) ||
|
959
|
+
currName.endsWith(suffix));
|
960
|
+
if (shouldSkipIgnoreSuffix) {
|
961
|
+
continue;
|
962
|
+
}
|
963
|
+
}
|
944
964
|
// Compare with lexicographic order
|
945
965
|
const compareResult = prevName.localeCompare(currName);
|
946
966
|
const shouldSort = compareResult === 1;
|
package/package.json
CHANGED
package/rules/alphabetize.d.ts
CHANGED
@@ -59,6 +59,22 @@ declare const schema: {
|
|
59
59
|
readonly description: "Definitions – `type`, `interface`, `enum`, `scalar`, `input`, `union` and `directive`.";
|
60
60
|
readonly default: false;
|
61
61
|
};
|
62
|
+
readonly ignorePrefix: {
|
63
|
+
readonly type: "array";
|
64
|
+
readonly uniqueItems: true;
|
65
|
+
readonly minItems: 1;
|
66
|
+
readonly items: {
|
67
|
+
readonly type: "string";
|
68
|
+
};
|
69
|
+
};
|
70
|
+
readonly ignoreSuffix: {
|
71
|
+
readonly type: "array";
|
72
|
+
readonly uniqueItems: true;
|
73
|
+
readonly minItems: 1;
|
74
|
+
readonly items: {
|
75
|
+
readonly type: "string";
|
76
|
+
};
|
77
|
+
};
|
62
78
|
};
|
63
79
|
};
|
64
80
|
};
|
package/rules/index.d.ts
CHANGED
@@ -6,6 +6,8 @@ export declare const rules: {
|
|
6
6
|
values?: "EnumTypeDefinition"[];
|
7
7
|
fields?: import("json-schema-to-ts/lib/types/type-utils").Writable<"ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition">[];
|
8
8
|
variables?: "OperationDefinition"[];
|
9
|
+
ignorePrefix?: string[];
|
10
|
+
ignoreSuffix?: string[];
|
9
11
|
}[], false>;
|
10
12
|
'description-style': import("..").GraphQLESLintRule<{
|
11
13
|
style?: "block" | "inline";
|