startx 0.1.5 → 0.1.6
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/.editorconfig +20 -20
- package/.github/workflows/publish.yml +48 -0
- package/LICENSE +21 -21
- package/configs/eslint-config/plugins.d.ts +1 -1
- package/configs/eslint-config/src/rules/no-argument-spread.ts +96 -96
- package/configs/eslint-config/src/rules/no-internal-package-import.ts +40 -40
- package/configs/eslint-config/src/rules/no-interpolation-in-regular-string.ts +32 -32
- package/configs/eslint-config/src/rules/no-skipped-tests.ts +61 -61
- package/configs/eslint-config/src/rules/no-top-level-relative-imports-in-backend-module.ts +27 -27
- package/configs/eslint-config/src/rules/no-type-unsafe-event-emitter.ts +33 -33
- package/configs/eslint-config/src/rules/no-uncaught-json-parse.test.ts +21 -21
- package/configs/eslint-config/src/rules/no-untyped-config-class-field.ts +26 -26
- package/configs/eslint-config/src/rules/no-unused-param-catch-clause.ts +33 -33
- package/configs/eslint-config/src/rules/no-useless-catch-throw.test.ts +34 -34
- package/configs/eslint-config/src/rules/no-useless-catch-throw.ts +47 -47
- package/configs/eslint-config/src/utils/json.ts +21 -21
- package/package.json +34 -35
- package/packages/@repo/constants/src/api.ts +1 -1
- package/packages/@repo/constants/src/time.ts +23 -23
- package/packages/@repo/db/src/schema/index.ts +1 -1
- package/packages/@repo/lib/src/error-handlers-module/index.ts +11 -11
- package/packages/cli/dist/index.mjs +38 -165
- package/packages/cli/tsdown.config.ts +1 -0
- package/packages/ui/src/components/custom/grid-component.tsx +23 -23
- package/packages/ui/src/components/custom/hover-tool.tsx +38 -38
- package/packages/ui/src/components/custom/image-picker.tsx +109 -109
- package/packages/ui/src/components/custom/no-content.tsx +37 -37
- package/packages/ui/src/components/custom/page-container.tsx +24 -24
- package/packages/ui/src/components/custom/simple-popover.tsx +29 -29
- package/packages/ui/src/components/custom/switch-component.tsx +20 -20
- package/packages/ui/src/components/custom/theme-provider.tsx +74 -74
- package/packages/ui/src/components/hooks/event/use-click.tsx +39 -39
- package/packages/ui/src/components/hooks/time/useDebounce.tsx +21 -21
- package/packages/ui/src/components/hooks/time/useInterval.tsx +35 -35
- package/packages/ui/src/components/hooks/time/useTimeout.tsx +19 -19
- package/packages/ui/src/components/hooks/time/useTimer.tsx +51 -51
- package/packages/ui/src/components/hooks/use-media-query.tsx +19 -19
- package/packages/ui/src/components/hooks/use-persistent-storage.tsx +52 -52
- package/packages/ui/src/components/hooks/use-window-dimension.tsx +30 -30
- package/packages/ui/src/components/sonner.tsx +1 -1
- package/packages/ui/src/components/ui/button.tsx +96 -96
- package/packages/ui/src/components/ui/dropdown-menu.tsx +226 -226
- package/packages/ui/src/components/ui/label.tsx +24 -24
- package/packages/ui/src/components/ui/popover.tsx +42 -42
- package/packages/ui/src/components/ui/select.tsx +170 -170
- package/packages/ui/src/components/ui/separator.tsx +28 -28
- package/packages/ui/src/components/ui/sheet.tsx +130 -130
- package/packages/ui/src/components/ui/skeleton.tsx +13 -13
- package/packages/ui/src/components/ui/spinner.tsx +16 -16
- package/packages/ui/src/components/ui/switch.tsx +28 -28
- package/packages/ui/src/components/ui/tabs.tsx +54 -54
- package/packages/ui/src/components/ui/tooltip.tsx +30 -30
- package/packages/ui/src/components/util/n-formattor.ts +22 -22
- package/packages/ui/src/components/util/storage.ts +37 -37
- package/packages/ui/src/globals.css +87 -87
- package/configs/vitest-config/dist/base.mjs +0 -1
- package/configs/vitest-config/dist/frontend.mjs +0 -1
- package/configs/vitest-config/dist/node.mjs +0 -1
- package/packages/@repo/redis/dist/index.d.mts +0 -3
- package/packages/@repo/redis/dist/index.mjs +0 -5
- package/packages/@repo/redis/dist/lib/redis-client.d.mts +0 -7
- package/packages/@repo/redis/dist/lib/redis-client.mjs +0 -25
- package/packages/@repo/redis/dist/lib/redis-client.mjs.map +0 -1
- package/packages/@repo/redis/dist/lib/redis-module.d.mts +0 -5
- package/packages/@repo/redis/dist/lib/redis-module.mjs +0 -6
- package/packages/@repo/redis/dist/lib/redis-module.mjs.map +0 -1
- /package/{apps/core-server/.env.example → .env.example} +0 -0
package/.editorconfig
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
root = true
|
|
2
|
-
|
|
3
|
-
[*]
|
|
4
|
-
charset = utf-8
|
|
5
|
-
indent_style = tab
|
|
6
|
-
indent_size = 2
|
|
7
|
-
end_of_line = lf
|
|
8
|
-
insert_final_newline = true
|
|
9
|
-
trim_trailing_whitespace = true
|
|
10
|
-
|
|
11
|
-
[package.json]
|
|
12
|
-
indent_style = space
|
|
13
|
-
indent_size = 2
|
|
14
|
-
|
|
15
|
-
[*.yml]
|
|
16
|
-
indent_style = space
|
|
17
|
-
indent_size = 2
|
|
18
|
-
|
|
19
|
-
[*.ts]
|
|
20
|
-
quote_type = double
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
charset = utf-8
|
|
5
|
+
indent_style = tab
|
|
6
|
+
indent_size = 2
|
|
7
|
+
end_of_line = lf
|
|
8
|
+
insert_final_newline = true
|
|
9
|
+
trim_trailing_whitespace = true
|
|
10
|
+
|
|
11
|
+
[package.json]
|
|
12
|
+
indent_style = space
|
|
13
|
+
indent_size = 2
|
|
14
|
+
|
|
15
|
+
[*.yml]
|
|
16
|
+
indent_style = space
|
|
17
|
+
indent_size = 2
|
|
18
|
+
|
|
19
|
+
[*.ts]
|
|
20
|
+
quote_type = double
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
id-token: write
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout repo
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Setup Node
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: 22
|
|
24
|
+
registry-url: https://registry.npmjs.org/
|
|
25
|
+
|
|
26
|
+
- name: Enable Corepack
|
|
27
|
+
run: corepack enable
|
|
28
|
+
|
|
29
|
+
- name: Install CLI
|
|
30
|
+
run: pnpm install --filter ./packages/cli... --frozen-lockfile
|
|
31
|
+
|
|
32
|
+
- name: Build only CLI
|
|
33
|
+
run: pnpm --filter ./packages/cli... build
|
|
34
|
+
|
|
35
|
+
- name: Clean root package.json
|
|
36
|
+
run: |
|
|
37
|
+
node -e "
|
|
38
|
+
const fs = require('fs');
|
|
39
|
+
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
|
|
40
|
+
delete pkg.dependencies;
|
|
41
|
+
delete pkg.devDependencies;
|
|
42
|
+
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
|
|
43
|
+
"
|
|
44
|
+
|
|
45
|
+
- name: Publish to npm
|
|
46
|
+
run: pnpm publish --no-git-checks
|
|
47
|
+
env:
|
|
48
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Avinash Kumar
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Avinash Kumar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
declare module "eslint-plugin-lodash";
|
|
1
|
+
declare module "eslint-plugin-lodash";
|
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
|
-
|
|
3
|
-
export const NoArgumentSpreadRule = ESLintUtils.RuleCreator.withoutDocs({
|
|
4
|
-
name: "no-argument-spread",
|
|
5
|
-
meta: {
|
|
6
|
-
type: "problem",
|
|
7
|
-
docs: {
|
|
8
|
-
description:
|
|
9
|
-
"Avoid spreading potentially large arrays in function or constructor calls — can cause stack overflows. Use `.apply` or `Reflect.construct` instead.",
|
|
10
|
-
},
|
|
11
|
-
fixable: "code",
|
|
12
|
-
messages: {
|
|
13
|
-
noUnboundedSpread:
|
|
14
|
-
"Avoid spreading an array in function or constructor calls unless known to be small.",
|
|
15
|
-
replaceWithApply:
|
|
16
|
-
"Replace `array.push(...largeArray)` with `array.push.apply(array, largeArray)` to avoid potential stack overflows.",
|
|
17
|
-
replaceWithReflect:
|
|
18
|
-
"Replace `new Constructor(...args)` with `Reflect.construct(Constructor, args)` to avoid potential stack overflows.",
|
|
19
|
-
},
|
|
20
|
-
schema: [],
|
|
21
|
-
},
|
|
22
|
-
defaultOptions: [],
|
|
23
|
-
create(context) {
|
|
24
|
-
return {
|
|
25
|
-
CallExpression(node) {
|
|
26
|
-
for (const arg of node.arguments) {
|
|
27
|
-
if (arg.type !== "SpreadElement") continue;
|
|
28
|
-
|
|
29
|
-
const spreadArg = arg.argument;
|
|
30
|
-
|
|
31
|
-
// Allow spread of inline arrays
|
|
32
|
-
if (spreadArg.type === "ArrayExpression") return;
|
|
33
|
-
|
|
34
|
-
// Only autofix if it's the sole argument
|
|
35
|
-
const canFix = node.arguments.length === 1;
|
|
36
|
-
|
|
37
|
-
context.report({
|
|
38
|
-
node,
|
|
39
|
-
messageId: "replaceWithApply",
|
|
40
|
-
fix: canFix
|
|
41
|
-
? (fixer) => {
|
|
42
|
-
const source = context.sourceCode;
|
|
43
|
-
|
|
44
|
-
if (node.callee.type === "MemberExpression") {
|
|
45
|
-
// Preserve `this`
|
|
46
|
-
const thisText = source.getText(node.callee.object);
|
|
47
|
-
const calleeText = source.getText(node.callee);
|
|
48
|
-
const argText = source.getText(spreadArg);
|
|
49
|
-
return fixer.replaceText(
|
|
50
|
-
node,
|
|
51
|
-
`${calleeText}.apply(${thisText}, ${argText})`
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
// Not a memberexpression, use undefined as thisArg
|
|
55
|
-
const calleeText = source.getText(node.callee);
|
|
56
|
-
const argText = source.getText(spreadArg);
|
|
57
|
-
return fixer.replaceText(
|
|
58
|
-
node,
|
|
59
|
-
`${calleeText}.apply(undefined, ${argText})`
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
: null,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
NewExpression(node) {
|
|
68
|
-
for (const arg of node.arguments || []) {
|
|
69
|
-
if (arg.type !== "SpreadElement") continue;
|
|
70
|
-
|
|
71
|
-
const spreadArg = arg.argument;
|
|
72
|
-
|
|
73
|
-
if (spreadArg.type === "ArrayExpression") return;
|
|
74
|
-
|
|
75
|
-
const canFix = node.arguments.length === 1;
|
|
76
|
-
|
|
77
|
-
context.report({
|
|
78
|
-
node,
|
|
79
|
-
messageId: "replaceWithReflect",
|
|
80
|
-
fix: canFix
|
|
81
|
-
? (fixer) => {
|
|
82
|
-
const source = context.sourceCode;
|
|
83
|
-
const ctorText = source.getText(node.callee);
|
|
84
|
-
const argText = source.getText(spreadArg);
|
|
85
|
-
return fixer.replaceText(
|
|
86
|
-
node,
|
|
87
|
-
`Reflect.construct(${ctorText}, ${argText})`
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
: null,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
};
|
|
95
|
-
},
|
|
96
|
-
});
|
|
1
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
|
+
|
|
3
|
+
export const NoArgumentSpreadRule = ESLintUtils.RuleCreator.withoutDocs({
|
|
4
|
+
name: "no-argument-spread",
|
|
5
|
+
meta: {
|
|
6
|
+
type: "problem",
|
|
7
|
+
docs: {
|
|
8
|
+
description:
|
|
9
|
+
"Avoid spreading potentially large arrays in function or constructor calls — can cause stack overflows. Use `.apply` or `Reflect.construct` instead.",
|
|
10
|
+
},
|
|
11
|
+
fixable: "code",
|
|
12
|
+
messages: {
|
|
13
|
+
noUnboundedSpread:
|
|
14
|
+
"Avoid spreading an array in function or constructor calls unless known to be small.",
|
|
15
|
+
replaceWithApply:
|
|
16
|
+
"Replace `array.push(...largeArray)` with `array.push.apply(array, largeArray)` to avoid potential stack overflows.",
|
|
17
|
+
replaceWithReflect:
|
|
18
|
+
"Replace `new Constructor(...args)` with `Reflect.construct(Constructor, args)` to avoid potential stack overflows.",
|
|
19
|
+
},
|
|
20
|
+
schema: [],
|
|
21
|
+
},
|
|
22
|
+
defaultOptions: [],
|
|
23
|
+
create(context) {
|
|
24
|
+
return {
|
|
25
|
+
CallExpression(node) {
|
|
26
|
+
for (const arg of node.arguments) {
|
|
27
|
+
if (arg.type !== "SpreadElement") continue;
|
|
28
|
+
|
|
29
|
+
const spreadArg = arg.argument;
|
|
30
|
+
|
|
31
|
+
// Allow spread of inline arrays
|
|
32
|
+
if (spreadArg.type === "ArrayExpression") return;
|
|
33
|
+
|
|
34
|
+
// Only autofix if it's the sole argument
|
|
35
|
+
const canFix = node.arguments.length === 1;
|
|
36
|
+
|
|
37
|
+
context.report({
|
|
38
|
+
node,
|
|
39
|
+
messageId: "replaceWithApply",
|
|
40
|
+
fix: canFix
|
|
41
|
+
? (fixer) => {
|
|
42
|
+
const source = context.sourceCode;
|
|
43
|
+
|
|
44
|
+
if (node.callee.type === "MemberExpression") {
|
|
45
|
+
// Preserve `this`
|
|
46
|
+
const thisText = source.getText(node.callee.object);
|
|
47
|
+
const calleeText = source.getText(node.callee);
|
|
48
|
+
const argText = source.getText(spreadArg);
|
|
49
|
+
return fixer.replaceText(
|
|
50
|
+
node,
|
|
51
|
+
`${calleeText}.apply(${thisText}, ${argText})`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
// Not a memberexpression, use undefined as thisArg
|
|
55
|
+
const calleeText = source.getText(node.callee);
|
|
56
|
+
const argText = source.getText(spreadArg);
|
|
57
|
+
return fixer.replaceText(
|
|
58
|
+
node,
|
|
59
|
+
`${calleeText}.apply(undefined, ${argText})`
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
: null,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
NewExpression(node) {
|
|
68
|
+
for (const arg of node.arguments || []) {
|
|
69
|
+
if (arg.type !== "SpreadElement") continue;
|
|
70
|
+
|
|
71
|
+
const spreadArg = arg.argument;
|
|
72
|
+
|
|
73
|
+
if (spreadArg.type === "ArrayExpression") return;
|
|
74
|
+
|
|
75
|
+
const canFix = node.arguments.length === 1;
|
|
76
|
+
|
|
77
|
+
context.report({
|
|
78
|
+
node,
|
|
79
|
+
messageId: "replaceWithReflect",
|
|
80
|
+
fix: canFix
|
|
81
|
+
? (fixer) => {
|
|
82
|
+
const source = context.sourceCode;
|
|
83
|
+
const ctorText = source.getText(node.callee);
|
|
84
|
+
const argText = source.getText(spreadArg);
|
|
85
|
+
return fixer.replaceText(
|
|
86
|
+
node,
|
|
87
|
+
`Reflect.construct(${ctorText}, ${argText})`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
: null,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
});
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
|
|
3
|
-
export const NoInternalPackageImportRule = ESLintUtils.RuleCreator.withoutDocs({
|
|
4
|
-
name: "no-internal-package-import",
|
|
5
|
-
meta: {
|
|
6
|
-
type: 'problem',
|
|
7
|
-
docs: {
|
|
8
|
-
description: 'Disallow imports from internal package paths (e.g. `/pkg/src/...`).',
|
|
9
|
-
},
|
|
10
|
-
messages: {
|
|
11
|
-
noInternalPackageImport:
|
|
12
|
-
'Import from "{{ packageRoot }}", not from the internal `/src/` path.',
|
|
13
|
-
},
|
|
14
|
-
fixable: 'code',
|
|
15
|
-
schema: [],
|
|
16
|
-
},
|
|
17
|
-
defaultOptions: [],
|
|
18
|
-
create(context) {
|
|
19
|
-
const INTERNAL_IMPORT_REGEX = /^(?<packageRoot>\/[^/]+)\/src\//;
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
ImportDeclaration(node) {
|
|
23
|
-
if (typeof node.source.type !== 'string') return;
|
|
24
|
-
|
|
25
|
-
const match = node.source.value.match(INTERNAL_IMPORT_REGEX);
|
|
26
|
-
|
|
27
|
-
if (!match?.groups) return;
|
|
28
|
-
|
|
29
|
-
const { packageRoot } = match.groups;
|
|
30
|
-
|
|
31
|
-
context.report({
|
|
32
|
-
node: node.source,
|
|
33
|
-
messageId: 'noInternalPackageImport',
|
|
34
|
-
fix: (fixer) => fixer.replaceText(node.source, `"${packageRoot}"`),
|
|
35
|
-
data: { packageRoot },
|
|
36
|
-
});
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
});
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
|
|
3
|
+
export const NoInternalPackageImportRule = ESLintUtils.RuleCreator.withoutDocs({
|
|
4
|
+
name: "no-internal-package-import",
|
|
5
|
+
meta: {
|
|
6
|
+
type: 'problem',
|
|
7
|
+
docs: {
|
|
8
|
+
description: 'Disallow imports from internal package paths (e.g. `/pkg/src/...`).',
|
|
9
|
+
},
|
|
10
|
+
messages: {
|
|
11
|
+
noInternalPackageImport:
|
|
12
|
+
'Import from "{{ packageRoot }}", not from the internal `/src/` path.',
|
|
13
|
+
},
|
|
14
|
+
fixable: 'code',
|
|
15
|
+
schema: [],
|
|
16
|
+
},
|
|
17
|
+
defaultOptions: [],
|
|
18
|
+
create(context) {
|
|
19
|
+
const INTERNAL_IMPORT_REGEX = /^(?<packageRoot>\/[^/]+)\/src\//;
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
ImportDeclaration(node) {
|
|
23
|
+
if (typeof node.source.type !== 'string') return;
|
|
24
|
+
|
|
25
|
+
const match = node.source.value.match(INTERNAL_IMPORT_REGEX);
|
|
26
|
+
|
|
27
|
+
if (!match?.groups) return;
|
|
28
|
+
|
|
29
|
+
const { packageRoot } = match.groups;
|
|
30
|
+
|
|
31
|
+
context.report({
|
|
32
|
+
node: node.source,
|
|
33
|
+
messageId: 'noInternalPackageImport',
|
|
34
|
+
fix: (fixer) => fixer.replaceText(node.source, `"${packageRoot}"`),
|
|
35
|
+
data: { packageRoot },
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
|
|
3
|
-
export const NoInterpolationInRegularStringRule = ESLintUtils.RuleCreator.withoutDocs({
|
|
4
|
-
name: 'no-interpolation-in-regular-string',
|
|
5
|
-
meta: {
|
|
6
|
-
type: 'problem',
|
|
7
|
-
docs: {
|
|
8
|
-
description: 'String interpolation `${...}` requires backticks, not single or double quotes.',
|
|
9
|
-
},
|
|
10
|
-
messages: {
|
|
11
|
-
useBackticks: 'Use backticks to interpolate',
|
|
12
|
-
},
|
|
13
|
-
fixable: 'code',
|
|
14
|
-
schema: [],
|
|
15
|
-
},
|
|
16
|
-
defaultOptions: [],
|
|
17
|
-
create(context) {
|
|
18
|
-
return {
|
|
19
|
-
Literal(node) {
|
|
20
|
-
if (typeof node.value !== 'string') return;
|
|
21
|
-
|
|
22
|
-
if (/\$\{/.test(node.value)) {
|
|
23
|
-
context.report({
|
|
24
|
-
messageId: 'useBackticks',
|
|
25
|
-
node,
|
|
26
|
-
fix: (fixer) => fixer.replaceText(node, `\`${node.value}\``),
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
});
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
|
|
3
|
+
export const NoInterpolationInRegularStringRule = ESLintUtils.RuleCreator.withoutDocs({
|
|
4
|
+
name: 'no-interpolation-in-regular-string',
|
|
5
|
+
meta: {
|
|
6
|
+
type: 'problem',
|
|
7
|
+
docs: {
|
|
8
|
+
description: 'String interpolation `${...}` requires backticks, not single or double quotes.',
|
|
9
|
+
},
|
|
10
|
+
messages: {
|
|
11
|
+
useBackticks: 'Use backticks to interpolate',
|
|
12
|
+
},
|
|
13
|
+
fixable: 'code',
|
|
14
|
+
schema: [],
|
|
15
|
+
},
|
|
16
|
+
defaultOptions: [],
|
|
17
|
+
create(context) {
|
|
18
|
+
return {
|
|
19
|
+
Literal(node) {
|
|
20
|
+
if (typeof node.value !== 'string') return;
|
|
21
|
+
|
|
22
|
+
if (/\$\{/.test(node.value)) {
|
|
23
|
+
context.report({
|
|
24
|
+
messageId: 'useBackticks',
|
|
25
|
+
node,
|
|
26
|
+
fix: (fixer) => fixer.replaceText(node, `\`${node.value}\``),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
});
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
|
-
|
|
3
|
-
export const NoSkippedTestsRule = ESLintUtils.RuleCreator.withoutDocs({
|
|
4
|
-
name: "no-skipped-tests",
|
|
5
|
-
meta: {
|
|
6
|
-
type: "problem",
|
|
7
|
-
docs: {
|
|
8
|
-
description: "Tests must not be skipped.",
|
|
9
|
-
},
|
|
10
|
-
messages: {
|
|
11
|
-
removeSkip: "Remove `.skip()` call",
|
|
12
|
-
removeOnly: "Remove `.only()` call",
|
|
13
|
-
removeXPrefix: "Remove `x` prefix",
|
|
14
|
-
},
|
|
15
|
-
fixable: "code",
|
|
16
|
-
schema: [],
|
|
17
|
-
},
|
|
18
|
-
defaultOptions: [],
|
|
19
|
-
create(context) {
|
|
20
|
-
const TESTING_FUNCTIONS = new Set(["test", "it", "describe"]);
|
|
21
|
-
const SKIPPING_METHODS = new Set(["skip", "only"]);
|
|
22
|
-
const PREFIXED_TESTING_FUNCTIONS = new Set(["xtest", "xit", "xdescribe"]);
|
|
23
|
-
const toMessageId = (s: string) =>
|
|
24
|
-
`remove${s.charAt(0).toUpperCase()}${s.slice(1)}` as
|
|
25
|
-
| "removeSkip"
|
|
26
|
-
| "removeOnly"
|
|
27
|
-
| "removeXPrefix";
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
MemberExpression(node) {
|
|
31
|
-
if (
|
|
32
|
-
node.object.type === "Identifier" &&
|
|
33
|
-
TESTING_FUNCTIONS.has(node.object.name) &&
|
|
34
|
-
node.property.type === "Identifier" &&
|
|
35
|
-
SKIPPING_METHODS.has(node.property.name)
|
|
36
|
-
) {
|
|
37
|
-
context.report({
|
|
38
|
-
messageId: toMessageId(node.property.name),
|
|
39
|
-
node,
|
|
40
|
-
fix: (fixer) => {
|
|
41
|
-
const [start, end] = node.property.range;
|
|
42
|
-
return fixer.removeRange([start - ".".length, end]);
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
CallExpression(node) {
|
|
48
|
-
if (
|
|
49
|
-
node.callee.type === "Identifier" &&
|
|
50
|
-
PREFIXED_TESTING_FUNCTIONS.has(node.callee.name)
|
|
51
|
-
) {
|
|
52
|
-
context.report({
|
|
53
|
-
messageId: "removeXPrefix",
|
|
54
|
-
node,
|
|
55
|
-
fix: (fixer) => fixer.replaceText(node.callee, "test"),
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
});
|
|
1
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
|
+
|
|
3
|
+
export const NoSkippedTestsRule = ESLintUtils.RuleCreator.withoutDocs({
|
|
4
|
+
name: "no-skipped-tests",
|
|
5
|
+
meta: {
|
|
6
|
+
type: "problem",
|
|
7
|
+
docs: {
|
|
8
|
+
description: "Tests must not be skipped.",
|
|
9
|
+
},
|
|
10
|
+
messages: {
|
|
11
|
+
removeSkip: "Remove `.skip()` call",
|
|
12
|
+
removeOnly: "Remove `.only()` call",
|
|
13
|
+
removeXPrefix: "Remove `x` prefix",
|
|
14
|
+
},
|
|
15
|
+
fixable: "code",
|
|
16
|
+
schema: [],
|
|
17
|
+
},
|
|
18
|
+
defaultOptions: [],
|
|
19
|
+
create(context) {
|
|
20
|
+
const TESTING_FUNCTIONS = new Set(["test", "it", "describe"]);
|
|
21
|
+
const SKIPPING_METHODS = new Set(["skip", "only"]);
|
|
22
|
+
const PREFIXED_TESTING_FUNCTIONS = new Set(["xtest", "xit", "xdescribe"]);
|
|
23
|
+
const toMessageId = (s: string) =>
|
|
24
|
+
`remove${s.charAt(0).toUpperCase()}${s.slice(1)}` as
|
|
25
|
+
| "removeSkip"
|
|
26
|
+
| "removeOnly"
|
|
27
|
+
| "removeXPrefix";
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
MemberExpression(node) {
|
|
31
|
+
if (
|
|
32
|
+
node.object.type === "Identifier" &&
|
|
33
|
+
TESTING_FUNCTIONS.has(node.object.name) &&
|
|
34
|
+
node.property.type === "Identifier" &&
|
|
35
|
+
SKIPPING_METHODS.has(node.property.name)
|
|
36
|
+
) {
|
|
37
|
+
context.report({
|
|
38
|
+
messageId: toMessageId(node.property.name),
|
|
39
|
+
node,
|
|
40
|
+
fix: (fixer) => {
|
|
41
|
+
const [start, end] = node.property.range;
|
|
42
|
+
return fixer.removeRange([start - ".".length, end]);
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
CallExpression(node) {
|
|
48
|
+
if (
|
|
49
|
+
node.callee.type === "Identifier" &&
|
|
50
|
+
PREFIXED_TESTING_FUNCTIONS.has(node.callee.name)
|
|
51
|
+
) {
|
|
52
|
+
context.report({
|
|
53
|
+
messageId: "removeXPrefix",
|
|
54
|
+
node,
|
|
55
|
+
fix: (fixer) => fixer.replaceText(node.callee, "test"),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
});
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { ESLintUtils, type TSESTree } from '@typescript-eslint/utils';
|
|
2
|
-
|
|
3
|
-
export const NoTopLevelRelativeImportsInBackendModuleRule = ESLintUtils.RuleCreator.withoutDocs({
|
|
4
|
-
name: 'no-top-level-relative-imports-in-backend-module',
|
|
5
|
-
meta: {
|
|
6
|
-
type: 'problem',
|
|
7
|
-
docs: {
|
|
8
|
-
description:
|
|
9
|
-
'Relative imports in `.module.ts` files must be placed inside the `init` method. This ensures that module imports are loaded only when the module is used.',
|
|
10
|
-
},
|
|
11
|
-
messages: {
|
|
12
|
-
placeInsideInit:
|
|
13
|
-
"Place this relative import inside the `init` method, using `await import('./path')` syntax.",
|
|
14
|
-
},
|
|
15
|
-
schema: [],
|
|
16
|
-
},
|
|
17
|
-
defaultOptions: [],
|
|
18
|
-
create(context) {
|
|
19
|
-
return {
|
|
20
|
-
'Program > ImportDeclaration'(node: TSESTree.ImportDeclaration) {
|
|
21
|
-
if (node.source.value.startsWith('.')) {
|
|
22
|
-
context.report({ node, messageId: 'placeInsideInit' });
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
},
|
|
27
|
-
});
|
|
1
|
+
import { ESLintUtils, type TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
|
|
3
|
+
export const NoTopLevelRelativeImportsInBackendModuleRule = ESLintUtils.RuleCreator.withoutDocs({
|
|
4
|
+
name: 'no-top-level-relative-imports-in-backend-module',
|
|
5
|
+
meta: {
|
|
6
|
+
type: 'problem',
|
|
7
|
+
docs: {
|
|
8
|
+
description:
|
|
9
|
+
'Relative imports in `.module.ts` files must be placed inside the `init` method. This ensures that module imports are loaded only when the module is used.',
|
|
10
|
+
},
|
|
11
|
+
messages: {
|
|
12
|
+
placeInsideInit:
|
|
13
|
+
"Place this relative import inside the `init` method, using `await import('./path')` syntax.",
|
|
14
|
+
},
|
|
15
|
+
schema: [],
|
|
16
|
+
},
|
|
17
|
+
defaultOptions: [],
|
|
18
|
+
create(context) {
|
|
19
|
+
return {
|
|
20
|
+
'Program > ImportDeclaration'(node: TSESTree.ImportDeclaration) {
|
|
21
|
+
if (node.source.value.startsWith('.')) {
|
|
22
|
+
context.report({ node, messageId: 'placeInsideInit' });
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
});
|