eslint-plugin-use-agnostic 0.3.0 → 0.3.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.
|
@@ -87,6 +87,9 @@ const makeIntroForSpecificViolationMessage = (
|
|
|
87
87
|
importedFileEffectiveDirective
|
|
88
88
|
);
|
|
89
89
|
|
|
90
|
+
const SUGGEST_USE_AGNOSTIC =
|
|
91
|
+
"If the module you're trying to import does not possess any server-side code however, please mark it with the 'use agnostic' directive to make it compatible across all environments.";
|
|
92
|
+
|
|
90
93
|
export const effectiveDirectives_BlockedImports = Object.freeze({
|
|
91
94
|
[USE_SERVER_LOGICS]: [
|
|
92
95
|
// USE_SERVER_LOGICS allowed, because Server Logics can compose with one another.
|
|
@@ -163,14 +166,16 @@ export const effectiveDirectives_BlockedImports = Object.freeze({
|
|
|
163
166
|
message: `${makeIntroForSpecificViolationMessage(
|
|
164
167
|
USE_CLIENT_LOGICS,
|
|
165
168
|
USE_SERVER_LOGICS
|
|
166
|
-
)} Server logic should never leak to the client
|
|
169
|
+
)} Server logic should never leak to the client.
|
|
170
|
+
${SUGGEST_USE_AGNOSTIC}`,
|
|
167
171
|
},
|
|
168
172
|
{
|
|
169
173
|
blockedImport: USE_SERVER_COMPONENTS,
|
|
170
174
|
message: `${makeIntroForSpecificViolationMessage(
|
|
171
175
|
USE_CLIENT_LOGICS,
|
|
172
176
|
USE_SERVER_COMPONENTS
|
|
173
|
-
)} Server Components cannot be thinkered with on the client
|
|
177
|
+
)} Server Components cannot be thinkered with on the client.
|
|
178
|
+
${SUGGEST_USE_AGNOSTIC}`,
|
|
174
179
|
},
|
|
175
180
|
// USE_SERVER_FUNCTIONS allowed, because it is technically feasible to tinker with a Client Component within a Client Logics Module and attach to said Client Component a Server Function to be triggered on the client.
|
|
176
181
|
// USE_CLIENT_LOGICS allowed, because Client Logics can compose with one another.
|
|
@@ -184,14 +189,16 @@ export const effectiveDirectives_BlockedImports = Object.freeze({
|
|
|
184
189
|
message: `${makeIntroForSpecificViolationMessage(
|
|
185
190
|
USE_CLIENT_COMPONENTS,
|
|
186
191
|
USE_SERVER_LOGICS
|
|
187
|
-
)} Server logic should never leak to the client
|
|
192
|
+
)} Server logic should never leak to the client.
|
|
193
|
+
${SUGGEST_USE_AGNOSTIC}`,
|
|
188
194
|
},
|
|
189
195
|
{
|
|
190
196
|
blockedImport: USE_SERVER_COMPONENTS,
|
|
191
197
|
message: `${makeIntroForSpecificViolationMessage(
|
|
192
198
|
USE_CLIENT_COMPONENTS,
|
|
193
199
|
USE_SERVER_COMPONENTS
|
|
194
|
-
)} Server Components may only pass through Client Components through the children prop within Server Components Modules
|
|
200
|
+
)} Server Components may only pass through Client Components through the children prop within Server Components Modules.
|
|
201
|
+
${SUGGEST_USE_AGNOSTIC}`,
|
|
195
202
|
},
|
|
196
203
|
// USE_SERVER_FUNCTIONS allowed, because Server Functions are specifically triggered by Client Components.
|
|
197
204
|
// USE_CLIENT_LOGICS allowed, because logic from the client can safely support Client Components.
|
|
@@ -205,14 +212,16 @@ export const effectiveDirectives_BlockedImports = Object.freeze({
|
|
|
205
212
|
message: `${makeIntroForSpecificViolationMessage(
|
|
206
213
|
USE_AGNOSTIC_LOGICS,
|
|
207
214
|
USE_SERVER_LOGICS
|
|
208
|
-
)} Server Logic cannot run in both the server and the client
|
|
215
|
+
)} Server Logic cannot run in both the server and the client.
|
|
216
|
+
${SUGGEST_USE_AGNOSTIC}`,
|
|
209
217
|
},
|
|
210
218
|
{
|
|
211
219
|
blockedImport: USE_SERVER_COMPONENTS,
|
|
212
220
|
message: `${makeIntroForSpecificViolationMessage(
|
|
213
221
|
USE_AGNOSTIC_LOGICS,
|
|
214
222
|
USE_SERVER_COMPONENTS
|
|
215
|
-
)} Server Components cannot be tinkered with on both the server and the client
|
|
223
|
+
)} Server Components cannot be tinkered with on both the server and the client.
|
|
224
|
+
${SUGGEST_USE_AGNOSTIC}`,
|
|
216
225
|
},
|
|
217
226
|
{
|
|
218
227
|
blockedImport: USE_SERVER_FUNCTIONS,
|
|
@@ -244,14 +253,16 @@ export const effectiveDirectives_BlockedImports = Object.freeze({
|
|
|
244
253
|
message: `${makeIntroForSpecificViolationMessage(
|
|
245
254
|
USE_AGNOSTIC_COMPONENTS,
|
|
246
255
|
USE_SERVER_LOGICS
|
|
247
|
-
)} Server Logic cannot run in both the server and the client
|
|
256
|
+
)} Server Logic cannot run in both the server and the client.
|
|
257
|
+
${SUGGEST_USE_AGNOSTIC}`,
|
|
248
258
|
},
|
|
249
259
|
{
|
|
250
260
|
blockedImport: USE_SERVER_COMPONENTS,
|
|
251
261
|
message: `${makeIntroForSpecificViolationMessage(
|
|
252
262
|
USE_AGNOSTIC_COMPONENTS,
|
|
253
263
|
USE_SERVER_COMPONENTS
|
|
254
|
-
)} Unlike Client Components, Server Components cannot make silos of their own once on the client, and can therefore not be executed from the client
|
|
264
|
+
)} Unlike Client Components, Server Components cannot make silos of their own once on the client, and can therefore not be executed from the client.
|
|
265
|
+
${SUGGEST_USE_AGNOSTIC}`,
|
|
255
266
|
},
|
|
256
267
|
// USE_SERVER_FUNCTIONS allowed, because as Agnostic Components Modules can import Client Components, they are able to pass them Server Functions as props as well.
|
|
257
268
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-use-agnostic",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Highlights problematic server-client imports in projects made with the Fullstack React Architecture.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
"next-js",
|
|
12
12
|
"remix",
|
|
13
13
|
"reactrouter",
|
|
14
|
-
"react-router"
|
|
14
|
+
"react-router",
|
|
15
|
+
"fullstack",
|
|
16
|
+
"server",
|
|
17
|
+
"client",
|
|
18
|
+
"agnostic"
|
|
15
19
|
],
|
|
16
20
|
"license": "MIT",
|
|
17
21
|
"author": "Luther Tchofo Safo <luther@tchofo-safo-portfolio.me>",
|