@graphql-eslint/eslint-plugin 3.12.0-alpha-20221008232037-33da317 → 3.12.0-alpha-20221009002505-ace0694

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/index.js +3 -2
  2. package/index.mjs +3 -2
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -105,12 +105,13 @@ const processor = {
105
105
  }
106
106
  try {
107
107
  const sources = graphqlTagPluck.gqlPluckFromCodeStringSync(filePath, code, pluckConfig);
108
+ const isSvelte = filePath.endsWith('.svelte');
108
109
  const blocks = sources.map(item => ({
109
110
  filename: 'document.graphql',
110
111
  text: item.body,
111
- lineOffset: item.locationOffset.line - 1,
112
+ lineOffset: item.locationOffset.line - (isSvelte ? 3 : 1),
112
113
  // @ts-expect-error -- `index` field exist but show ts error
113
- offset: item.locationOffset.index + 1,
114
+ offset: item.locationOffset.index + (isSvelte ? -52 : 1),
114
115
  }));
115
116
  blocksMap.set(filePath, blocks);
116
117
  return [...blocks, code /* source code must be provided and be last */];
package/index.mjs CHANGED
@@ -99,12 +99,13 @@ const processor = {
99
99
  }
100
100
  try {
101
101
  const sources = gqlPluckFromCodeStringSync(filePath, code, pluckConfig);
102
+ const isSvelte = filePath.endsWith('.svelte');
102
103
  const blocks = sources.map(item => ({
103
104
  filename: 'document.graphql',
104
105
  text: item.body,
105
- lineOffset: item.locationOffset.line - 1,
106
+ lineOffset: item.locationOffset.line - (isSvelte ? 3 : 1),
106
107
  // @ts-expect-error -- `index` field exist but show ts error
107
- offset: item.locationOffset.index + 1,
108
+ offset: item.locationOffset.index + (isSvelte ? -52 : 1),
108
109
  }));
109
110
  blocksMap.set(filePath, blocks);
110
111
  return [...blocks, code /* source code must be provided and be last */];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "3.12.0-alpha-20221008232037-33da317",
3
+ "version": "3.12.0-alpha-20221009002505-ace0694",
4
4
  "description": "GraphQL plugin for ESLint",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {