@tiddlywiki/mws 0.0.21 → 0.1.1
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.
- package/README.md +42 -9
- package/dist/metafile-esm.json +1 -0
- package/dist/mws.d.ts +1 -0
- package/dist/mws.js +34710 -0
- package/dist/mws.js.map +1 -0
- package/editions/mws-docs/tiddlers/$__StoryList.tid +1 -2
- package/editions/mws-docs/tiddlers/2025-02-18 - User Management.md.meta +2 -2
- package/editions/mws-docs/tiddlers/2025-04-14 - client plugins /342/234/224/357/270/217.md" +31 -0
- package/editions/mws-docs/tiddlers/2025-04-14 - client plugins /342/234/224/357/270/217.md.meta" +5 -0
- package/editions/mws-docs/tiddlers/{2025-05-04.md → 2025-05-04 - event hooks /342/234/224/357/270/217.md" } +7 -1
- package/editions/mws-docs/tiddlers/2025-05-04 - event hooks /342/234/224/357/270/217.md.meta" +5 -0
- package/editions/mws-docs/tiddlers/{2025-05-06.md → 2025-05-06 - syncer design.md } +0 -4
- package/editions/mws-docs/tiddlers/2025-05-06 - syncer design.md.meta +5 -0
- package/editions/mws-docs/tiddlers/Allowed Methods.tid +8 -0
- package/editions/mws-docs/tiddlers/Application Access & Security.md +14 -84
- package/editions/mws-docs/tiddlers/Application Access & Security.md.meta +1 -1
- package/editions/mws-docs/tiddlers/Body Format.md +19 -0
- package/editions/mws-docs/tiddlers/Body Format.md.meta +4 -0
- package/editions/mws-docs/tiddlers/Checklists and Features.md +0 -3
- package/editions/mws-docs/tiddlers/Checklists and Features.md.meta +1 -1
- package/editions/mws-docs/tiddlers/Client Plugins.md +17 -0
- package/editions/mws-docs/tiddlers/Client Plugins.md.meta +5 -0
- package/editions/mws-docs/tiddlers/HTTP API.md +4 -3
- package/editions/mws-docs/tiddlers/HTTP API.md.meta +1 -1
- package/editions/mws-docs/tiddlers/HelloThere.tid +2 -2
- package/editions/mws-docs/tiddlers/Installation.tid +2 -3
- package/editions/mws-docs/tiddlers/MWS Architecture.tid +6 -1
- package/editions/mws-docs/tiddlers/Multi-user Trust.md +12 -0
- package/editions/mws-docs/tiddlers/Multi-user Trust.md.meta +5 -0
- package/editions/mws-docs/tiddlers/Notes.tid +5 -3
- package/editions/mws-docs/tiddlers/Oracle Attacks.md +29 -0
- package/editions/mws-docs/tiddlers/Oracle Attacks.md.meta +5 -0
- package/editions/mws-docs/tiddlers/Reference.md +1 -0
- package/editions/mws-docs/tiddlers/Reference.md.meta +1 -1
- package/editions/mws-docs/tiddlers/Request Handling.md +53 -0
- package/editions/mws-docs/tiddlers/Request Handling.md.meta +5 -0
- package/editions/mws-docs/tiddlers/Roadmap.tid +7 -0
- package/editions/mws-docs/tiddlers/Route Definers.md +206 -0
- package/editions/mws-docs/tiddlers/Route Definers.md.meta +5 -0
- package/editions/mws-docs/tiddlers/Security.md +75 -0
- package/editions/mws-docs/tiddlers/Security.md.meta +5 -0
- package/editions/mws-docs/tiddlers/Server Plugins.md +7 -0
- package/editions/mws-docs/tiddlers/Server Plugins.md.meta +5 -0
- package/editions/mws-docs/tiddlers/Startup Cache.md +28 -0
- package/editions/mws-docs/tiddlers/Startup Cache.md.meta +5 -0
- package/editions/mws-docs/tiddlers/TiddlerFields.md +5 -0
- package/editions/mws-docs/tiddlers/TiddlerFields.md.meta +4 -0
- package/editions/mws-docs/tiddlers/Usage.tid +2 -2
- package/editions/mws-docs/tiddlers/system/$__mws_cssvar-macro.tid +10 -0
- package/editions/mws-docs/tiddlers/system/$__palettes_MUI +143 -0
- package/editions/mws-docs/tiddlers/system/$__palettes_MUI.meta +7 -0
- package/editions/mws-docs/tiddlers/system/$__palettes_MUI_styles.css +567 -0
- package/editions/mws-docs/tiddlers/system/$__palettes_MUI_styles.css.meta +6 -0
- package/editions/mws-docs/tiddlers/system/$__theme.tid +6 -0
- package/editions/mws-docs/tiddlers/system/SplashScreen.tid +21 -0
- package/editions/mws-docs/tiddlers/system/StaticBanner.tid +1 -1
- package/editions/mws-docs/tiddlers/system/Styles.tid +13 -0
- package/editions/mws-docs/tiddlers/system/palette.tid +4 -1
- package/editions/mws-docs/tiddlers/system/sidebarlayout.tid +4 -1
- package/editions/mws-docs/tiddlers/x-mws-tiddler.md +35 -0
- package/editions/mws-docs/tiddlers/x-mws-tiddler.md.meta +5 -0
- package/mws.run.mjs +30 -0
- package/package.json +47 -36
- package/plugins/client/package-lock.json +46 -83
- package/plugins/client/package.json +1 -6
- package/plugins/client/plugin.info +2 -2
- package/plugins/client/src/fflate.d.ts +1501 -0
- package/plugins/client/src/multiwikiclientadaptor.ts +768 -317
- package/plugins/client/src/mws.d.ts +4 -0
- package/plugins/client/src/types.d.ts +3928 -0
- package/plugins/client/tiddlers/en-US.multids +3 -0
- package/plugins/client/tiddlers/status/SaveWikiButtonTemplate.tid +3 -0
- package/plugins/client/tiddlers/status/icon-cloud.tid +4 -0
- package/plugins/client/tiddlers/status/info-segment.tid +8 -0
- package/plugins/client/tiddlers/status/readonly-styles.tid +27 -0
- package/plugins/client/tiddlers/status/save-offline.tid +7 -0
- package/plugins/client/tiddlers/status/save-wiki-button.tid +26 -0
- package/plugins/client/tiddlers/status/styles.tid +44 -0
- package/plugins/client/tiddlers/status/syncer-actions-copy-logs.tid +6 -0
- package/plugins/client/tiddlers/status/syncer-actions-login-status.tid +9 -0
- package/plugins/client/tiddlers/status/syncer-actions-login.tid +8 -0
- package/plugins/client/tiddlers/status/syncer-actions-logout.tid +8 -0
- package/plugins/client/tiddlers/status/syncer-actions-refresh.tid +9 -0
- package/plugins/client/tiddlers/status/syncer-actions-save-snapshot.tid +9 -0
- package/plugins/client/tiddlers/status/tags-syncerdropdown.tid +2 -0
- package/plugins/client/tiddlers/syncer/multiwikiclientadaptor.js +640 -0
- package/plugins/client/tiddlers/syncer/syncer.js +831 -0
- package/plugins/client/tsconfig.json +19 -16
- package/plugins/filter-ast-to-sql/example-run-series.ts +146 -0
- package/plugins/server/SplashScreen.tid +150 -0
- package/plugins/server/fflate.js +9 -0
- package/plugins/server/plugin.info +8 -0
- package/plugins/server/readme +1 -0
- package/plugins/server/url-polyfill.js +294 -0
- package/prisma/client/client.d.ts +1 -0
- package/prisma/client/client.js +3 -0
- package/prisma/client/default.d.ts +1 -0
- package/prisma/client/default.js +3 -0
- package/prisma/client/edge.d.ts +1 -0
- package/prisma/client/edge.js +297 -0
- package/prisma/client/index-browser.js +275 -0
- package/prisma/client/index.d.ts +17770 -0
- package/prisma/client/index.js +324 -0
- package/prisma/client/package.json +173 -0
- package/prisma/client/query_engine_bg.js +811 -0
- package/prisma/client/query_engine_bg.wasm +0 -0
- package/prisma/client/runtime/edge-esm.js +10000 -0
- package/prisma/client/runtime/edge.js +10036 -0
- package/prisma/client/runtime/index-browser.d.ts +370 -0
- package/prisma/client/runtime/index-browser.js +2300 -0
- package/prisma/client/runtime/library.d.ts +3681 -0
- package/prisma/client/runtime/library.js +10604 -0
- package/prisma/client/runtime/react-native.js +10629 -0
- package/prisma/client/runtime/wasm-compiler-edge.js +11238 -0
- package/prisma/client/runtime/wasm-engine-edge.js +7801 -0
- package/prisma/client/schema.prisma +156 -0
- package/prisma/client/wasm-edge-light-loader.mjs +4 -0
- package/prisma/client/wasm-worker-loader.mjs +4 -0
- package/prisma/client/wasm.d.ts +1 -0
- package/prisma/client/wasm.js +304 -0
- package/prisma/global.ts +53 -0
- package/prisma/migrations/{20250406213424_init → 20250606001949_init}/migration.sql +46 -48
- package/prisma/migrations/20250613000526_remove_group/migration.sql +22 -0
- package/prisma/migrations/20250620014502_settings/migration.sql +5 -0
- package/prisma/migrations/20250707205229_recipes/migration.sql +20 -0
- package/prisma/migrations/migration_lock.toml +1 -1
- package/prisma/notes.md +1 -2
- package/prisma/schema.prisma +52 -49
- package/prisma/test.sqlite +0 -0
- package/prisma/test.sqlite-journal +0 -0
- package/public/react-admin/android-chrome-192x192.png +0 -0
- package/public/react-admin/android-chrome-512x512.png +0 -0
- package/public/react-admin/apple-touch-icon.png +0 -0
- package/{react-user-mgmt/public/esm-QKDFEP3B.js → public/react-admin/esm-L4WLVWJN.js} +1 -1
- package/public/react-admin/esm-L4WLVWJN.js.map +7 -0
- package/public/react-admin/esm-QMNGI3LF.js +3 -0
- package/public/react-admin/favicon-16x16.png +0 -0
- package/public/react-admin/favicon-32x32.png +0 -0
- package/public/react-admin/favicon.ico +0 -0
- package/public/react-admin/index.html +36 -0
- package/public/react-admin/main.js +268 -0
- package/public/react-admin/main.js.map +7 -0
- package/public/react-admin/site.webmanifest +20 -0
- package/public/react-admin/stats.json +1 -0
- package/scripts.mjs +134 -25
- package/dist/server.d.ts +0 -945
- package/dist/server.js +0 -20775
- package/dist/server.js.map +0 -1
- package/editions/mws-docs/tiddlers/2025-04-03 - Phases of Development.md +0 -64
- package/editions/mws-docs/tiddlers/2025-04-03 - Phases of Development.md.meta +0 -5
- package/editions/mws-docs/tiddlers/2025-04-13 - Plugins.md +0 -18
- package/editions/mws-docs/tiddlers/2025-04-13 - Plugins.md.meta +0 -5
- package/editions/mws-docs/tiddlers/2025-05-04.md.meta +0 -5
- package/editions/mws-docs/tiddlers/2025-05-06.md.meta +0 -5
- package/editions/mws-docs/tiddlers/Moduler Design.md +0 -29
- package/editions/mws-docs/tiddlers/Moduler Design.md.meta +0 -5
- package/editions/mws-docs/tiddlers/Request Server.md +0 -20
- package/editions/mws-docs/tiddlers/Request Server.md.meta +0 -5
- package/editions/mws-docs/tiddlers/system/$__palettes_MUI-Dark +0 -173
- package/editions/mws-docs/tiddlers/system/$__palettes_MUI-Dark.meta +0 -6
- package/editions/mws-docs/tiddlers/system/$__palettes_MUI-Light +0 -172
- package/editions/mws-docs/tiddlers/system/$__palettes_MUI-Light.meta +0 -6
- package/plugins/client/tiddlers/config-tiddlers-filter.tid +0 -2
- package/plugins/client/tiddlers/config-use-server-sent-events.tid +0 -2
- package/plugins/client/tiddlers/info-segment.tid +0 -8
- package/plugins/client/tiddlers/multiwikiclientadaptor.js +0 -444
- package/prisma/migrations/20250407002306_disconnect_user_tables/migration.sql +0 -52
- package/prisma/old-db.sql +0 -144
- package/react-user-mgmt/README.md +0 -50
- package/react-user-mgmt/eslint.config.js +0 -28
- package/react-user-mgmt/package-lock.json +0 -2738
- package/react-user-mgmt/package.json +0 -31
- package/react-user-mgmt/public/index.html +0 -1
- package/react-user-mgmt/public/main.js +0 -295
- package/react-user-mgmt/public/main.js.map +0 -7
- package/react-user-mgmt/public/stats.json +0 -1
- package/react-user-mgmt/tsconfig.json +0 -40
- package/react-user-mgmt/types.d.ts +0 -2
- package/tiddlywiki-types/boot/boot.d.ts +0 -378
- package/tiddlywiki-types/boot/bootprefix.d.ts +0 -110
- package/tiddlywiki-types/core/modules/filters.d.ts +0 -107
- package/tiddlywiki-types/core/modules/tiddler.d.ts +0 -47
- package/tiddlywiki-types/core/modules/wiki-bulkops.d.ts +0 -36
- package/tiddlywiki-types/core/modules/wiki.d.ts +0 -208
- package/tiddlywiki-types/index.d.ts +0 -7
- package/tiddlywiki-types/package.json +0 -3
- /package/plugins/client/tiddlers/{sidebarsegment.tid → status/sidebarsegment.tid} +0 -0
- /package/plugins/client/tiddlers/{GettingStarted.tid → syncer/GettingStarted.tid} +0 -0
- /package/plugins/client/tiddlers/{config-incoming-updates-filter.tid → syncer/config-incoming-updates-filter.tid} +0 -0
- /package/plugins/client/tiddlers/{readme.tid → syncer/readme.tid} +0 -0
- /package/{react-user-mgmt/public → public/react-admin}/chunk-YALWN5OT.js +0 -0
- /package/{react-user-mgmt/public → public/react-admin}/chunk-YALWN5OT.js.map +0 -0
- /package/{react-user-mgmt/public/esm-QKDFEP3B.js.map → public/react-admin/esm-QMNGI3LF.js.map} +0 -0
- /package/{react-user-mgmt/public → public/react-admin}/favicon.png +0 -0
- /package/{react-user-mgmt/public → public/react-admin}/missing-favicon.png +0 -0
- /package/{react-user-mgmt/public → public/react-admin}/motovun-jack.jpg +0 -0
- /package/{react-user-mgmt/public → public/react-admin}/mws-icon.png +0 -0
- /package/{react-user-mgmt/public → public/react-admin}/stats.css +0 -0
- /package/{react-user-mgmt/public → public/react-admin}/stats.html +0 -0
- /package/{react-user-mgmt/public → public/react-admin}/stats.js +0 -0
- /package/{react-user-mgmt/public → public/react-admin}/stats.svg +0 -0
- /package/{react-user-mgmt/public → public/react-admin}/vite.svg +0 -0
package/prisma/old-db.sql
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
-- Users table
|
|
3
|
-
CREATE TABLE IF NOT EXISTS users (
|
|
4
|
-
user_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
5
|
-
username TEXT UNIQUE NOT NULL,
|
|
6
|
-
email TEXT UNIQUE NOT NULL,
|
|
7
|
-
password TEXT NOT NULL,
|
|
8
|
-
created_at TEXT DEFAULT (datetime('now')),
|
|
9
|
-
last_login TEXT
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
-- User Session table
|
|
13
|
-
CREATE TABLE IF NOT EXISTS sessions (
|
|
14
|
-
user_id INTEGER NOT NULL,
|
|
15
|
-
session_id TEXT NOT NULL,
|
|
16
|
-
created_at TEXT NOT NULL,
|
|
17
|
-
last_accessed TEXT NOT NULL,
|
|
18
|
-
PRIMARY KEY (session_id),
|
|
19
|
-
FOREIGN KEY (user_id) REFERENCES users(user_id)
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
-- Groups table
|
|
23
|
-
CREATE TABLE IF NOT EXISTS groups (
|
|
24
|
-
group_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
25
|
-
group_name TEXT UNIQUE NOT NULL,
|
|
26
|
-
description TEXT
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
-- Roles table
|
|
30
|
-
CREATE TABLE IF NOT EXISTS roles (
|
|
31
|
-
role_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
32
|
-
role_name TEXT UNIQUE NOT NULL,
|
|
33
|
-
description TEXT
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
-- Permissions table
|
|
37
|
-
CREATE TABLE IF NOT EXISTS permissions (
|
|
38
|
-
permission_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
39
|
-
permission_name TEXT UNIQUE NOT NULL,
|
|
40
|
-
description TEXT
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
-- User-Group association table
|
|
44
|
-
CREATE TABLE IF NOT EXISTS user_groups (
|
|
45
|
-
user_id INTEGER,
|
|
46
|
-
group_id INTEGER,
|
|
47
|
-
PRIMARY KEY (user_id, group_id),
|
|
48
|
-
FOREIGN KEY (user_id) REFERENCES users(user_id),
|
|
49
|
-
FOREIGN KEY (group_id) REFERENCES groups(group_id)
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
-- User-Role association table
|
|
53
|
-
CREATE TABLE IF NOT EXISTS user_roles (
|
|
54
|
-
user_id INTEGER,
|
|
55
|
-
role_id INTEGER,
|
|
56
|
-
PRIMARY KEY (user_id, role_id),
|
|
57
|
-
FOREIGN KEY (user_id) REFERENCES users(user_id),
|
|
58
|
-
FOREIGN KEY (role_id) REFERENCES roles(role_id)
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
-- Group-Role association table
|
|
62
|
-
CREATE TABLE IF NOT EXISTS group_roles (
|
|
63
|
-
group_id INTEGER,
|
|
64
|
-
role_id INTEGER,
|
|
65
|
-
PRIMARY KEY (group_id, role_id),
|
|
66
|
-
FOREIGN KEY (group_id) REFERENCES groups(group_id),
|
|
67
|
-
FOREIGN KEY (role_id) REFERENCES roles(role_id)
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
-- Role-Permission association table
|
|
71
|
-
CREATE TABLE IF NOT EXISTS role_permissions (
|
|
72
|
-
role_id INTEGER,
|
|
73
|
-
permission_id INTEGER,
|
|
74
|
-
PRIMARY KEY (role_id, permission_id),
|
|
75
|
-
FOREIGN KEY (role_id) REFERENCES roles(role_id),
|
|
76
|
-
FOREIGN KEY (permission_id) REFERENCES permissions(permission_id)
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
-- Bags have names and access control settings
|
|
80
|
-
CREATE TABLE IF NOT EXISTS bags (
|
|
81
|
-
bag_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
82
|
-
bag_name TEXT UNIQUE NOT NULL,
|
|
83
|
-
accesscontrol TEXT NOT NULL,
|
|
84
|
-
description TEXT NOT NULL
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
-- Recipes have names...
|
|
88
|
-
CREATE TABLE IF NOT EXISTS recipes (
|
|
89
|
-
recipe_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
90
|
-
recipe_name TEXT UNIQUE NOT NULL,
|
|
91
|
-
description TEXT NOT NULL,
|
|
92
|
-
owner_id INTEGER,
|
|
93
|
-
FOREIGN KEY (owner_id) REFERENCES users(user_id)
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
-- ...and recipes also have an ordered list of bags
|
|
97
|
-
CREATE TABLE IF NOT EXISTS recipe_bags (
|
|
98
|
-
recipe_id INTEGER NOT NULL,
|
|
99
|
-
bag_id INTEGER NOT NULL,
|
|
100
|
-
position INTEGER NOT NULL,
|
|
101
|
-
FOREIGN KEY (recipe_id) REFERENCES recipes(recipe_id) ON UPDATE CASCADE ON DELETE CASCADE,
|
|
102
|
-
FOREIGN KEY (bag_id) REFERENCES bags(bag_id) ON UPDATE CASCADE ON DELETE CASCADE,
|
|
103
|
-
UNIQUE (recipe_id, bag_id)
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
-- Tiddlers are contained in bags and have titles
|
|
107
|
-
CREATE TABLE IF NOT EXISTS tiddlers (
|
|
108
|
-
tiddler_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
109
|
-
bag_id INTEGER NOT NULL,
|
|
110
|
-
title TEXT NOT NULL,
|
|
111
|
-
is_deleted BOOLEAN NOT NULL,
|
|
112
|
-
attachment_blob TEXT, -- null or the name of an attachment blob
|
|
113
|
-
FOREIGN KEY (bag_id) REFERENCES bags(bag_id) ON UPDATE CASCADE ON DELETE CASCADE,
|
|
114
|
-
UNIQUE (bag_id, title)
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
-- Tiddlers also have unordered lists of fields, each of which has a name and associated value
|
|
118
|
-
CREATE TABLE IF NOT EXISTS fields (
|
|
119
|
-
tiddler_id INTEGER,
|
|
120
|
-
field_name TEXT NOT NULL,
|
|
121
|
-
field_value TEXT NOT NULL,
|
|
122
|
-
FOREIGN KEY (tiddler_id) REFERENCES tiddlers(tiddler_id) ON UPDATE CASCADE ON DELETE CASCADE,
|
|
123
|
-
UNIQUE (tiddler_id, field_name)
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
-- ACL table (using bag/recipe ids directly)
|
|
127
|
-
CREATE TABLE IF NOT EXISTS acl (
|
|
128
|
-
acl_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
129
|
-
entity_name TEXT NOT NULL,
|
|
130
|
-
entity_type TEXT NOT NULL CHECK (entity_type IN ('bag', 'recipe')),
|
|
131
|
-
role_id INTEGER,
|
|
132
|
-
permission_id INTEGER,
|
|
133
|
-
FOREIGN KEY (role_id) REFERENCES roles(role_id),
|
|
134
|
-
FOREIGN KEY (permission_id) REFERENCES permissions(permission_id)
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
-- Indexes for performance (we can add more as needed based on query patterns)
|
|
138
|
-
CREATE INDEX IF NOT EXISTS idx_tiddlers_bag_id ON tiddlers(bag_id);
|
|
139
|
-
|
|
140
|
-
CREATE INDEX IF NOT EXISTS idx_fields_tiddler_id ON fields(tiddler_id);
|
|
141
|
-
|
|
142
|
-
CREATE INDEX IF NOT EXISTS idx_recipe_bags_recipe_id ON recipe_bags(recipe_id);
|
|
143
|
-
|
|
144
|
-
CREATE INDEX IF NOT EXISTS idx_acl_entity_id ON acl(entity_name);
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# React + TypeScript + Vite
|
|
2
|
-
|
|
3
|
-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
-
|
|
5
|
-
Currently, two official plugins are available:
|
|
6
|
-
|
|
7
|
-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
-
|
|
10
|
-
## Expanding the ESLint configuration
|
|
11
|
-
|
|
12
|
-
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
|
|
13
|
-
|
|
14
|
-
- Configure the top-level `parserOptions` property like this:
|
|
15
|
-
|
|
16
|
-
```js
|
|
17
|
-
export default tseslint.config({
|
|
18
|
-
languageOptions: {
|
|
19
|
-
// other options...
|
|
20
|
-
parserOptions: {
|
|
21
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
22
|
-
tsconfigRootDir: import.meta.dirname,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
})
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
|
|
29
|
-
- Optionally add `...tseslint.configs.stylisticTypeChecked`
|
|
30
|
-
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
|
|
31
|
-
|
|
32
|
-
```js
|
|
33
|
-
// eslint.config.js
|
|
34
|
-
import react from 'eslint-plugin-react'
|
|
35
|
-
|
|
36
|
-
export default tseslint.config({
|
|
37
|
-
// Set the react version
|
|
38
|
-
settings: { react: { version: '18.3' } },
|
|
39
|
-
plugins: {
|
|
40
|
-
// Add the react plugin
|
|
41
|
-
react,
|
|
42
|
-
},
|
|
43
|
-
rules: {
|
|
44
|
-
// other rules...
|
|
45
|
-
// Enable its recommended rules
|
|
46
|
-
...react.configs.recommended.rules,
|
|
47
|
-
...react.configs['jsx-runtime'].rules,
|
|
48
|
-
},
|
|
49
|
-
})
|
|
50
|
-
```
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js'
|
|
2
|
-
import globals from 'globals'
|
|
3
|
-
import reactHooks from 'eslint-plugin-react-hooks'
|
|
4
|
-
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
5
|
-
import tseslint from 'typescript-eslint'
|
|
6
|
-
|
|
7
|
-
export default tseslint.config(
|
|
8
|
-
{ ignores: ['dist'] },
|
|
9
|
-
{
|
|
10
|
-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
11
|
-
files: ['**/*.{ts,tsx}'],
|
|
12
|
-
languageOptions: {
|
|
13
|
-
ecmaVersion: 2020,
|
|
14
|
-
globals: globals.browser,
|
|
15
|
-
},
|
|
16
|
-
plugins: {
|
|
17
|
-
'react-hooks': reactHooks,
|
|
18
|
-
'react-refresh': reactRefresh,
|
|
19
|
-
},
|
|
20
|
-
rules: {
|
|
21
|
-
...reactHooks.configs.recommended.rules,
|
|
22
|
-
'react-refresh/only-export-components': [
|
|
23
|
-
'warn',
|
|
24
|
-
{ allowConstantExport: true },
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
)
|