first commit

This commit is contained in:
ghazall-ag
2025-10-23 21:52:07 +03:30
commit d63a5b8d99
15218 changed files with 1639961 additions and 0 deletions

21
node_modules/eslint-plugin-react-refresh/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Arnaud Barré (https://github.com/ArnaudBarre)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

99
node_modules/eslint-plugin-react-refresh/README.md generated vendored Normal file
View File

@@ -0,0 +1,99 @@
# eslint-plugin-react-refresh [![npm](https://img.shields.io/npm/v/eslint-plugin-react-refresh)](https://www.npmjs.com/package/eslint-plugin-react-refresh)
Validate that your components can safely be updated with fast refresh.
## Limitations
⚠️ To avoid false positive, by default this plugin is only applied on `tsx` & `jsx` files. See options to run on JS files. ⚠️
The plugin rely on naming conventions (i.e. use PascalCase for components, camelCase for util functions). This is why there are some limitations:
- `export *` are not supported and will be reported as an error
- Anonymous function are not supported (i.e `export default function() {}`)
- Class components are not supported
- Full uppercase export would be considered as an error. It can be disabled locally when it's effectively a React component:
```jsx
// eslint-disable-next-line react-refresh/only-export-components
export const CMS = () => <></>;
```
I may publish a rule base on type information from [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint) to improve some limitations and catch some naming convention issues (like non-component function starting with an uppercase).
## Installation
```sh
npm i -D eslint-plugin-react-refresh
```
## Usage
```json
{
"plugins": ["react-refresh"],
"rules": {
"react-refresh/only-export-components": "warn"
}
}
```
## Fail
```jsx
export const foo = () => {};
export const Bar = () => <></>;
```
```jsx
export const CONSTANT = 3;
export const Foo = () => <></>;
```
```jsx
export default function () {}
export default compose()(MainComponent)
```
```jsx
export * from "./foo";
```
```jsx
const Tab = () => {};
export const tabs = [<Tab />, <Tab />];
```
```jsx
const App = () => {};
createRoot(document.getElementById("root")).render(<App />);
```
## Pass
```jsx
export default function Foo() {
return <></>;
}
```
```jsx
const foo = () => {};
export const Bar = () => <></>;
```
```jsx
import { App } from "./App";
createRoot(document.getElementById("root")).render(<App />);
```
## Options
### checkJS
If your using JSX inside `.js` files (which I don't recommend because it forces you to configure every tool you use to switch the parser), you can still use the plugin by enabling this option. To reduce the number of false positive, only files importing `react` are checked.
```json
{
"react-refresh/only-export-components": ["warn", { "checkJS": true }]
}
```

164
node_modules/eslint-plugin-react-refresh/index.js generated vendored Normal file
View File

@@ -0,0 +1,164 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
rules: () => rules
});
module.exports = __toCommonJS(src_exports);
// src/only-export-components.ts
var possibleReactExportRE = /^[A-Z][a-zA-Z0-9]*$/;
var strictReactExportRE = /^[A-Z][a-zA-Z0-9]*[a-z]+[a-zA-Z0-9]*$/;
var onlyExportComponents = {
meta: {
messages: {
exportAll: "This rule can't verify that `export *` only export components",
namedExport: "Fast refresh only works when a file only export components. Use a new file to share constant or functions between components.",
anonymousExport: "Fast refresh can't handle anonymous component. Add a name to your export.",
localComponents: "Fast refresh only works when a file only export components. Move your component(s) to a separate file.",
noExport: "Fast refresh only works when a file has exports. Move your component(s) to a separate file."
},
type: "problem",
schema: [
{
type: "object",
properties: {
checkJS: { type: "boolean" }
},
additionalProperties: false
}
]
},
defaultOptions: [],
create: (context) => {
const { checkJS } = context.options[0] || { checkJS: false };
const filename = context.getFilename();
if (filename.includes(".test.") || filename.includes(".spec.") || filename.includes(".stories.")) {
return {};
}
const shouldScan = filename.endsWith(".jsx") || filename.endsWith(".tsx") || checkJS && filename.endsWith(".js");
if (!shouldScan)
return {};
return {
Program(program) {
let hasExports = false;
let mayHaveReactExport = false;
let reactIsInScope = false;
const localComponents = [];
const nonComponentExport = [];
const handleLocalIdentifier = (identifierNode) => {
if (identifierNode.type !== "Identifier")
return;
if (possibleReactExportRE.test(identifierNode.name)) {
localComponents.push(identifierNode);
}
};
const handleExportIdentifier = (identifierNode) => {
if (identifierNode.type !== "Identifier") {
nonComponentExport.push(identifierNode);
return;
}
if (!mayHaveReactExport && possibleReactExportRE.test(identifierNode.name)) {
mayHaveReactExport = true;
}
if (!strictReactExportRE.test(identifierNode.name)) {
nonComponentExport.push(identifierNode);
}
};
const handleExportDeclaration = (node) => {
if (node.type === "VariableDeclaration") {
for (const variable of node.declarations) {
handleExportIdentifier(variable.id);
}
} else if (node.type === "FunctionDeclaration") {
if (node.id === null) {
context.report({ messageId: "anonymousExport", node });
} else {
handleExportIdentifier(node.id);
}
} else if (node.type === "CallExpression") {
context.report({ messageId: "anonymousExport", node });
}
};
for (const node of program.body) {
if (node.type === "ExportAllDeclaration") {
hasExports = true;
context.report({ messageId: "exportAll", node });
} else if (node.type === "ExportDefaultDeclaration") {
hasExports = true;
if (node.declaration.type === "VariableDeclaration" || node.declaration.type === "FunctionDeclaration" || node.declaration.type === "CallExpression") {
handleExportDeclaration(node.declaration);
}
if (node.declaration.type === "Identifier") {
handleExportIdentifier(node.declaration);
}
if (node.declaration.type === "ArrowFunctionExpression" && !node.declaration.id) {
context.report({ messageId: "anonymousExport", node });
}
} else if (node.type === "ExportNamedDeclaration") {
hasExports = true;
if (node.declaration)
handleExportDeclaration(node.declaration);
for (const specifier of node.specifiers) {
handleExportIdentifier(specifier.exported);
}
} else if (node.type === "VariableDeclaration") {
for (const variable of node.declarations) {
handleLocalIdentifier(variable.id);
}
} else if (node.type === "FunctionDeclaration") {
handleLocalIdentifier(node.id);
} else if (node.type === "ImportDeclaration") {
if (node.source.value === "react") {
reactIsInScope = true;
}
}
}
if (checkJS && !reactIsInScope)
return;
if (hasExports) {
if (mayHaveReactExport) {
for (const node of nonComponentExport) {
context.report({ messageId: "namedExport", node });
}
} else if (localComponents.length) {
for (const node of localComponents) {
context.report({ messageId: "localComponents", node });
}
}
} else if (localComponents.length) {
for (const node of localComponents) {
context.report({ messageId: "noExport", node });
}
}
}
};
}
};
// src/index.ts
var rules = {
"only-export-components": onlyExportComponents
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
rules
});

19
node_modules/eslint-plugin-react-refresh/package.json generated vendored Normal file
View File

@@ -0,0 +1,19 @@
{
"name": "eslint-plugin-react-refresh",
"description": "Validate that your components can safely be updated with fast refresh",
"version": "0.3.5",
"author": "Arnaud Barré (https://github.com/ArnaudBarre)",
"license": "MIT",
"repository": "github:ArnaudBarre/eslint-plugin-react-refresh",
"main": "index.js",
"keywords": [
"eslint",
"eslint-plugin",
"react",
"react-refresh",
"fast refresh"
],
"peerDependencies": {
"eslint": ">=7"
}
}