@nitra/eslint-config 3.6.4 → 3.6.7

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.
Files changed (2) hide show
  1. package/index.js +93 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -49,8 +49,17 @@ const VUE_SCRIPT_ESLINT_RECOMMENDED_GAP_RULES = {
49
49
  // @ts-expect-error типізація плагіна не гарантує `configs.recommended`; у runtime поле є.
50
50
  const e18eRecommendedFlat = /** @type {import('eslint').Linter.FlatConfig} */ (e18ePlugin.configs.recommended)
51
51
 
52
- /** Віртуальні документи з gql/graphql у .js/.vue (processor); ESLint обробляє їх як окремі `*.graphql` файли. */
53
- const GRAPHQL_EXTRACTED_DOCUMENT_FILES = ['**/*.graphql']
52
+ /**
53
+ * Лише віртуальні GraphQL-документи з процесора (gql у `.js`/`.vue`): шляхи виду
54
+ * `…/file.js/0_document.graphql` або `…/Comp.vue/…/0_document.graphql`. Фізичні `*.graphql` у проєкті не
55
+ * потрапляють сюди — їх ESLint з цим пакетом не аналізує graphql-eslint.
56
+ */
57
+ const GRAPHQL_EXTRACTED_DOCUMENT_FILES = [
58
+ '**/*.vue/**/*.graphql',
59
+ '**/*.js/*.graphql',
60
+ '**/*.mjs/*.graphql',
61
+ '**/*.cjs/*.graphql'
62
+ ]
54
63
 
55
64
  /**
56
65
  * Правила для витягнутих GraphQL-блоків: пресет operations-recommended (поля, типи, змінні).
@@ -246,6 +255,86 @@ const vueVite = [
246
255
  }
247
256
  ]
248
257
 
258
+ /**
259
+ * Глобалі для типового Vite + auto-import: Composition API, vue-router, Quasar, пакет vue-apollo-composable.
260
+ * У пакеті `globals` ключ `vue` містить лише макроси `<script setup>` (`defineProps` тощо), без `onMounted` /
261
+ * `createApp` / `useRouter` — без цього списку `no-undef` хибно спрацьовує у `.vue` і `.js` під директоріями Vue.
262
+ */
263
+ const VUE_VITE_AUTO_IMPORT_GLOBALS = Object.fromEntries(
264
+ [
265
+ 'cloneVNode',
266
+ 'computed',
267
+ 'createApp',
268
+ 'customRef',
269
+ 'defineAsyncComponent',
270
+ 'defineComponent',
271
+ 'effectScope',
272
+ 'getCurrentInstance',
273
+ 'getCurrentScope',
274
+ 'h',
275
+ 'inject',
276
+ 'isProxy',
277
+ 'isReactive',
278
+ 'isReadonly',
279
+ 'isRef',
280
+ 'isVNode',
281
+ 'markRaw',
282
+ 'mergeProps',
283
+ 'nextTick',
284
+ 'onActivated',
285
+ 'onBeforeMount',
286
+ 'onBeforeRouteLeave',
287
+ 'onBeforeRouteUpdate',
288
+ 'onBeforeUnmount',
289
+ 'onBeforeUpdate',
290
+ 'onDeactivated',
291
+ 'onErrorCaptured',
292
+ 'onMounted',
293
+ 'onRenderTracked',
294
+ 'onRenderTriggered',
295
+ 'onScopeDispose',
296
+ 'onServerPrefetch',
297
+ 'onUnmounted',
298
+ 'onUpdated',
299
+ 'provide',
300
+ 'reactive',
301
+ 'readonly',
302
+ 'ref',
303
+ 'resolveComponent',
304
+ 'resolveDirective',
305
+ 'shallowReactive',
306
+ 'shallowReadonly',
307
+ 'shallowRef',
308
+ 'toRef',
309
+ 'toRefs',
310
+ 'toValue',
311
+ 'triggerRef',
312
+ 'unref',
313
+ 'useApolloClient',
314
+ 'useAttrs',
315
+ 'useCssModule',
316
+ 'useCssVars',
317
+ 'useId',
318
+ 'useLazyQuery',
319
+ 'useLink',
320
+ 'useModel',
321
+ 'useMutation',
322
+ 'useQuasar',
323
+ 'useQuery',
324
+ 'useRoute',
325
+ 'useRouter',
326
+ 'useSlots',
327
+ 'useSubscription',
328
+ 'useTemplateRef',
329
+ 'watch',
330
+ 'watchEffect',
331
+ 'watchPostEffect',
332
+ 'watchSyncEffect',
333
+ 'withDirectives',
334
+ 'withModifiers'
335
+ ].map(name => [name, 'readonly'])
336
+ )
337
+
249
338
  // Для усіх файлів Vue проектів
250
339
  // files: ['**/*.js', '**/*.vue']
251
340
  const vueAllVite = [
@@ -258,12 +347,9 @@ const vueAllVite = [
258
347
  gql: 'readonly',
259
348
  $ref: 'readonly',
260
349
  $computed: 'readonly',
261
- ref: 'readonly',
262
- useQuery: 'readonly',
263
- watch: 'readonly',
264
- computed: 'readonly',
350
+ ...VUE_VITE_AUTO_IMPORT_GLOBALS,
265
351
 
266
- // Макроси `<script setup>` (джерело списку `globals` / `vue` у vue-eslint-parser).
352
+ // Макроси `<script setup>` (у пакеті `globals` лише `globals.vue`).
267
353
  ...globals.vue
268
354
  }
269
355
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitra/eslint-config",
3
- "version": "3.6.4",
3
+ "version": "3.6.7",
4
4
  "description": "An ESLint shareable config for projects using Vue and Node",
5
5
  "keywords": [
6
6
  "eslint",