-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.ts
More file actions
127 lines (118 loc) · 4.37 KB
/
Copy patheslint.config.ts
File metadata and controls
127 lines (118 loc) · 4.37 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import js from '@eslint/js';
import ts from 'typescript-eslint';
import globals from 'globals';
import stylistic from '@stylistic/eslint-plugin';
import sveltePlugin from 'eslint-plugin-svelte';
import svelteParser from 'svelte-eslint-parser';
import { defineConfig } from 'eslint/config';
export default defineConfig(
js.configs.recommended,
ts.configs.recommendedTypeChecked,
sveltePlugin.configs.recommended,
{
ignores: [
'assets', // Ignore assets
'coverage', // Ignore compiled output
'public', // Ignore compiled output
'dist', // Ignore compiled output
'.svelte-kit', // Ignore compiled output
'node_modules', // Ignore node_modules
'vanillajs-datepicker', // Ignore third party modules
]
},
{ plugins: { '@stylistic': stylistic } },
{
files: ['**/*.{svelte.js,svelte.ts,svelte}'],
languageOptions: {
parserOptions: {
parser: ts.parser, // Use TypeScript parser for <script> blocks
project: './tsconfig.json',
extraFileExtensions: ['.svelte']
},
parser: svelteParser,
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
...globals.vitest,
$state: 'readonly', // Svelte's $state shows undefined in test files
},
},
plugins: {
svelte: sveltePlugin,
'@typescript-eslint': ts.plugin,
},
rules: {
'no-useless-assignment': 'off', // $derived values used only in templates are falsely flagged
}
},
{
files: ['**/*.{js,ts,mjs}'],
languageOptions: {
parser: ts.parser,
parserOptions: {
project: './tsconfig.json',
},
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
...globals.vitest,
},
},
plugins: {
'@typescript-eslint': ts.plugin,
}
},
{
rules: {
'@stylistic/array-bracket-spacing': ['error', 'never'],
'@stylistic/brace-style': ['error', 'stroustrup', { 'allowSingleLine': true }],
'@stylistic/comma-dangle': 0,
'@stylistic/eol-last': 1,
'@stylistic/function-call-spacing': ['error', 'never'],
'@stylistic/indent': ['error', 'tab'],
'@stylistic/key-spacing': ['error', { 'beforeColon': false, 'afterColon': true, 'mode': 'strict' }],
'@stylistic/lines-between-class-members': ['error', 'always'],
'@stylistic/newline-per-chained-call': ['error', { 'ignoreChainWithDepth': 3 }],
'@stylistic/no-mixed-spaces-and-tabs': 'error',
'@stylistic/no-multi-spaces': ['error', { 'ignoreEOLComments': true }],
'@stylistic/no-trailing-spaces': 'error',
'@stylistic/object-curly-spacing': ['error', 'always'],
'@stylistic/quotes': ['error', 'single', { 'avoidEscape': true }],
'@stylistic/semi': ['error', 'always'],
'@stylistic/block-spacing': ['error', 'always'],
'@stylistic/space-before-blocks': ['error', 'always'],
'@stylistic/space-before-function-paren': ['error', 'always'],
'@stylistic/space-in-parens': ['error', 'never'],
'@stylistic/template-curly-spacing': ['error', 'never'],
'@stylistic/keyword-spacing': ['error', { 'before': true, 'after': true }],
'@stylistic/semi-spacing': ['error', { 'before': false, 'after': true }],
'@stylistic/space-infix-ops': 'error',
'@stylistic/comma-spacing': ['error', { 'before': false, 'after': true }],
'@stylistic/arrow-spacing': ['error', { 'before': true, 'after': true }],
'curly': ['error', 'multi-line'],
'dot-notation': 'error',
'no-cond-assign': 0,
'no-else-return': 'error',
'no-shadow': 'error',
'no-unneeded-ternary': 'error',
// 'no-use-before-define': ['error', 'nofunc'], // problematic with svelte
'prefer-arrow-callback': 'error',
'prefer-const': ['error', { 'destructuring': 'all', 'ignoreReadBeforeAssign': false }],
'prefer-promise-reject-errors': 'error',
'svelte/no-at-html-tags': 0,
'@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_' }],
'@typescript-eslint/no-explicit-any': 'off', // Allow any types during migration
'@typescript-eslint/ban-ts-comment': 'off',
// disable some type-aware rules
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-misused-promises': 'off',
}
}
);