🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

@eslint-react/kit

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eslint-react/kit - npm Package Compare versions

Comparing version

to
1.40.0-beta.1

import { _ } from '@eslint-react/eff';
import * as tseslint from '@typescript-eslint/utils/ts-eslint';
import { ReportDescriptor } from '@typescript-eslint/utils/ts-eslint';
import { TsConfigJson } from 'get-tsconfig';
/**
* Regular expression for matching a PascalCase string.
*/
declare const RE_PASCAL_CASE: RegExp;
/**
* Regular expression for matching a camelCase string.
*/
declare const RE_CAMEL_CASE: RegExp;
/**
* Regular expression for matching a kebab-case string.
*/
declare const RE_KEBAB_CASE: RegExp;
/**
* Regular expression for matching a snake_case string.
*/
declare const RE_SNAKE_CASE: RegExp;
/**
* Regular expression for matching a CONSTANT_CASE string.
*/
declare const RE_CONSTANT_CASE: RegExp;
declare const RE_JAVASCRIPT_PROTOCOL: RegExp;
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"];
/**
* Rule severity.

@@ -54,3 +32,2 @@ * @since 0.0.1

type RuleFeature = "CFG" | "DBG" | "FIX" | "MOD" | "TSC" | "EXP";
/**

@@ -63,3 +40,65 @@ * Creates a report function that can conditionally report a descriptor.

type JsxRuntimeOptions = Pick<TsConfigJson.CompilerOptions, "reactNamespace" | "jsx" | "jsxFactory" | "jsxFragmentFactory" | "jsxImportSource">;
declare const defaultJsxRuntimeOptions: {
readonly jsx: "react-jsx";
readonly jsxFactory: "React.createElement";
readonly jsxFragmentFactory: "React.Fragment";
readonly jsxImportSource: "react";
readonly reactNamespace: "React";
};
declare function getJsxRuntimeOptionsFromContext(context: RuleContext): {
readonly jsx: "react-jsx";
readonly jsxFactory: "React.createElement";
readonly jsxFragmentFactory: "React.Fragment";
readonly jsxImportSource: "react";
readonly reactNamespace: "React";
} | {
jsx: TsConfigJson.CompilerOptions.JSX;
jsxFactory: string;
jsxFragmentFactory: string;
jsxImportSource: string;
reactNamespace: string;
};
type index_JsxRuntimeOptions = JsxRuntimeOptions;
declare const index_defaultJsxRuntimeOptions: typeof defaultJsxRuntimeOptions;
declare const index_getJsxRuntimeOptionsFromContext: typeof getJsxRuntimeOptionsFromContext;
declare namespace index {
export { type index_JsxRuntimeOptions as JsxRuntimeOptions, index_defaultJsxRuntimeOptions as defaultJsxRuntimeOptions, index_getJsxRuntimeOptionsFromContext as getJsxRuntimeOptionsFromContext };
}
/**
* Regular expression for matching a TypeScript file extension.
*/
declare const RE_TS_EXT: RegExp;
/**
* Regular expression for matching a JavaScript file extension.
*/
declare const RE_JS_EXT: RegExp;
/**
* Regular expression for matching a PascalCase string.
*/
declare const RE_PASCAL_CASE: RegExp;
/**
* Regular expression for matching a camelCase string.
*/
declare const RE_CAMEL_CASE: RegExp;
/**
* Regular expression for matching a kebab-case string.
*/
declare const RE_KEBAB_CASE: RegExp;
/**
* Regular expression for matching a snake_case string.
*/
declare const RE_SNAKE_CASE: RegExp;
/**
* Regular expression for matching a CONSTANT_CASE string.
*/
declare const RE_CONSTANT_CASE: RegExp;
declare const RE_JAVASCRIPT_PROTOCOL: RegExp;
/**
* Regular expression for matching a RegExp string.
*/
declare const RE_REGEXP_STR: RegExp;
/**
* Convert a string to the `RegExp`.

@@ -82,2 +121,2 @@ * Normal strings (e.g. `"foo"`) is converted to `/^foo$/` of `RegExp`.

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, createReport, isRegExp, toRegExp };
export { index as JsxRuntime, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_JS_EXT, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_REGEXP_STR, RE_SNAKE_CASE, RE_TS_EXT, type RuleContext, type RuleDeclaration, type RuleFeature, type RulePreset, type RuleSeverity, createReport, isRegExp, toRegExp };
'use strict';
// src/constants.ts
var getTsconfig = require('get-tsconfig');
var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
// src/JsxRuntime/index.ts
var JsxRuntime_exports = {};
__export(JsxRuntime_exports, {
defaultJsxRuntimeOptions: () => defaultJsxRuntimeOptions,
getJsxRuntimeOptionsFromContext: () => getJsxRuntimeOptionsFromContext
});
var defaultJsxRuntimeOptions = {
jsx: "react-jsx",
jsxFactory: "React.createElement",
jsxFragmentFactory: "React.Fragment",
jsxImportSource: "react",
reactNamespace: "React"
};
var tsconfigCache = /* @__PURE__ */ new Map();
function getJsxRuntimeOptionsFromContext(context) {
const tsconfigResult = getTsconfig.getTsconfig(context.cwd, "tsconfig.json", tsconfigCache);
const compilerOptions = tsconfigResult?.config.compilerOptions;
if (compilerOptions == null) return defaultJsxRuntimeOptions;
return {
jsx: compilerOptions.jsx ?? defaultJsxRuntimeOptions.jsx,
jsxFactory: compilerOptions.jsxFactory ?? defaultJsxRuntimeOptions.jsxFactory,
jsxFragmentFactory: compilerOptions.jsxFragmentFactory ?? defaultJsxRuntimeOptions.jsxFragmentFactory,
jsxImportSource: compilerOptions.jsxImportSource ?? defaultJsxRuntimeOptions.jsxImportSource,
reactNamespace: compilerOptions.reactNamespace ?? defaultJsxRuntimeOptions.reactNamespace
};
}
// src/RegExp.ts
var RE_TS_EXT = /^[cm]?tsx?$/;
var RE_JS_EXT = /^[cm]?jsx?$/;
var RE_PASCAL_CASE = /^[A-Z][\dA-Za-z]*$/u;

