@eslint-react/kit 1.38.0-beta.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Eva1ent
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.
@@ -0,0 +1,70 @@
1
+ import { _ } from '@eslint-react/eff';
2
+ import * as tseslint from '@typescript-eslint/utils/ts-eslint';
3
+ import { ReportDescriptor } from '@typescript-eslint/utils/ts-eslint';
4
+
5
+ /**
6
+ * Regular expression for matching a PascalCase string.
7
+ */
8
+ declare const RE_PASCAL_CASE: RegExp;
9
+ /**
10
+ * Regular expression for matching a camelCase string.
11
+ */
12
+ declare const RE_CAMEL_CASE: RegExp;
13
+ /**
14
+ * Regular expression for matching a kebab-case string.
15
+ */
16
+ declare const RE_KEBAB_CASE: RegExp;
17
+ /**
18
+ * Regular expression for matching a snake_case string.
19
+ */
20
+ declare const RE_SNAKE_CASE: RegExp;
21
+ /**
22
+ * Regular expression for matching a CONSTANT_CASE string.
23
+ */
24
+ declare const RE_CONSTANT_CASE: RegExp;
25
+ declare const RE_JAVASCRIPT_PROTOCOL: RegExp;
26
+ declare const REACT_BUILD_IN_HOOKS: readonly ["use", "useActionState", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useFormStatus", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useOptimistic", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition"];
27
+
28
+ /**
29
+ * Rule severity.
30
+ * @since 0.0.1
31
+ */
32
+ type RuleSeverity = "error" | "off" | "warn";
33
+ /**
34
+ * Rule declaration.
35
+ * @internal
36
+ * @since 0.0.1
37
+ */
38
+ type RuleDeclaration = [RuleSeverity, Record<string, unknown>?] | RuleSeverity;
39
+ /**
40
+ * Rule config preset.
41
+ * @since 0.0.1
42
+ */
43
+ type RulePreset = Record<string, RuleDeclaration>;
44
+ /**
45
+ * Rule context.
46
+ * @since 0.0.1
47
+ */
48
+ type RuleContext<MessageIds extends string = string, Options extends readonly unknown[] = readonly unknown[]> = tseslint.RuleContext<MessageIds, Options>;
49
+ /**
50
+ * Rule feature.
51
+ * @since 1.20.0
52
+ */
53
+ type RuleFeature = "CFG" | "DBG" | "FIX" | "MOD" | "TSC";
54
+ /**
55
+ * Rule status.
56
+ * @since 1.36.0
57
+ */
58
+ type RuleStatus = "stable" | "experimental" | "deprecated" | "removed";
59
+
60
+ /**
61
+ * Creates a report function that can conditionally report a descriptor.
62
+ * @param context - The context of the rule
63
+ * @returns A function that takes a descriptor and reports it if it's not null or undefined
64
+ */
65
+ declare function createReport<MessageID extends string>(context: RuleContext): (descriptor: _ | null | ReportDescriptor<MessageID>) => void;
66
+
67
+ declare function isInEditorEnv(): boolean;
68
+ declare function isInGitHooksOrLintStaged(): boolean;
69
+
70
+ export { REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, type RuleContext, type RuleDeclaration, type RuleFeature, type RulePreset, type RuleSeverity, type RuleStatus, createReport, isInEditorEnv, isInGitHooksOrLintStaged };
@@ -0,0 +1,70 @@
1
+ import { _ } from '@eslint-react/eff';
2
+ import * as tseslint from '@typescript-eslint/utils/ts-eslint';
3
+ import { ReportDescriptor } from '@typescript-eslint/utils/ts-eslint';
4
+
5
+ /**
6
+ * Regular expression for matching a PascalCase string.
7
+ */
8
+ declare const RE_PASCAL_CASE: RegExp;
9
+ /**
10
+ * Regular expression for matching a camelCase string.
11
+ */
12
+ declare const RE_CAMEL_CASE: RegExp;
13
+ /**
14
+ * Regular expression for matching a kebab-case string.
15
+ */
16
+ declare const RE_KEBAB_CASE: RegExp;
17
+ /**
18
+ * Regular expression for matching a snake_case string.
19
+ */
20
+ declare const RE_SNAKE_CASE: RegExp;
21
+ /**
22
+ * Regular expression for matching a CONSTANT_CASE string.
23
+ */
24
+ declare const RE_CONSTANT_CASE: RegExp;
25
+ declare const RE_JAVASCRIPT_PROTOCOL: RegExp;
26
+ declare const REACT_BUILD_IN_HOOKS: readonly ["use", "useActionState", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useFormStatus", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useOptimistic", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition"];
27
+
28
+ /**
29
+ * Rule severity.
30
+ * @since 0.0.1
31
+ */
32
+ type RuleSeverity = "error" | "off" | "warn";
33
+ /**
34
+ * Rule declaration.
35
+ * @internal
36
+ * @since 0.0.1
37
+ */
38
+ type RuleDeclaration = [RuleSeverity, Record<string, unknown>?] | RuleSeverity;
39
+ /**
40
+ * Rule config preset.
41
+ * @since 0.0.1
42
+ */
43
+ type RulePreset = Record<string, RuleDeclaration>;
44
+ /**
45
+ * Rule context.
46
+ * @since 0.0.1
47
+ */
48
+ type RuleContext<MessageIds extends string = string, Options extends readonly unknown[] = readonly unknown[]> = tseslint.RuleContext<MessageIds, Options>;
49
+ /**
50
+ * Rule feature.
51
+ * @since 1.20.0
52
+ */
53
+ type RuleFeature = "CFG" | "DBG" | "FIX" | "MOD" | "TSC";
54
+ /**
55
+ * Rule status.
56
+ * @since 1.36.0
57
+ */
58
+ type RuleStatus = "stable" | "experimental" | "deprecated" | "removed";
59
+
60
+ /**
61
+ * Creates a report function that can conditionally report a descriptor.
62
+ * @param context - The context of the rule
63
+ * @returns A function that takes a descriptor and reports it if it's not null or undefined
64
+ */
65
+ declare function createReport<MessageID extends string>(context: RuleContext): (descriptor: _ | null | ReportDescriptor<MessageID>) => void;
66
+
67
+ declare function isInEditorEnv(): boolean;
68
+ declare function isInGitHooksOrLintStaged(): boolean;
69
+
70
+ export { REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, type RuleContext, type RuleDeclaration, type RuleFeature, type RulePreset, type RuleSeverity, type RuleStatus, createReport, isInEditorEnv, isInGitHooksOrLintStaged };
package/dist/index.js ADDED
@@ -0,0 +1,62 @@
1
+ 'use strict';
2
+
3
+ // src/constants.ts
4
+ var RE_PASCAL_CASE = /^[A-Z][\dA-Za-z]*$/u;
5
+ var RE_CAMEL_CASE = /^[a-z][\dA-Za-z]*$/u;
6
+ var RE_KEBAB_CASE = /^[a-z][\d\-a-z]*$/u;
7
+ var RE_SNAKE_CASE = /^[a-z][\d_a-z]*$/u;
8
+ var RE_CONSTANT_CASE = /^[A-Z][\d_A-Z]*$/u;
9
+ var RE_JAVASCRIPT_PROTOCOL = /^[\u0000-\u001F ]*j[\t\n\r]*a[\t\n\r]*v[\t\n\r]*a[\t\n\r]*s[\t\n\r]*c[\t\n\r]*r[\t\n\r]*i[\t\n\r]*p[\t\n\r]*t[\t\n\r]*:/iu;
10
+ var REACT_BUILD_IN_HOOKS = [
11
+ "use",
12
+ "useActionState",
13
+ "useCallback",
14
+ "useContext",
15
+ "useDebugValue",
16
+ "useDeferredValue",
17
+ "useEffect",
18
+ "useFormStatus",
19
+ "useId",
20
+ "useImperativeHandle",
21
+ "useInsertionEffect",
22
+ "useLayoutEffect",
23
+ "useMemo",
24
+ "useOptimistic",
25
+ "useReducer",
26
+ "useRef",
27
+ "useState",
28
+ "useSyncExternalStore",
29
+ "useTransition"
30
+ ];
31
+
32
+ // src/create-report.ts
33
+ function createReport(context) {
34
+ return (descriptor) => {
35
+ if (descriptor != null) context.report(descriptor);
36
+ };
37
+ }
38
+
39
+ // src/env.ts
40
+ function isInEditorEnv() {
41
+ if (process.env["CI"]) {
42
+ return false;
43
+ }
44
+ if (isInGitHooksOrLintStaged()) {
45
+ return false;
46
+ }
47
+ return !!(process.env["VSCODE_PID"] || process.env["VSCODE_CWD"] || process.env["JETBRAINS_IDE"] || process.env["VIM"] || process.env["NVIM"]);
48
+ }
49
+ function isInGitHooksOrLintStaged() {
50
+ return !!(process.env["GIT_PARAMS"] || process.env["VSCODE_GIT_COMMAND"] || process.env["npm_lifecycle_script"]?.startsWith("lint-staged"));
51
+ }
52
+
53
+ exports.REACT_BUILD_IN_HOOKS = REACT_BUILD_IN_HOOKS;
54
+ exports.RE_CAMEL_CASE = RE_CAMEL_CASE;
55
+ exports.RE_CONSTANT_CASE = RE_CONSTANT_CASE;
56
+ exports.RE_JAVASCRIPT_PROTOCOL = RE_JAVASCRIPT_PROTOCOL;
57
+ exports.RE_KEBAB_CASE = RE_KEBAB_CASE;
58
+ exports.RE_PASCAL_CASE = RE_PASCAL_CASE;
59
+ exports.RE_SNAKE_CASE = RE_SNAKE_CASE;
60
+ exports.createReport = createReport;
61
+ exports.isInEditorEnv = isInEditorEnv;
62
+ exports.isInGitHooksOrLintStaged = isInGitHooksOrLintStaged;
package/dist/index.mjs ADDED
@@ -0,0 +1,51 @@
1
+ // src/constants.ts
2
+ var RE_PASCAL_CASE = /^[A-Z][\dA-Za-z]*$/u;
3
+ var RE_CAMEL_CASE = /^[a-z][\dA-Za-z]*$/u;
4
+ var RE_KEBAB_CASE = /^[a-z][\d\-a-z]*$/u;
5
+ var RE_SNAKE_CASE = /^[a-z][\d_a-z]*$/u;
6
+ var RE_CONSTANT_CASE = /^[A-Z][\d_A-Z]*$/u;
7
+ var RE_JAVASCRIPT_PROTOCOL = /^[\u0000-\u001F ]*j[\t\n\r]*a[\t\n\r]*v[\t\n\r]*a[\t\n\r]*s[\t\n\r]*c[\t\n\r]*r[\t\n\r]*i[\t\n\r]*p[\t\n\r]*t[\t\n\r]*:/iu;
8
+ var REACT_BUILD_IN_HOOKS = [
9
+ "use",
10
+ "useActionState",
11
+ "useCallback",
12
+ "useContext",
13
+ "useDebugValue",
14
+ "useDeferredValue",
15
+ "useEffect",
16
+ "useFormStatus",
17
+ "useId",
18
+ "useImperativeHandle",
19
+ "useInsertionEffect",
20
+ "useLayoutEffect",
21
+ "useMemo",
22
+ "useOptimistic",
23
+ "useReducer",
24
+ "useRef",
25
+ "useState",
26
+ "useSyncExternalStore",
27
+ "useTransition"
28
+ ];
29
+
30
+ // src/create-report.ts
31
+ function createReport(context) {
32
+ return (descriptor) => {
33
+ if (descriptor != null) context.report(descriptor);
34
+ };
35
+ }
36
+
37
+ // src/env.ts
38
+ function isInEditorEnv() {
39
+ if (process.env["CI"]) {
40
+ return false;
41
+ }
42
+ if (isInGitHooksOrLintStaged()) {
43
+ return false;
44
+ }
45
+ return !!(process.env["VSCODE_PID"] || process.env["VSCODE_CWD"] || process.env["JETBRAINS_IDE"] || process.env["VIM"] || process.env["NVIM"]);
46
+ }
47
+ function isInGitHooksOrLintStaged() {
48
+ return !!(process.env["GIT_PARAMS"] || process.env["VSCODE_GIT_COMMAND"] || process.env["npm_lifecycle_script"]?.startsWith("lint-staged"));
49
+ }
50
+
51
+ export { REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, createReport, isInEditorEnv, isInGitHooksOrLintStaged };
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@eslint-react/kit",
3
+ "version": "1.38.0-beta.3",
4
+ "description": "ESLint React's Plugin Kit for building plugins and rules.",
5
+ "homepage": "https://github.com/Rel1cx/eslint-react",
6
+ "bugs": {
7
+ "url": "https://github.com/Rel1cx/eslint-react/issues"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Rel1cx/eslint-react.git",
12
+ "directory": "packages/utilities/kit"
13
+ },
14
+ "license": "MIT",
15
+ "author": "Eva1ent<rel1cx@proton.me>",
16
+ "sideEffects": false,
17
+ "exports": {
18
+ ".": {
19
+ "import": {
20
+ "types": "./dist/index.d.mts",
21
+ "default": "./dist/index.mjs"
22
+ },
23
+ "require": {
24
+ "types": "./dist/index.d.ts",
25
+ "default": "./dist/index.js"
26
+ }
27
+ },
28
+ "./package.json": "./package.json"
29
+ },
30
+ "main": "dist/index.js",
31
+ "module": "dist/index.mjs",
32
+ "types": "dist/index.d.ts",
33
+ "files": [
34
+ "dist",
35
+ "./package.json"
36
+ ],
37
+ "dependencies": {
38
+ "ts-pattern": "^5.6.2",
39
+ "@eslint-react/eff": "1.38.0-beta.3"
40
+ },
41
+ "peerDependencies": {
42
+ "@typescript-eslint/utils": "^8.27.0"
43
+ },
44
+ "devDependencies": {
45
+ "@tsconfig/node22": "^22.0.0",
46
+ "tsup": "^8.4.0",
47
+ "type-fest": "^4.37.0",
48
+ "@local/configs": "0.0.0"
49
+ },
50
+ "engines": {
51
+ "bun": ">=1.0.15",
52
+ "node": ">=18.18.0"
53
+ },
54
+ "scripts": {
55
+ "build": "tsup",
56
+ "build:docs": "typedoc",
57
+ "lint:publish": "publint",
58
+ "lint:ts": "tsc --noEmit"
59
+ }
60
+ }