Skip to content

Commit b1138d6

Browse files
committed
chore: update eslint and TypeScript configuration
- Update eslint config for better type checking - Update tsconfig for v0.4.0 compatibility Authored by: Aaron Lippold<lippold@gmail.com>
1 parent aab6f0c commit b1138d6

File tree

2 files changed

+67
-39
lines changed

2 files changed

+67
-39
lines changed

eslint.config.mjs

Lines changed: 55 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,59 @@
11
// @ts-check
2-
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
3-
4-
// Run `npx @eslint/config-inspector` to inspect the resolved config interactively
5-
export default createConfigForNuxt({
6-
features: {
7-
// Rules for module authors
8-
tooling: true,
9-
// Rules for formatting
10-
stylistic: true,
2+
import antfu from '@antfu/eslint-config'
3+
4+
export default antfu({
5+
// Type of the project
6+
typescript: true,
7+
vue: true,
8+
9+
// Enable stylistic formatting rules
10+
stylistic: {
11+
indent: 2,
12+
quotes: 'single',
13+
semi: false,
1114
},
12-
dirs: {
13-
src: [
14-
'./src',
15-
'./playground',
16-
'./test',
17-
],
15+
16+
// Customize rules
17+
rules: {
18+
// Allow console.warn and console.error
19+
'no-console': ['warn', { allow: ['warn', 'error'] }],
20+
21+
// TypeScript
22+
'ts/no-explicit-any': 'warn',
23+
'ts/no-unused-vars': ['error', {
24+
argsIgnorePattern: '^_',
25+
varsIgnorePattern: '^_',
26+
}],
27+
28+
// Node/Process - we're in a browser environment primarily
29+
'node/prefer-global/process': 'off',
30+
'no-restricted-globals': 'off', // Allow 'global' in test files
31+
32+
// Allow assignment in conditions when intentional
33+
'no-cond-assign': ['error', 'except-parens'],
34+
35+
// Allow function hoisting
36+
'ts/no-use-before-define': ['error', { functions: false }],
37+
38+
// Vue/Nuxt specific
39+
'vue/multi-word-component-names': 'off',
40+
41+
// Style preferences for this project
42+
'style/brace-style': ['error', '1tbs'],
43+
'style/arrow-parens': ['error', 'always'],
44+
45+
// JSON sorting - not critical
46+
'jsonc/sort-keys': 'off',
1847
},
48+
49+
// Files to ignore
50+
ignores: [
51+
'**/dist',
52+
'**/node_modules',
53+
'**/.nuxt',
54+
'**/coverage',
55+
'**/playground/.nuxt',
56+
'**/playground/.output',
57+
'**/*.md',
58+
],
1959
})
20-
.append({
21-
rules: {
22-
// Allow console in playground and tests
23-
'no-console': ['warn', { allow: ['warn', 'error'] }],
24-
// TypeScript specific
25-
'@typescript-eslint/no-explicit-any': 'warn',
26-
'@typescript-eslint/no-unused-vars': ['error', {
27-
argsIgnorePattern: '^_',
28-
varsIgnorePattern: '^_',
29-
}],
30-
},
31-
})

tsconfig.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
{
22
"compilerOptions": {
33
"target": "ES2022",
4-
"module": "ESNext",
54
"lib": ["ES2022", "DOM", "DOM.Iterable"],
6-
"skipLibCheck": true,
7-
"resolveJsonModule": true,
5+
"module": "ESNext",
86
"moduleResolution": "node",
9-
"allowSyntheticDefaultImports": true,
10-
"esModuleInterop": true,
11-
"strict": true,
12-
"noUnusedLocals": true,
13-
"noUnusedParameters": true,
14-
"noImplicitAny": true,
15-
"forceConsistentCasingInFileNames": true,
7+
"resolveJsonModule": true,
168
"types": [
179
"node",
1810
"vitest/globals"
19-
]
11+
],
12+
"strict": true,
13+
"noImplicitAny": true,
14+
"noUnusedLocals": true,
15+
"noUnusedParameters": true,
16+
"allowSyntheticDefaultImports": true,
17+
"esModuleInterop": true,
18+
"skipLibCheck": true,
19+
"forceConsistentCasingInFileNames": true
2020
},
2121
"include": [
2222
"src/**/*",
@@ -29,4 +29,4 @@
2929
".nuxt",
3030
"docs"
3131
]
32-
}
32+
}

0 commit comments

Comments
 (0)