@@ -10,36 +47,6 @@ var RE_CAMEL_CASE = /^[a-z][\dA-Za-z]*$/u;

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;
var REACT_BUILD_IN_HOOKS = [
"use",
"useActionState",
"useCallback",
"useContext",
"useDebugValue",
"useDeferredValue",
"useEffect",
"useFormStatus",
"useId",
"useImperativeHandle",
"useInsertionEffect",
"useLayoutEffect",
"useMemo",
"useOptimistic",
"useReducer",
"useRef",
"useState",
"useSyncExternalStore",
"useTransition"
];
// src/create-report.ts
function createReport(context) {
return (descriptor) => {
if (descriptor != null) context.report(descriptor);
};
}
// src/regexp.ts
var RE_REGEXP_STR = /^\/(.+)\/([A-Za-z]*)$/u;
function toRegExp(string) {
const [, pattern, flags = "u"] = RE_REGEXP_STR.exec(string) ?? [];
if (pattern) return new RegExp(pattern, flags);
if (pattern != null) return new RegExp(pattern, flags);
return { test: (s) => s === string };

@@ -51,11 +58,21 @@ }

exports.REACT_BUILD_IN_HOOKS = REACT_BUILD_IN_HOOKS;
// src/Rule.ts
function createReport(context) {
return (descriptor) => {
if (descriptor != null) context.report(descriptor);
};
}
exports.JsxRuntime = JsxRuntime_exports;
exports.RE_CAMEL_CASE = RE_CAMEL_CASE;
exports.RE_CONSTANT_CASE = RE_CONSTANT_CASE;
exports.RE_JAVASCRIPT_PROTOCOL = RE_JAVASCRIPT_PROTOCOL;
exports.RE_JS_EXT = RE_JS_EXT;
exports.RE_KEBAB_CASE = RE_KEBAB_CASE;
exports.RE_PASCAL_CASE = RE_PASCAL_CASE;
exports.RE_REGEXP_STR = RE_REGEXP_STR;
exports.RE_SNAKE_CASE = RE_SNAKE_CASE;
exports.RE_TS_EXT = RE_TS_EXT;
exports.createReport = createReport;
exports.isRegExp = isRegExp;
exports.toRegExp = toRegExp;
{
"name": "@eslint-react/kit",
"version": "1.39.0-next.3",
"version": "1.40.0-beta.1",
"description": "ESLint React's Plugin Kit for building plugins and rules.",

@@ -38,5 +38,6 @@ "homepage": "https://github.com/Rel1cx/eslint-react",

"dependencies": {
"@typescript-eslint/utils": "^8.28.0",
"@typescript-eslint/utils": "^8.29.0",
"get-tsconfig": "^4.10.0",
"ts-pattern": "^5.7.0",
"@eslint-react/eff": "1.39.0-next.3"
"@eslint-react/eff": "1.40.0-beta.1"
},

@@ -43,0 +44,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet