Open History to see the last commit
1import js from '@eslint/js'
2import tsParser from '@typescript-eslint/parser'
3import tsPlugin from '@typescript-eslint/eslint-plugin'
4import globals from 'globals'
5import tanstackArchitecturePlugin from './eslint-rules/index.js'
6
7export default [
8 {
9 ignores: ['dist', 'node_modules'],
10 },
11 {
12 files: ['src/**/*.{ts,tsx}'],
13 languageOptions: {
14 ecmaVersion: 2022,
15 sourceType: 'module',
16 parser: tsParser,
17 parserOptions: {
18 ecmaFeatures: {
19 jsx: true,
20 },
21 },
22 globals: {
23 ...globals.browser,
24 ...globals.es2022,
25 },
26 },
27 plugins: {
28 '@typescript-eslint': tsPlugin,
29 'tanstack-architecture': tanstackArchitecturePlugin,
30 },
31 rules: {
32 ...js.configs.recommended.rules,
33 ...tsPlugin.configs.recommended.rules,
34 '@typescript-eslint/no-unused-vars': [
35 'error',
36 {
37 argsIgnorePattern: '^_',
38 varsIgnorePattern: '^_',
39 destructuredArrayIgnorePattern: '^_',
40 caughtErrorsIgnorePattern: '^_',
41 },
42 ],
43 },
44 },
45 {
46 files: ['src/features/**/*.{ts,tsx}'],
47 rules: {
48 // Features can read from collections, but write operations must go through actions.
49 'tanstack-architecture/no-direct-collection-mutations': 'error',
50 // Alternative (stricter) approach: ban collection imports in features entirely.
51 // This forces all reads/writes through query hooks and action modules.
52 // 'no-restricted-imports': [
53 // 'error',
54 // {
55 // patterns: [
56 // {
57 // group: ['@/db/collections/*'],
58 // message:
59 // 'Feature modules cannot import collections directly. Use query hooks and action modules.',
60 // },
61 // ],
62 // },
63 // ],
64 },
65 },
66]