@archpublicwebsite/eslint-config 1.0.20 → 1.0.22

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.
@@ -9,20 +9,30 @@ const TAG = '[@archpublicwebsite/eslint-config]'
9
9
  * the correct file types.
10
10
  */
11
11
  const VSCODE_ESLINT_SETTINGS = {
12
+ // Use workspace TypeScript for consistent Volar/TS plugin resolution
13
+ 'typescript.tsdk': 'node_modules/typescript/lib',
14
+ 'typescript.enablePromptUseWorkspaceTsdk': true,
15
+
16
+ // Ensure Vue SFC files are always handled as Vue documents
17
+ 'files.associations': {
18
+ '*.vue': 'vue',
19
+ },
20
+
21
+ // Volar + TS integration for Vue 3 SFC template diagnostics
22
+ 'vue.server.hybridMode': true,
23
+ 'volar.takeOverMode.enabled': true,
24
+
25
+ // Prevent duplicate/broken diagnostics from built-in TS/JS validators
26
+ // (vue-tsc + Volar remain the source of truth for Vue type diagnostics).
27
+ 'typescript.validate.enable': false,
28
+ 'javascript.validate.enable': false,
29
+
12
30
  // Use flat config mode (required for eslint.config.mjs)
13
31
  'eslint.useFlatConfig': true,
32
+ 'eslint.workingDirectories': [{ mode: 'auto' }],
14
33
 
15
34
  // Enable ESLint for these languages
16
- 'eslint.validate': [
17
- 'javascript',
18
- 'javascriptreact',
19
- 'typescript',
20
- 'typescriptreact',
21
- 'vue',
22
- 'json',
23
- 'jsonc',
24
- 'markdown',
25
- ],
35
+ 'eslint.validate': ['javascript', 'javascriptreact', 'typescript', 'typescriptreact', 'vue', 'json', 'jsonc'],
26
36
 
27
37
  // Auto-fix on save via ESLint
28
38
  'editor.codeActionsOnSave': {
@@ -33,7 +43,22 @@ const VSCODE_ESLINT_SETTINGS = {
33
43
  // Let ESLint handle formatting instead of the built-in formatter
34
44
  'editor.formatOnSave': false,
35
45
 
36
- // Disable the default VS Code JSON formatter for files ESLint handles
46
+ // Formatters per language ESLint enforces no-semi, single-quote on save
47
+ '[javascript]': {
48
+ 'editor.defaultFormatter': 'dbaeumer.vscode-eslint',
49
+ },
50
+ '[javascriptreact]': {
51
+ 'editor.defaultFormatter': 'dbaeumer.vscode-eslint',
52
+ },
53
+ '[typescript]': {
54
+ 'editor.defaultFormatter': 'dbaeumer.vscode-eslint',
55
+ },
56
+ '[typescriptreact]': {
57
+ 'editor.defaultFormatter': 'dbaeumer.vscode-eslint',
58
+ },
59
+ '[vue]': {
60
+ 'editor.defaultFormatter': 'Vue.volar',
61
+ },
37
62
  '[json]': {
38
63
  'editor.defaultFormatter': 'dbaeumer.vscode-eslint',
39
64
  },
@@ -71,16 +96,15 @@ function deepMerge(target, source) {
71
96
  const srcVal = source[key]
72
97
  const tgtVal = result[key]
73
98
  if (
74
- srcVal !== null
75
- && typeof srcVal === 'object'
76
- && !Array.isArray(srcVal)
77
- && tgtVal !== null
78
- && typeof tgtVal === 'object'
79
- && !Array.isArray(tgtVal)
99
+ srcVal !== null &&
100
+ typeof srcVal === 'object' &&
101
+ !Array.isArray(srcVal) &&
102
+ tgtVal !== null &&
103
+ typeof tgtVal === 'object' &&
104
+ !Array.isArray(tgtVal)
80
105
  ) {
81
106
  result[key] = deepMerge(tgtVal, srcVal)
82
- }
83
- else {
107
+ } else {
84
108
  result[key] = srcVal
85
109
  }
86
110
  }
@@ -107,8 +131,7 @@ export function ensureVscodeSettings(projectRoot) {
107
131
  try {
108
132
  const raw = readFileSync(settingsPath, 'utf8')
109
133
  current = JSON.parse(raw)
110
- }
111
- catch {
134
+ } catch {
112
135
  // File exists but is not valid JSON – back it up and start fresh
113
136
  const backupPath = `${settingsPath}.backup`
114
137
  writeFileSync(backupPath, readFileSync(settingsPath, 'utf8'), 'utf8')