@nitra/eslint-config 2.0.26 → 2.1.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.
Files changed (2) hide show
  1. package/index.js +36 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -70,7 +70,7 @@ const node = [
70
70
  },
71
71
  languageOptions: {
72
72
  globals: {
73
- ...globals.node,
73
+ ...globals.node
74
74
  }
75
75
  }
76
76
  }
@@ -99,6 +99,7 @@ const vueAllVite = [
99
99
  createLogger: 'readonly',
100
100
  gql: 'readonly',
101
101
  $ref: 'readonly',
102
+ $computed: 'readonly',
102
103
  ref: 'readonly',
103
104
  useQuery: 'readonly',
104
105
  watch: 'readonly',
@@ -152,12 +153,20 @@ const vue = [
152
153
  }
153
154
  ]
154
155
 
156
+ const vue2 = [
157
+ {
158
+ rules: {
159
+ 'vue/no-deprecated-v-bind-sync': 'off'
160
+ }
161
+ }
162
+ ]
163
+
155
164
  /**
156
165
  * Eslint правила
157
- * @param {{node?: Array, vue?: Array}} params список директорій до яких примінити Eslint правили
166
+ * @param {{node?: Array, vue?: Array, vue2?: Array}} params список директорій до яких примінити Eslint правили
158
167
  * @returns {Array} конфігурації eslint
159
168
  */
160
- export function getConfig(params = { node: [], vue: [] }) {
169
+ export function getConfig(params = { node: [], vue: [], vue2: [] }) {
161
170
  const result = all
162
171
 
163
172
  // якщо присутні nodejs проекти в monorepo
@@ -170,7 +179,7 @@ export function getConfig(params = { node: [], vue: [] }) {
170
179
  result.push(...nodeConfig)
171
180
  }
172
181
 
173
- // якщо присутні nodejs проекти в monorepo
182
+ // Правила для Vue3
174
183
  if (params.vue?.length) {
175
184
  // по певним файлам правили
176
185
  const filesVite = params.vue.map(name => `${name}/**/vite.config.js`)
@@ -187,6 +196,7 @@ export function getConfig(params = { node: [], vue: [] }) {
187
196
  files,
188
197
  ...configObject
189
198
  }))
199
+
190
200
  result.push(...vueConfig)
191
201
 
192
202
  // Для js файлів всередині Vue проектів правила
@@ -199,5 +209,27 @@ export function getConfig(params = { node: [], vue: [] }) {
199
209
  result.push(...vueJSConfig)
200
210
  }
201
211
 
212
+ // Правила для Vue2
213
+ if (params.vue2?.length) {
214
+ // по певним файлам правили
215
+ // Для Vue файлів правила
216
+ const files = params.vue2.map(name => `${name}/**/*.vue`)
217
+ const vueConfig = [...vueAllVite, ...vue, ...vue2].map(configObject => ({
218
+ files,
219
+ ...configObject
220
+ }))
221
+
222
+ result.push(...vueConfig)
223
+
224
+ // Для js файлів всередині Vue проектів правила
225
+ const filesJS = params.vue2.map(name => `${name}/**/*.js`)
226
+ const vueJSConfig = vueAllVite.map(configObject => ({
227
+ files: filesJS,
228
+ ...configObject
229
+ }))
230
+ // @ts-ignore
231
+ result.push(...vueJSConfig)
232
+ }
233
+
202
234
  return result
203
235
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitra/eslint-config",
3
- "version": "2.0.26",
3
+ "version": "2.1.0",
4
4
  "description": "A Eslint shareable config for projects using 'Vue' and 'Node'",
5
5
  "type": "module",
6
6
  "exports": "./index.js",