@graphql-eslint/eslint-plugin 3.10.8-alpha-20220804122234-d96a19a → 3.11.0-alpha-20220828112016-ee5ae70
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +26 -0
- package/index.mjs +26 -0
- package/package.json +2 -2
- package/rules/alphabetize.d.ts +2 -0
package/index.js
CHANGED
@@ -705,6 +705,14 @@ const rule = {
|
|
705
705
|
description: 'Definitions – `type`, `interface`, `enum`, `scalar`, `input`, `union` and `directive`.',
|
706
706
|
default: false,
|
707
707
|
},
|
708
|
+
ignorePrefix: {
|
709
|
+
type: 'array',
|
710
|
+
default: [],
|
711
|
+
},
|
712
|
+
ignoreSuffix: {
|
713
|
+
type: 'array',
|
714
|
+
default: [],
|
715
|
+
},
|
708
716
|
},
|
709
717
|
},
|
710
718
|
},
|
@@ -759,6 +767,24 @@ const rule = {
|
|
759
767
|
const prevNode = nodes[i - 1];
|
760
768
|
const prevName = ('alias' in prevNode && ((_c = prevNode.alias) === null || _c === void 0 ? void 0 : _c.value)) || ('name' in prevNode && ((_d = prevNode.name) === null || _d === void 0 ? void 0 : _d.value));
|
761
769
|
if (prevName) {
|
770
|
+
if (opts.ignorePrefix.length > 0) {
|
771
|
+
const shouldSkipIgnorePrefix = opts.ignorePrefix.some(prefix => prefix === prevName || prefix === currName || prevName.startsWith(prefix) || currName.startsWith(prefix));
|
772
|
+
if (shouldSkipIgnorePrefix) {
|
773
|
+
continue;
|
774
|
+
}
|
775
|
+
if (!shouldSkipIgnorePrefix) {
|
776
|
+
console.error(`${opts.ignorePrefix} is not match to "${prevName}" or "${currName}"`);
|
777
|
+
}
|
778
|
+
}
|
779
|
+
if (opts.ignoreSuffix.length > 0) {
|
780
|
+
const shouldSkipIgnoreSuffix = opts.ignoreSuffix.some(suffix => suffix === prevName || suffix === currName || prevName.endsWith(suffix) || currName.endsWith(suffix));
|
781
|
+
if (shouldSkipIgnoreSuffix) {
|
782
|
+
continue;
|
783
|
+
}
|
784
|
+
if (!shouldSkipIgnoreSuffix) {
|
785
|
+
console.error(`${opts.ignoreSuffix} is not match to "${prevName}" or "${currName}"`);
|
786
|
+
}
|
787
|
+
}
|
762
788
|
// Compare with lexicographic order
|
763
789
|
const compareResult = prevName.localeCompare(currName);
|
764
790
|
const shouldSort = compareResult === 1;
|
package/index.mjs
CHANGED
@@ -699,6 +699,14 @@ const rule = {
|
|
699
699
|
description: 'Definitions – `type`, `interface`, `enum`, `scalar`, `input`, `union` and `directive`.',
|
700
700
|
default: false,
|
701
701
|
},
|
702
|
+
ignorePrefix: {
|
703
|
+
type: 'array',
|
704
|
+
default: [],
|
705
|
+
},
|
706
|
+
ignoreSuffix: {
|
707
|
+
type: 'array',
|
708
|
+
default: [],
|
709
|
+
},
|
702
710
|
},
|
703
711
|
},
|
704
712
|
},
|
@@ -753,6 +761,24 @@ const rule = {
|
|
753
761
|
const prevNode = nodes[i - 1];
|
754
762
|
const prevName = ('alias' in prevNode && ((_c = prevNode.alias) === null || _c === void 0 ? void 0 : _c.value)) || ('name' in prevNode && ((_d = prevNode.name) === null || _d === void 0 ? void 0 : _d.value));
|
755
763
|
if (prevName) {
|
764
|
+
if (opts.ignorePrefix.length > 0) {
|
765
|
+
const shouldSkipIgnorePrefix = opts.ignorePrefix.some(prefix => prefix === prevName || prefix === currName || prevName.startsWith(prefix) || currName.startsWith(prefix));
|
766
|
+
if (shouldSkipIgnorePrefix) {
|
767
|
+
continue;
|
768
|
+
}
|
769
|
+
if (!shouldSkipIgnorePrefix) {
|
770
|
+
console.error(`${opts.ignorePrefix} is not match to "${prevName}" or "${currName}"`);
|
771
|
+
}
|
772
|
+
}
|
773
|
+
if (opts.ignoreSuffix.length > 0) {
|
774
|
+
const shouldSkipIgnoreSuffix = opts.ignoreSuffix.some(suffix => suffix === prevName || suffix === currName || prevName.endsWith(suffix) || currName.endsWith(suffix));
|
775
|
+
if (shouldSkipIgnoreSuffix) {
|
776
|
+
continue;
|
777
|
+
}
|
778
|
+
if (!shouldSkipIgnoreSuffix) {
|
779
|
+
console.error(`${opts.ignoreSuffix} is not match to "${prevName}" or "${currName}"`);
|
780
|
+
}
|
781
|
+
}
|
756
782
|
// Compare with lexicographic order
|
757
783
|
const compareResult = prevName.localeCompare(currName);
|
758
784
|
const shouldSort = compareResult === 1;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@graphql-eslint/eslint-plugin",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.11.0-alpha-20220828112016-ee5ae70",
|
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",
|
package/rules/alphabetize.d.ts
CHANGED
@@ -11,6 +11,8 @@ export declare type AlphabetizeConfig = {
|
|
11
11
|
variables?: typeof variablesEnum;
|
12
12
|
arguments?: typeof argumentsEnum;
|
13
13
|
definitions?: boolean;
|
14
|
+
ignorePrefix?: string[];
|
15
|
+
ignoreSuffix?: string[];
|
14
16
|
};
|
15
17
|
declare const rule: GraphQLESLintRule<[AlphabetizeConfig]>;
|
16
18
|
export default rule;
|