File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed
packages/plugin/src/rules Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @graphql-eslint/eslint-plugin ' : patch
3
+ ---
4
+
5
+ fix: adjust report location for ` no-anonymous-operations ` rule
Original file line number Diff line number Diff line change @@ -38,16 +38,18 @@ const rule: GraphQLESLintRule = {
38
38
create ( context ) {
39
39
return {
40
40
OperationDefinition ( node ) {
41
- if ( node && ( ! node . name || node . name . value === '' ) ) {
41
+ const isAnonymous = ( node . name ?. value || '' ) . length === 0 ;
42
+ if ( isAnonymous ) {
43
+ const { start } = node . loc ;
42
44
context . report ( {
43
45
loc : {
44
46
start : {
45
- column : node . loc . start . column - 1 ,
46
- line : node . loc . start . line ,
47
+ column : start . column - 1 ,
48
+ line : start . line ,
47
49
} ,
48
50
end : {
49
- column : node . loc . start . column + node . operation . length ,
50
- line : node . loc . start . line ,
51
+ column : start . column - 1 + node . operation . length ,
52
+ line : start . line ,
51
53
} ,
52
54
} ,
53
55
data : {
You can’t perform that action at this time.
0 commit comments