forked from nextcloud-libraries/eslint-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue3.js
45 lines (40 loc) · 1.16 KB
/
vue3.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
const base = require('./parts/base.js')
const typescriptOverrides = require('./parts/typescript.js')
const vueOverrides = require('./parts/vue3.js')
// Use different parser for vue files script section
vueOverrides.parserOptions = {
parser: '@typescript-eslint/parser',
sourceType: 'module',
}
// Override vue rules with rules for Typescript
vueOverrides.rules = {
...vueOverrides.rules,
...typescriptOverrides.rules,
}
// Add settings, required for import resolver
vueOverrides.settings = {
...(vueOverrides.settings || []),
...typescriptOverrides.settings,
}
// Also extend from vue typescript eslint
vueOverrides.extends.push('@vue/eslint-config-typescript/recommended')
/**
* Config for projects written in Typescript + vue including vue files written in Typescript (`<script lang='ts'>`)
*/
module.exports = {
...base,
overrides: [
// Overrides for Typescript files
{
...typescriptOverrides,
},
// Setup different vue parser to support `<script setup>` correctly, especially for `lang="ts"`
{
...vueOverrides,
},
],
}