@nitra/eslint-config 3.6.14 → 3.7.0
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/graphql-eslint-anchor.js +30 -0
- package/package.json +1 -1
package/graphql-eslint-anchor.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @see upstream graphql-eslint (MIT) on GitHub
|
|
6
6
|
*/
|
|
7
7
|
import { relative } from 'node:path'
|
|
8
|
+
import { CodeFileLoader } from '@graphql-tools/code-file-loader'
|
|
8
9
|
import { gqlPluckFromCodeStringSync } from '@graphql-tools/graphql-tag-pluck'
|
|
9
10
|
import { asArray } from '@graphql-tools/utils'
|
|
10
11
|
import graphqlEslintPlugin from '@graphql-eslint/eslint-plugin'
|
|
@@ -12,6 +13,35 @@ import { loadOnDiskGraphQLConfig } from '@graphql-eslint/eslint-plugin/graphql-c
|
|
|
12
13
|
import { version } from '@graphql-eslint/eslint-plugin/meta'
|
|
13
14
|
import { CWD, REPORT_ON_FIRST_CHARACTER } from '@graphql-eslint/eslint-plugin/utils'
|
|
14
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Дефолтні негативні globs для CodeFileLoader: апстрім `createGlobbyOptions` хардкодить
|
|
18
|
+
* `ignore: []`, тож широкі patterns у `.graphqlrc.yml documents` (наприклад,
|
|
19
|
+
* `**\/*.{vue,js,ts,tsx}`) сканують `node_modules` синхронно через Babel pluck і вішають
|
|
20
|
+
* eslint на хвилини. Patches `_buildGlobs` додає `!`-префіксні globs у сам список патернів —
|
|
21
|
+
* це працює, на відміну від спроби пропатчити free function `createGlobbyOptions`.
|
|
22
|
+
*/
|
|
23
|
+
const CODE_FILE_LOADER_DEFAULT_IGNORES = [
|
|
24
|
+
'!**/node_modules/**',
|
|
25
|
+
'!**/.git/**',
|
|
26
|
+
'!**/dist/**',
|
|
27
|
+
'!**/.yarn/**',
|
|
28
|
+
'!**/.cursor/**',
|
|
29
|
+
'!**/.claude/**',
|
|
30
|
+
'!**/.github/**',
|
|
31
|
+
'!**/.vscode/**',
|
|
32
|
+
'!**/coverage/**'
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
const CODE_FILE_LOADER_PATCH_FLAG = Symbol.for('@nitra/eslint-config/code-file-loader-default-ignores')
|
|
36
|
+
if (!CodeFileLoader.prototype[CODE_FILE_LOADER_PATCH_FLAG]) {
|
|
37
|
+
const originalBuildGlobs = CodeFileLoader.prototype._buildGlobs
|
|
38
|
+
CodeFileLoader.prototype._buildGlobs = function patchedBuildGlobs(glob, options) {
|
|
39
|
+
const globs = originalBuildGlobs.call(this, glob, options)
|
|
40
|
+
return [...globs, ...CODE_FILE_LOADER_DEFAULT_IGNORES]
|
|
41
|
+
}
|
|
42
|
+
CodeFileLoader.prototype[CODE_FILE_LOADER_PATCH_FLAG] = true
|
|
43
|
+
}
|
|
44
|
+
|
|
15
45
|
const blocksMap = /* @__PURE__ */ new Map()
|
|
16
46
|
let onDiskConfig
|
|
17
47
|
let onDiskConfigLoaded = false
|