@marktiderman/genesis-cli 1.19.0 → 1.20.0
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 +70 -1
- package/dist/cli.js +593 -72
- package/dist/cli.js.map +1 -1
- package/dist/doctor.d.ts +1 -1
- package/dist/doctor.js +236 -8
- package/dist/doctor.js.map +1 -1
- package/dist/eslint.cjs +99 -0
- package/dist/eslint.cjs.map +1 -0
- package/dist/eslint.d.cts +68 -0
- package/dist/eslint.d.ts +68 -0
- package/dist/eslint.js +72 -0
- package/dist/eslint.js.map +1 -0
- package/dist/genesis-catalog.json +10 -7
- package/dist/index.js +244 -16
- package/dist/index.js.map +1 -1
- package/dist/starter/README.md +9 -0
- package/dist/starter/eslint.config.js +8 -1
- package/dist/starter/nativewind-env.d.ts +1 -0
- package/dist/starter/package.json +1 -0
- package/dist/vite.js +236 -8
- package/dist/vite.js.map +1 -1
- package/package.json +18 -4
package/dist/eslint.cjs
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var module$1 = require('module');
|
|
4
|
+
var path = require('path');
|
|
5
|
+
var url = require('url');
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n.default = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
26
|
+
|
|
27
|
+
// ../../node_modules/tsup/assets/cjs_shims.js
|
|
28
|
+
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
|
|
29
|
+
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
30
|
+
var TEST_FILES = ["**/__tests__/**/*.{js,jsx,ts,tsx}", "**/*.test.{js,jsx,ts,tsx}"];
|
|
31
|
+
var RNTL_ASYNC_CALLS = ["render", "renderHook", "renderRouter", "renderApp", "act"];
|
|
32
|
+
var TESTING_LIBRARY_PLUGIN = "eslint-plugin-testing-library";
|
|
33
|
+
var here = typeof __filename === "string" ? __filename : url.fileURLToPath(importMetaUrl);
|
|
34
|
+
function loadTestingLibrary() {
|
|
35
|
+
const from = [path__namespace.join(process.cwd(), "package.json"), here];
|
|
36
|
+
for (const base of from) {
|
|
37
|
+
try {
|
|
38
|
+
const mod = module$1.createRequire(base)(TESTING_LIBRARY_PLUGIN);
|
|
39
|
+
return mod && typeof mod === "object" && "rules" in mod ? mod : mod.default ?? mod;
|
|
40
|
+
} catch {
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
throw new Error(
|
|
44
|
+
`@marktiderman/genesis-cli/eslint: Genesis's testing rules need ${TESTING_LIBRARY_PLUGIN}. Install it in the app's devDependencies (pnpm add -D ${TESTING_LIBRARY_PLUGIN}), or pass it as { testingLibrary: require("${TESTING_LIBRARY_PLUGIN}") }.`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
var escape = (name) => name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
48
|
+
function unawaited(message, ...callees) {
|
|
49
|
+
return callees.flatMap((callee) => [
|
|
50
|
+
{ selector: `ExpressionStatement > CallExpression${callee}`, message },
|
|
51
|
+
{ selector: `VariableDeclarator > CallExpression${callee}`, message },
|
|
52
|
+
{ selector: `AssignmentExpression > CallExpression${callee}`, message }
|
|
53
|
+
]);
|
|
54
|
+
}
|
|
55
|
+
function rntlAwaitSelectors(options = {}) {
|
|
56
|
+
const calls = [.../* @__PURE__ */ new Set([...RNTL_ASYNC_CALLS, ...options.renders ?? []])].map(escape).join("|");
|
|
57
|
+
return [
|
|
58
|
+
...unawaited(
|
|
59
|
+
"React Native Testing Library 14's render calls (render, renderHook, renderRouter, renderApp) and act return promises: await them.",
|
|
60
|
+
`[callee.name=/^(${calls})$/]`
|
|
61
|
+
),
|
|
62
|
+
...unawaited(
|
|
63
|
+
"React Native Testing Library 14's rerender and unmount return promises: await them.",
|
|
64
|
+
"[callee.property.name=/^(rerender|unmount)$/]",
|
|
65
|
+
"[callee.name=/^(rerender|unmount)$/]"
|
|
66
|
+
),
|
|
67
|
+
...unawaited(
|
|
68
|
+
"userEvent's events return promises: await them.",
|
|
69
|
+
'[callee.object.type="CallExpression"][callee.object.callee.object.name="userEvent"][callee.object.callee.property.name="setup"]'
|
|
70
|
+
)
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
function testing(options = {}) {
|
|
74
|
+
return [
|
|
75
|
+
{
|
|
76
|
+
name: "genesis/testing",
|
|
77
|
+
files: options.testFiles ?? TEST_FILES,
|
|
78
|
+
plugins: { "testing-library": options.testingLibrary ?? loadTestingLibrary() },
|
|
79
|
+
rules: {
|
|
80
|
+
"testing-library/await-async-events": ["error", { eventModule: ["fireEvent", "userEvent"] }],
|
|
81
|
+
"no-restricted-syntax": ["error", ...rntlAwaitSelectors(options)]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
function genesis(platform, options = {}) {
|
|
87
|
+
if (platform === "native") return [...testing(options)];
|
|
88
|
+
if (platform === "web") return [];
|
|
89
|
+
throw new Error(`@marktiderman/genesis-cli/eslint: genesis("${String(platform)}"): the platform is "native" or "web".`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
exports.RNTL_ASYNC_CALLS = RNTL_ASYNC_CALLS;
|
|
93
|
+
exports.TESTING_LIBRARY_PLUGIN = TESTING_LIBRARY_PLUGIN;
|
|
94
|
+
exports.TEST_FILES = TEST_FILES;
|
|
95
|
+
exports.genesis = genesis;
|
|
96
|
+
exports.rntlAwaitSelectors = rntlAwaitSelectors;
|
|
97
|
+
exports.testing = testing;
|
|
98
|
+
//# sourceMappingURL=eslint.cjs.map
|
|
99
|
+
//# sourceMappingURL=eslint.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/tsup/assets/cjs_shims.js","../src/eslint.ts"],"names":["fileURLToPath","path","createRequire"],"mappings":"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","file":"eslint.cjs","sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","/**\n * `@marktiderman/genesis-cli/eslint`: Genesis's lint rules for apps, as ESLint flat-config pieces.\n * An app spreads them into its `eslint.config.js`, and `genesis upgrade` delivers new and changed\n * rules with the CLI, so the app's config never has to change for them:\n *\n * ```js\n * const { genesis } = require(\"@marktiderman/genesis-cli/eslint\");\n * module.exports = defineConfig([expoConfig, ...genesis(\"native\")]);\n * ```\n *\n * Built for `require` and `import` alike. Plugins are loaded only when a piece that needs them is\n * built, never on import: `testing` needs `eslint-plugin-testing-library` (an optional peer\n * dependency of genesis-cli; install it in the app's devDependencies).\n */\nimport { createRequire } from \"node:module\";\nimport * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n/** One flat-config object, as much of ESLint's `Linter.Config` as the pieces use. */\nexport interface GenesisLintConfig {\n name?: string;\n files?: string[];\n ignores?: string[];\n plugins?: Record<string, unknown>;\n rules?: Record<string, unknown>;\n}\n\n/** The platform an app is built for. */\nexport type GenesisPlatform = \"native\" | \"web\";\n\nexport interface GenesisLintOptions {\n /**\n * The test files the testing rules cover. Default: files under `__tests__/` and\n * `*.test.*` files ({@link TEST_FILES}).\n */\n testFiles?: string[];\n /**\n * The app's own helpers that wrap React Native Testing Library's `render` (and so return a\n * promise), checked like `render`. `renderApp` (the starter's helper) and expo-router's\n * `renderRouter` are always checked.\n */\n renders?: string[];\n /**\n * `eslint-plugin-testing-library`, when the app loads it itself (say, to configure more of its\n * rules). Otherwise it is resolved from the app (the working directory), then from genesis-cli.\n */\n testingLibrary?: unknown;\n}\n\n/** The test files the testing rules cover by default. */\nexport const TEST_FILES = [\"**/__tests__/**/*.{js,jsx,ts,tsx}\", \"**/*.test.{js,jsx,ts,tsx}\"];\n\n/** What React Native Testing Library 14 made async, beyond fireEvent: render calls and act. */\nexport const RNTL_ASYNC_CALLS = [\"render\", \"renderHook\", \"renderRouter\", \"renderApp\", \"act\"] as const;\n\n/** The plugin's package name, for the error when it isn't installed. */\nexport const TESTING_LIBRARY_PLUGIN = \"eslint-plugin-testing-library\";\n\nconst here = typeof __filename === \"string\" ? __filename : fileURLToPath(import.meta.url);\n\n/** `eslint-plugin-testing-library`, from the app first (the copy its own config would load), then from genesis-cli. */\nfunction loadTestingLibrary(): unknown {\n const from = [path.join(process.cwd(), \"package.json\"), here];\n for (const base of from) {\n try {\n const mod = createRequire(base)(TESTING_LIBRARY_PLUGIN) as { default?: unknown };\n return mod && typeof mod === \"object\" && \"rules\" in mod ? mod : (mod.default ?? mod);\n } catch {\n // try the next place\n }\n }\n throw new Error(\n `@marktiderman/genesis-cli/eslint: Genesis's testing rules need ${TESTING_LIBRARY_PLUGIN}. Install it in the app's devDependencies (pnpm add -D ${TESTING_LIBRARY_PLUGIN}), or pass it as { testingLibrary: require(\"${TESTING_LIBRARY_PLUGIN}\") }.`,\n );\n}\n\nconst escape = (name: string) => name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\n/** One `no-restricted-syntax` entry per place a call's promise is dropped: a statement, a declaration, an assignment. */\nfunction unawaited(message: string, ...callees: string[]): { selector: string; message: string }[] {\n return callees.flatMap((callee) => [\n { selector: `ExpressionStatement > CallExpression${callee}`, message },\n { selector: `VariableDeclarator > CallExpression${callee}`, message },\n { selector: `AssignmentExpression > CallExpression${callee}`, message },\n ]);\n}\n\n/**\n * The `no-restricted-syntax` entries for React Native Testing Library 14's async calls: render,\n * renderHook, renderRouter, renderApp (plus `renders`) and act; rerender and unmount, as methods\n * and destructured; and a chained `userEvent.setup().press(…)`, which await-async-events doesn't\n * follow. Each flags a call whose promise is dropped (a statement, a declaration, an assignment).\n * Exported so an app with its own `no-restricted-syntax` for test files can keep both.\n */\nexport function rntlAwaitSelectors(options: Pick<GenesisLintOptions, \"renders\"> = {}): { selector: string; message: string }[] {\n const calls = [...new Set([...RNTL_ASYNC_CALLS, ...(options.renders ?? [])])].map(escape).join(\"|\");\n return [\n ...unawaited(\n \"React Native Testing Library 14's render calls (render, renderHook, renderRouter, renderApp) and act return promises: await them.\",\n `[callee.name=/^(${calls})$/]`,\n ),\n ...unawaited(\n \"React Native Testing Library 14's rerender and unmount return promises: await them.\",\n \"[callee.property.name=/^(rerender|unmount)$/]\",\n \"[callee.name=/^(rerender|unmount)$/]\",\n ),\n ...unawaited(\n \"userEvent's events return promises: await them.\",\n '[callee.object.type=\"CallExpression\"][callee.object.callee.object.name=\"userEvent\"][callee.object.callee.property.name=\"setup\"]',\n ),\n ];\n}\n\n/**\n * React Native Testing Library 14's await rules, for test files. RNTL 14 made render, renderHook,\n * fireEvent, act, rerender and unmount async; left unawaited, a test reads the screen before React\n * has updated it, and React logs \"overlapping act() calls\".\n *\n * - `testing-library/await-async-events` with `eventModule: [\"fireEvent\", \"userEvent\"]` (its\n * React preset assumes fireEvent is sync, so only this rule is turned on);\n * - `no-restricted-syntax` for what the plugin has no rule for ({@link rntlAwaitSelectors}).\n *\n * The piece sets `no-restricted-syntax` for test files, so an app's own setting of that rule for\n * the same files, later in the array, replaces it: spread `rntlAwaitSelectors()` into yours.\n */\nexport function testing(options: GenesisLintOptions = {}): GenesisLintConfig[] {\n return [\n {\n name: \"genesis/testing\",\n files: options.testFiles ?? TEST_FILES,\n plugins: { \"testing-library\": options.testingLibrary ?? loadTestingLibrary() },\n rules: {\n \"testing-library/await-async-events\": [\"error\", { eventModule: [\"fireEvent\", \"userEvent\"] }],\n \"no-restricted-syntax\": [\"error\", ...rntlAwaitSelectors(options)],\n },\n },\n ];\n}\n\n/**\n * Every Genesis lint piece for the platform, so rules a release adds arrive without an app edit:\n *\n * - `\"native\"`: {@link testing}.\n * - `\"web\"`: none yet. Testing Library for React keeps `render` and `fireEvent` synchronous, so the\n * RNTL await rules don't apply; spreading it now means web rules arrive when Genesis has some.\n */\nexport function genesis(platform: GenesisPlatform, options: GenesisLintOptions = {}): GenesisLintConfig[] {\n if (platform === \"native\") return [...testing(options)];\n if (platform === \"web\") return [];\n throw new Error(`@marktiderman/genesis-cli/eslint: genesis(\"${String(platform)}\"): the platform is \"native\" or \"web\".`);\n}\n"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** One flat-config object, as much of ESLint's `Linter.Config` as the pieces use. */
|
|
2
|
+
interface GenesisLintConfig {
|
|
3
|
+
name?: string;
|
|
4
|
+
files?: string[];
|
|
5
|
+
ignores?: string[];
|
|
6
|
+
plugins?: Record<string, unknown>;
|
|
7
|
+
rules?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
/** The platform an app is built for. */
|
|
10
|
+
type GenesisPlatform = "native" | "web";
|
|
11
|
+
interface GenesisLintOptions {
|
|
12
|
+
/**
|
|
13
|
+
* The test files the testing rules cover. Default: files under `__tests__/` and
|
|
14
|
+
* `*.test.*` files ({@link TEST_FILES}).
|
|
15
|
+
*/
|
|
16
|
+
testFiles?: string[];
|
|
17
|
+
/**
|
|
18
|
+
* The app's own helpers that wrap React Native Testing Library's `render` (and so return a
|
|
19
|
+
* promise), checked like `render`. `renderApp` (the starter's helper) and expo-router's
|
|
20
|
+
* `renderRouter` are always checked.
|
|
21
|
+
*/
|
|
22
|
+
renders?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* `eslint-plugin-testing-library`, when the app loads it itself (say, to configure more of its
|
|
25
|
+
* rules). Otherwise it is resolved from the app (the working directory), then from genesis-cli.
|
|
26
|
+
*/
|
|
27
|
+
testingLibrary?: unknown;
|
|
28
|
+
}
|
|
29
|
+
/** The test files the testing rules cover by default. */
|
|
30
|
+
declare const TEST_FILES: string[];
|
|
31
|
+
/** What React Native Testing Library 14 made async, beyond fireEvent: render calls and act. */
|
|
32
|
+
declare const RNTL_ASYNC_CALLS: readonly ["render", "renderHook", "renderRouter", "renderApp", "act"];
|
|
33
|
+
/** The plugin's package name, for the error when it isn't installed. */
|
|
34
|
+
declare const TESTING_LIBRARY_PLUGIN = "eslint-plugin-testing-library";
|
|
35
|
+
/**
|
|
36
|
+
* The `no-restricted-syntax` entries for React Native Testing Library 14's async calls: render,
|
|
37
|
+
* renderHook, renderRouter, renderApp (plus `renders`) and act; rerender and unmount, as methods
|
|
38
|
+
* and destructured; and a chained `userEvent.setup().press(…)`, which await-async-events doesn't
|
|
39
|
+
* follow. Each flags a call whose promise is dropped (a statement, a declaration, an assignment).
|
|
40
|
+
* Exported so an app with its own `no-restricted-syntax` for test files can keep both.
|
|
41
|
+
*/
|
|
42
|
+
declare function rntlAwaitSelectors(options?: Pick<GenesisLintOptions, "renders">): {
|
|
43
|
+
selector: string;
|
|
44
|
+
message: string;
|
|
45
|
+
}[];
|
|
46
|
+
/**
|
|
47
|
+
* React Native Testing Library 14's await rules, for test files. RNTL 14 made render, renderHook,
|
|
48
|
+
* fireEvent, act, rerender and unmount async; left unawaited, a test reads the screen before React
|
|
49
|
+
* has updated it, and React logs "overlapping act() calls".
|
|
50
|
+
*
|
|
51
|
+
* - `testing-library/await-async-events` with `eventModule: ["fireEvent", "userEvent"]` (its
|
|
52
|
+
* React preset assumes fireEvent is sync, so only this rule is turned on);
|
|
53
|
+
* - `no-restricted-syntax` for what the plugin has no rule for ({@link rntlAwaitSelectors}).
|
|
54
|
+
*
|
|
55
|
+
* The piece sets `no-restricted-syntax` for test files, so an app's own setting of that rule for
|
|
56
|
+
* the same files, later in the array, replaces it: spread `rntlAwaitSelectors()` into yours.
|
|
57
|
+
*/
|
|
58
|
+
declare function testing(options?: GenesisLintOptions): GenesisLintConfig[];
|
|
59
|
+
/**
|
|
60
|
+
* Every Genesis lint piece for the platform, so rules a release adds arrive without an app edit:
|
|
61
|
+
*
|
|
62
|
+
* - `"native"`: {@link testing}.
|
|
63
|
+
* - `"web"`: none yet. Testing Library for React keeps `render` and `fireEvent` synchronous, so the
|
|
64
|
+
* RNTL await rules don't apply; spreading it now means web rules arrive when Genesis has some.
|
|
65
|
+
*/
|
|
66
|
+
declare function genesis(platform: GenesisPlatform, options?: GenesisLintOptions): GenesisLintConfig[];
|
|
67
|
+
|
|
68
|
+
export { type GenesisLintConfig, type GenesisLintOptions, type GenesisPlatform, RNTL_ASYNC_CALLS, TESTING_LIBRARY_PLUGIN, TEST_FILES, genesis, rntlAwaitSelectors, testing };
|
package/dist/eslint.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** One flat-config object, as much of ESLint's `Linter.Config` as the pieces use. */
|
|
2
|
+
interface GenesisLintConfig {
|
|
3
|
+
name?: string;
|
|
4
|
+
files?: string[];
|
|
5
|
+
ignores?: string[];
|
|
6
|
+
plugins?: Record<string, unknown>;
|
|
7
|
+
rules?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
/** The platform an app is built for. */
|
|
10
|
+
type GenesisPlatform = "native" | "web";
|
|
11
|
+
interface GenesisLintOptions {
|
|
12
|
+
/**
|
|
13
|
+
* The test files the testing rules cover. Default: files under `__tests__/` and
|
|
14
|
+
* `*.test.*` files ({@link TEST_FILES}).
|
|
15
|
+
*/
|
|
16
|
+
testFiles?: string[];
|
|
17
|
+
/**
|
|
18
|
+
* The app's own helpers that wrap React Native Testing Library's `render` (and so return a
|
|
19
|
+
* promise), checked like `render`. `renderApp` (the starter's helper) and expo-router's
|
|
20
|
+
* `renderRouter` are always checked.
|
|
21
|
+
*/
|
|
22
|
+
renders?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* `eslint-plugin-testing-library`, when the app loads it itself (say, to configure more of its
|
|
25
|
+
* rules). Otherwise it is resolved from the app (the working directory), then from genesis-cli.
|
|
26
|
+
*/
|
|
27
|
+
testingLibrary?: unknown;
|
|
28
|
+
}
|
|
29
|
+
/** The test files the testing rules cover by default. */
|
|
30
|
+
declare const TEST_FILES: string[];
|
|
31
|
+
/** What React Native Testing Library 14 made async, beyond fireEvent: render calls and act. */
|
|
32
|
+
declare const RNTL_ASYNC_CALLS: readonly ["render", "renderHook", "renderRouter", "renderApp", "act"];
|
|
33
|
+
/** The plugin's package name, for the error when it isn't installed. */
|
|
34
|
+
declare const TESTING_LIBRARY_PLUGIN = "eslint-plugin-testing-library";
|
|
35
|
+
/**
|
|
36
|
+
* The `no-restricted-syntax` entries for React Native Testing Library 14's async calls: render,
|
|
37
|
+
* renderHook, renderRouter, renderApp (plus `renders`) and act; rerender and unmount, as methods
|
|
38
|
+
* and destructured; and a chained `userEvent.setup().press(…)`, which await-async-events doesn't
|
|
39
|
+
* follow. Each flags a call whose promise is dropped (a statement, a declaration, an assignment).
|
|
40
|
+
* Exported so an app with its own `no-restricted-syntax` for test files can keep both.
|
|
41
|
+
*/
|
|
42
|
+
declare function rntlAwaitSelectors(options?: Pick<GenesisLintOptions, "renders">): {
|
|
43
|
+
selector: string;
|
|
44
|
+
message: string;
|
|
45
|
+
}[];
|
|
46
|
+
/**
|
|
47
|
+
* React Native Testing Library 14's await rules, for test files. RNTL 14 made render, renderHook,
|
|
48
|
+
* fireEvent, act, rerender and unmount async; left unawaited, a test reads the screen before React
|
|
49
|
+
* has updated it, and React logs "overlapping act() calls".
|
|
50
|
+
*
|
|
51
|
+
* - `testing-library/await-async-events` with `eventModule: ["fireEvent", "userEvent"]` (its
|
|
52
|
+
* React preset assumes fireEvent is sync, so only this rule is turned on);
|
|
53
|
+
* - `no-restricted-syntax` for what the plugin has no rule for ({@link rntlAwaitSelectors}).
|
|
54
|
+
*
|
|
55
|
+
* The piece sets `no-restricted-syntax` for test files, so an app's own setting of that rule for
|
|
56
|
+
* the same files, later in the array, replaces it: spread `rntlAwaitSelectors()` into yours.
|
|
57
|
+
*/
|
|
58
|
+
declare function testing(options?: GenesisLintOptions): GenesisLintConfig[];
|
|
59
|
+
/**
|
|
60
|
+
* Every Genesis lint piece for the platform, so rules a release adds arrive without an app edit:
|
|
61
|
+
*
|
|
62
|
+
* - `"native"`: {@link testing}.
|
|
63
|
+
* - `"web"`: none yet. Testing Library for React keeps `render` and `fireEvent` synchronous, so the
|
|
64
|
+
* RNTL await rules don't apply; spreading it now means web rules arrive when Genesis has some.
|
|
65
|
+
*/
|
|
66
|
+
declare function genesis(platform: GenesisPlatform, options?: GenesisLintOptions): GenesisLintConfig[];
|
|
67
|
+
|
|
68
|
+
export { type GenesisLintConfig, type GenesisLintOptions, type GenesisPlatform, RNTL_ASYNC_CALLS, TESTING_LIBRARY_PLUGIN, TEST_FILES, genesis, rntlAwaitSelectors, testing };
|
package/dist/eslint.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as path2 from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
import { createRequire } from 'module';
|
|
4
|
+
|
|
5
|
+
// ../../node_modules/tsup/assets/esm_shims.js
|
|
6
|
+
var getFilename = () => fileURLToPath(import.meta.url);
|
|
7
|
+
var __filename$1 = /* @__PURE__ */ getFilename();
|
|
8
|
+
var TEST_FILES = ["**/__tests__/**/*.{js,jsx,ts,tsx}", "**/*.test.{js,jsx,ts,tsx}"];
|
|
9
|
+
var RNTL_ASYNC_CALLS = ["render", "renderHook", "renderRouter", "renderApp", "act"];
|
|
10
|
+
var TESTING_LIBRARY_PLUGIN = "eslint-plugin-testing-library";
|
|
11
|
+
var here = typeof __filename$1 === "string" ? __filename$1 : fileURLToPath(import.meta.url);
|
|
12
|
+
function loadTestingLibrary() {
|
|
13
|
+
const from = [path2.join(process.cwd(), "package.json"), here];
|
|
14
|
+
for (const base of from) {
|
|
15
|
+
try {
|
|
16
|
+
const mod = createRequire(base)(TESTING_LIBRARY_PLUGIN);
|
|
17
|
+
return mod && typeof mod === "object" && "rules" in mod ? mod : mod.default ?? mod;
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
throw new Error(
|
|
22
|
+
`@marktiderman/genesis-cli/eslint: Genesis's testing rules need ${TESTING_LIBRARY_PLUGIN}. Install it in the app's devDependencies (pnpm add -D ${TESTING_LIBRARY_PLUGIN}), or pass it as { testingLibrary: require("${TESTING_LIBRARY_PLUGIN}") }.`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
var escape = (name) => name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26
|
+
function unawaited(message, ...callees) {
|
|
27
|
+
return callees.flatMap((callee) => [
|
|
28
|
+
{ selector: `ExpressionStatement > CallExpression${callee}`, message },
|
|
29
|
+
{ selector: `VariableDeclarator > CallExpression${callee}`, message },
|
|
30
|
+
{ selector: `AssignmentExpression > CallExpression${callee}`, message }
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
function rntlAwaitSelectors(options = {}) {
|
|
34
|
+
const calls = [.../* @__PURE__ */ new Set([...RNTL_ASYNC_CALLS, ...options.renders ?? []])].map(escape).join("|");
|
|
35
|
+
return [
|
|
36
|
+
...unawaited(
|
|
37
|
+
"React Native Testing Library 14's render calls (render, renderHook, renderRouter, renderApp) and act return promises: await them.",
|
|
38
|
+
`[callee.name=/^(${calls})$/]`
|
|
39
|
+
),
|
|
40
|
+
...unawaited(
|
|
41
|
+
"React Native Testing Library 14's rerender and unmount return promises: await them.",
|
|
42
|
+
"[callee.property.name=/^(rerender|unmount)$/]",
|
|
43
|
+
"[callee.name=/^(rerender|unmount)$/]"
|
|
44
|
+
),
|
|
45
|
+
...unawaited(
|
|
46
|
+
"userEvent's events return promises: await them.",
|
|
47
|
+
'[callee.object.type="CallExpression"][callee.object.callee.object.name="userEvent"][callee.object.callee.property.name="setup"]'
|
|
48
|
+
)
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
function testing(options = {}) {
|
|
52
|
+
return [
|
|
53
|
+
{
|
|
54
|
+
name: "genesis/testing",
|
|
55
|
+
files: options.testFiles ?? TEST_FILES,
|
|
56
|
+
plugins: { "testing-library": options.testingLibrary ?? loadTestingLibrary() },
|
|
57
|
+
rules: {
|
|
58
|
+
"testing-library/await-async-events": ["error", { eventModule: ["fireEvent", "userEvent"] }],
|
|
59
|
+
"no-restricted-syntax": ["error", ...rntlAwaitSelectors(options)]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
function genesis(platform, options = {}) {
|
|
65
|
+
if (platform === "native") return [...testing(options)];
|
|
66
|
+
if (platform === "web") return [];
|
|
67
|
+
throw new Error(`@marktiderman/genesis-cli/eslint: genesis("${String(platform)}"): the platform is "native" or "web".`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { RNTL_ASYNC_CALLS, TESTING_LIBRARY_PLUGIN, TEST_FILES, genesis, rntlAwaitSelectors, testing };
|
|
71
|
+
//# sourceMappingURL=eslint.js.map
|
|
72
|
+
//# sourceMappingURL=eslint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/tsup/assets/esm_shims.js","../src/eslint.ts"],"names":["__filename","fileURLToPath"],"mappings":"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","file":"eslint.js","sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","/**\n * `@marktiderman/genesis-cli/eslint`: Genesis's lint rules for apps, as ESLint flat-config pieces.\n * An app spreads them into its `eslint.config.js`, and `genesis upgrade` delivers new and changed\n * rules with the CLI, so the app's config never has to change for them:\n *\n * ```js\n * const { genesis } = require(\"@marktiderman/genesis-cli/eslint\");\n * module.exports = defineConfig([expoConfig, ...genesis(\"native\")]);\n * ```\n *\n * Built for `require` and `import` alike. Plugins are loaded only when a piece that needs them is\n * built, never on import: `testing` needs `eslint-plugin-testing-library` (an optional peer\n * dependency of genesis-cli; install it in the app's devDependencies).\n */\nimport { createRequire } from \"node:module\";\nimport * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n/** One flat-config object, as much of ESLint's `Linter.Config` as the pieces use. */\nexport interface GenesisLintConfig {\n name?: string;\n files?: string[];\n ignores?: string[];\n plugins?: Record<string, unknown>;\n rules?: Record<string, unknown>;\n}\n\n/** The platform an app is built for. */\nexport type GenesisPlatform = \"native\" | \"web\";\n\nexport interface GenesisLintOptions {\n /**\n * The test files the testing rules cover. Default: files under `__tests__/` and\n * `*.test.*` files ({@link TEST_FILES}).\n */\n testFiles?: string[];\n /**\n * The app's own helpers that wrap React Native Testing Library's `render` (and so return a\n * promise), checked like `render`. `renderApp` (the starter's helper) and expo-router's\n * `renderRouter` are always checked.\n */\n renders?: string[];\n /**\n * `eslint-plugin-testing-library`, when the app loads it itself (say, to configure more of its\n * rules). Otherwise it is resolved from the app (the working directory), then from genesis-cli.\n */\n testingLibrary?: unknown;\n}\n\n/** The test files the testing rules cover by default. */\nexport const TEST_FILES = [\"**/__tests__/**/*.{js,jsx,ts,tsx}\", \"**/*.test.{js,jsx,ts,tsx}\"];\n\n/** What React Native Testing Library 14 made async, beyond fireEvent: render calls and act. */\nexport const RNTL_ASYNC_CALLS = [\"render\", \"renderHook\", \"renderRouter\", \"renderApp\", \"act\"] as const;\n\n/** The plugin's package name, for the error when it isn't installed. */\nexport const TESTING_LIBRARY_PLUGIN = \"eslint-plugin-testing-library\";\n\nconst here = typeof __filename === \"string\" ? __filename : fileURLToPath(import.meta.url);\n\n/** `eslint-plugin-testing-library`, from the app first (the copy its own config would load), then from genesis-cli. */\nfunction loadTestingLibrary(): unknown {\n const from = [path.join(process.cwd(), \"package.json\"), here];\n for (const base of from) {\n try {\n const mod = createRequire(base)(TESTING_LIBRARY_PLUGIN) as { default?: unknown };\n return mod && typeof mod === \"object\" && \"rules\" in mod ? mod : (mod.default ?? mod);\n } catch {\n // try the next place\n }\n }\n throw new Error(\n `@marktiderman/genesis-cli/eslint: Genesis's testing rules need ${TESTING_LIBRARY_PLUGIN}. Install it in the app's devDependencies (pnpm add -D ${TESTING_LIBRARY_PLUGIN}), or pass it as { testingLibrary: require(\"${TESTING_LIBRARY_PLUGIN}\") }.`,\n );\n}\n\nconst escape = (name: string) => name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\n/** One `no-restricted-syntax` entry per place a call's promise is dropped: a statement, a declaration, an assignment. */\nfunction unawaited(message: string, ...callees: string[]): { selector: string; message: string }[] {\n return callees.flatMap((callee) => [\n { selector: `ExpressionStatement > CallExpression${callee}`, message },\n { selector: `VariableDeclarator > CallExpression${callee}`, message },\n { selector: `AssignmentExpression > CallExpression${callee}`, message },\n ]);\n}\n\n/**\n * The `no-restricted-syntax` entries for React Native Testing Library 14's async calls: render,\n * renderHook, renderRouter, renderApp (plus `renders`) and act; rerender and unmount, as methods\n * and destructured; and a chained `userEvent.setup().press(…)`, which await-async-events doesn't\n * follow. Each flags a call whose promise is dropped (a statement, a declaration, an assignment).\n * Exported so an app with its own `no-restricted-syntax` for test files can keep both.\n */\nexport function rntlAwaitSelectors(options: Pick<GenesisLintOptions, \"renders\"> = {}): { selector: string; message: string }[] {\n const calls = [...new Set([...RNTL_ASYNC_CALLS, ...(options.renders ?? [])])].map(escape).join(\"|\");\n return [\n ...unawaited(\n \"React Native Testing Library 14's render calls (render, renderHook, renderRouter, renderApp) and act return promises: await them.\",\n `[callee.name=/^(${calls})$/]`,\n ),\n ...unawaited(\n \"React Native Testing Library 14's rerender and unmount return promises: await them.\",\n \"[callee.property.name=/^(rerender|unmount)$/]\",\n \"[callee.name=/^(rerender|unmount)$/]\",\n ),\n ...unawaited(\n \"userEvent's events return promises: await them.\",\n '[callee.object.type=\"CallExpression\"][callee.object.callee.object.name=\"userEvent\"][callee.object.callee.property.name=\"setup\"]',\n ),\n ];\n}\n\n/**\n * React Native Testing Library 14's await rules, for test files. RNTL 14 made render, renderHook,\n * fireEvent, act, rerender and unmount async; left unawaited, a test reads the screen before React\n * has updated it, and React logs \"overlapping act() calls\".\n *\n * - `testing-library/await-async-events` with `eventModule: [\"fireEvent\", \"userEvent\"]` (its\n * React preset assumes fireEvent is sync, so only this rule is turned on);\n * - `no-restricted-syntax` for what the plugin has no rule for ({@link rntlAwaitSelectors}).\n *\n * The piece sets `no-restricted-syntax` for test files, so an app's own setting of that rule for\n * the same files, later in the array, replaces it: spread `rntlAwaitSelectors()` into yours.\n */\nexport function testing(options: GenesisLintOptions = {}): GenesisLintConfig[] {\n return [\n {\n name: \"genesis/testing\",\n files: options.testFiles ?? TEST_FILES,\n plugins: { \"testing-library\": options.testingLibrary ?? loadTestingLibrary() },\n rules: {\n \"testing-library/await-async-events\": [\"error\", { eventModule: [\"fireEvent\", \"userEvent\"] }],\n \"no-restricted-syntax\": [\"error\", ...rntlAwaitSelectors(options)],\n },\n },\n ];\n}\n\n/**\n * Every Genesis lint piece for the platform, so rules a release adds arrive without an app edit:\n *\n * - `\"native\"`: {@link testing}.\n * - `\"web\"`: none yet. Testing Library for React keeps `render` and `fireEvent` synchronous, so the\n * RNTL await rules don't apply; spreading it now means web rules arrive when Genesis has some.\n */\nexport function genesis(platform: GenesisPlatform, options: GenesisLintOptions = {}): GenesisLintConfig[] {\n if (platform === \"native\") return [...testing(options)];\n if (platform === \"web\") return [];\n throw new Error(`@marktiderman/genesis-cli/eslint: genesis(\"${String(platform)}\"): the platform is \"native\" or \"web\".`);\n}\n"]}
|
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
|
+
"@marktiderman/genesis-calendar": {
|
|
35
|
+
"version": "0.1.2"
|
|
36
|
+
},
|
|
34
37
|
"@marktiderman/genesis-chat": {
|
|
35
38
|
"version": "0.7.0",
|
|
36
39
|
"blocks": {
|
|
@@ -90,7 +93,7 @@
|
|
|
90
93
|
"version": "0.3.0"
|
|
91
94
|
},
|
|
92
95
|
"@marktiderman/genesis-core": {
|
|
93
|
-
"version": "2.
|
|
96
|
+
"version": "2.10.0"
|
|
94
97
|
},
|
|
95
98
|
"@marktiderman/genesis-design-system": {
|
|
96
99
|
"version": "1.7.0"
|
|
@@ -123,16 +126,16 @@
|
|
|
123
126
|
"version": "0.7.0"
|
|
124
127
|
},
|
|
125
128
|
"@marktiderman/genesis": {
|
|
126
|
-
"version": "0.10.
|
|
129
|
+
"version": "0.10.14"
|
|
127
130
|
},
|
|
128
131
|
"@marktiderman/genesis-cli": {
|
|
129
|
-
"version": "1.
|
|
132
|
+
"version": "1.20.0"
|
|
130
133
|
},
|
|
131
134
|
"@marktiderman/genesis-media": {
|
|
132
135
|
"version": "0.2.0"
|
|
133
136
|
},
|
|
134
137
|
"@marktiderman/genesis-native": {
|
|
135
|
-
"version": "0.
|
|
138
|
+
"version": "0.8.0",
|
|
136
139
|
"blocks": {
|
|
137
140
|
"push": {
|
|
138
141
|
"feature": {
|
|
@@ -455,7 +458,7 @@
|
|
|
455
458
|
"version": "0.5.3"
|
|
456
459
|
},
|
|
457
460
|
"@marktiderman/genesis-supabase": {
|
|
458
|
-
"version": "0.
|
|
461
|
+
"version": "0.13.0",
|
|
459
462
|
"blocks": {
|
|
460
463
|
"account": {
|
|
461
464
|
"feature": {
|
|
@@ -900,10 +903,10 @@
|
|
|
900
903
|
"version": "2.1.3"
|
|
901
904
|
},
|
|
902
905
|
"@marktiderman/genesis-ui": {
|
|
903
|
-
"version": "2.
|
|
906
|
+
"version": "2.30.0"
|
|
904
907
|
},
|
|
905
908
|
"@marktiderman/genesis-ui-native": {
|
|
906
|
-
"version": "3.5.
|
|
909
|
+
"version": "3.5.1"
|
|
907
910
|
}
|
|
908
911
|
}
|
|
909
912
|
}
|