-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy patheslint.config.mts
More file actions
138 lines (137 loc) · 4.47 KB
/
Copy patheslint.config.mts
File metadata and controls
138 lines (137 loc) · 4.47 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
128
129
130
131
132
133
134
135
136
137
138
import jsLint from '@eslint/js';
import tsLint from 'typescript-eslint';
import vueLint from 'eslint-plugin-vue';
import importXPlugin from 'eslint-plugin-import-x';
import globals from 'globals';
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript';
export default defineConfigWithVueTs(
jsLint.configs.recommended,
...tsLint.configs.recommended,
importXPlugin.flatConfigs.recommended,
...vueLint.configs['flat/essential'],
vueTsConfigs.recommended,
{
ignores: [
'dist/**',
'node_modules/**',
'.vite/**',
'thunderbird-accounts/**',
'tests/perf/**',
'tests/fixtures/**',
'research/**',
'infra/**',
'docs/**',
'public/**',
'tests/e2e/**',
'playwright.config.js',
'vite.config.*',
],
},
{
files: ['**/*.vue', '**/*.js', '**/*.jsx', '**/*.cjs', '**/*.mjs', '**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
...globals.worker,
...globals.node,
},
},
rules: {
eqeqeq: ['error', 'smart'],
// Codebase mixes .js-suffixed and unsuffixed imports today; the
// long-term convention is unsuffixed for .ts/.vue and never for
// packages. Warn so cleanups land alongside touched files
// without breaking CI on existing call sites.
'import-x/extensions': [
'warn',
'ignorePackages',
{
'': 'never',
ts: 'never',
js: 'never',
vue: 'off',
},
],
'import-x/prefer-default-export': 'off',
// import-plugin's CJS-vs-ESM resolver flags Vite's URL-shape
// imports and bare worker entries; let vue-tsc handle module
// resolution and stand down here.
'import-x/no-unresolved': 'off',
// Vue 3 components register dynamically; plugin-import does not
// see them and would flag template-only usage.
'import-x/no-named-as-default': 'off',
'import-x/no-named-as-default-member': 'off',
// TypeScript already enforces these; let TS own them.
'no-undef': 'off',
'no-redeclare': 'off',
// The codebase uses `any` deliberately at MessagePort RPC
// boundaries (the SharedWorker call() return) and for narrow
// test fixture shapes. Warn so new sites stand out without
// failing the existing ones.
'@typescript-eslint/no-explicit-any': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
// Banned in stores so DOM manipulation and global state do not
// leak into the orchestration layer (constitution III). The
// override below relaxes this for components and other layers.
'no-restricted-syntax': [
'error',
{
selector: 'CallExpression[callee.object.name=/^(JSON)$/][callee.property.name="parse"][arguments.0.callee.object.name="JSON"][arguments.0.callee.property.name="stringify"]',
message: 'Use structuredClone(value) instead of JSON.parse(JSON.stringify(value)).',
},
],
},
settings: {
'import/resolver': {
typescript: true,
node: true,
},
},
},
{
// Pinia stores hold raw-ish state plus actions. Components and
// composables can talk to document/window; stores cannot.
files: ['src/stores/**/*.{ts,js}'],
rules: {
'no-restricted-globals': [
'error',
{ name: 'document', message: 'Stores must not touch the DOM. Move this to a component or composable.' },
{ name: 'window', message: 'Stores must not touch the DOM. Move this to a component or composable.' },
],
},
},
{
// Test files use vitest globals and partial-row fixture shapes.
files: ['tests/unit/**/*.{ts,js}', 'tests/**/*.test.{ts,js}'],
languageOptions: {
globals: {
...globals.node,
// Vitest globals
describe: 'readonly',
it: 'readonly',
test: 'readonly',
expect: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
beforeAll: 'readonly',
afterAll: 'readonly',
vi: 'readonly',
},
},
rules: {
'no-restricted-globals': 'off',
'no-restricted-syntax': 'off',
'@typescript-eslint/no-unused-vars': 'off',
},
},
);