@nitra/eslint-config 3.6.0 → 3.6.2

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 +26 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -14,6 +14,7 @@ import securityPlugin from 'eslint-plugin-security'
14
14
  import sonarjsPlugin from 'eslint-plugin-sonarjs'
15
15
  import unicornPlugin from 'eslint-plugin-unicorn'
16
16
  import vuePlugin from 'eslint-plugin-vue'
17
+ import vueEslintParser from 'vue-eslint-parser'
17
18
  import { configs as ymlConfigs } from 'eslint-plugin-yml'
18
19
  import { mergeProcessors } from 'eslint-merge-processors'
19
20
  import processorVueBlocks from 'eslint-processor-vue-blocks'
@@ -172,6 +173,16 @@ const all = [
172
173
  },
173
174
  // eslint-plugin-sonarjs — recommended (bugs, complexity, duplicates; лише JS-подібні файли)
174
175
  { ...sonarjsPlugin.configs.recommended, files: UNICORN_FILES },
176
+ /**
177
+ * Віртуальні файли з `eslint-processor-vue-blocks` (`…/Component.vue/…_script.js`) без `<template>` —
178
+ * для них немає `defineTemplateBodyVisitor`, тож `sonarjs/unused-import` хибно скаржиться на імпорти лише для шаблону.
179
+ */
180
+ {
181
+ files: ['**/*.vue/**/*.js', '**/*.vue/**/*.mjs', '**/*.vue/**/*.cjs', '**/*.vue/**/*.ts', '**/*.vue/**/*.tsx'],
182
+ rules: {
183
+ 'sonarjs/unused-import': 'off'
184
+ }
185
+ },
175
186
  // @e18e/eslint-plugin — recommended (modernization + module replacements + performance)
176
187
  {
177
188
  files: UNICORN_FILES,
@@ -226,7 +237,15 @@ const vueAllVite = [
226
237
  ref: 'readonly',
227
238
  useQuery: 'readonly',
228
239
  watch: 'readonly',
229
- computed: 'readonly'
240
+ computed: 'readonly',
241
+ // Макроси `<script setup>` і vue-macros (`defineOptions` тощо).
242
+ defineProps: 'readonly',
243
+ defineEmits: 'readonly',
244
+ defineExpose: 'readonly',
245
+ withDefaults: 'readonly',
246
+ defineSlots: 'readonly',
247
+ defineModel: 'readonly',
248
+ defineOptions: 'readonly'
230
249
  }
231
250
  }
232
251
  }
@@ -329,7 +348,12 @@ function pushVueConfigs(result, dirs, options = {}) {
329
348
 
330
349
  const filesVue = dirs.map(name => `${name}/**/*.vue`)
331
350
  const vueConfigs = [...vueAllVite, ...vue, ...extraVueConfigs]
332
- result.push(...vueConfigs.map(configObject => ({ files: filesVue, ...configObject })))
351
+ result.push(...vueConfigs.map(configObject => ({ files: filesVue, ...configObject })), {
352
+ files: filesVue,
353
+ languageOptions: {
354
+ parser: vueEslintParser
355
+ }
356
+ })
333
357
 
334
358
  const filesJS = dirs.map(name => `${name}/**/*.js`)
335
359
  result.push(...vueAllVite.map(configObject => ({ files: filesJS, ...configObject })))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitra/eslint-config",
3
- "version": "3.6.0",
3
+ "version": "3.6.2",
4
4
  "description": "An ESLint shareable config for projects using Vue and Node",
5
5
  "keywords": [
6
6
  "eslint",