inital upload
This commit is contained in:
21
node_modules/eslint-plugin-react-hooks/LICENSE
generated
vendored
Normal file
21
node_modules/eslint-plugin-react-hooks/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
|
||||
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.
|
||||
109
node_modules/eslint-plugin-react-hooks/README.md
generated
vendored
Normal file
109
node_modules/eslint-plugin-react-hooks/README.md
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
# `eslint-plugin-react-hooks`
|
||||
|
||||
This ESLint plugin enforces the [Rules of Hooks](https://react.dev/reference/rules/rules-of-hooks).
|
||||
|
||||
It is a part of the [Hooks API](https://react.dev/reference/react/hooks) for React.
|
||||
|
||||
## Installation
|
||||
|
||||
**Note: If you're using Create React App, please use `react-scripts` >= 3 instead of adding it directly.**
|
||||
|
||||
Assuming you already have ESLint installed, run:
|
||||
|
||||
```sh
|
||||
# npm
|
||||
npm install eslint-plugin-react-hooks --save-dev
|
||||
|
||||
# yarn
|
||||
yarn add eslint-plugin-react-hooks --dev
|
||||
```
|
||||
|
||||
### Legacy Config (.eslintrc)
|
||||
|
||||
If you are still using ESLint below 9.0.0, please continue to use `recommended-legacy`. To avoid breaking changes, we still support `recommended` as well, but note that this will be changed to alias the flat recommended config in v6.
|
||||
|
||||
```js
|
||||
{
|
||||
"extends": [
|
||||
// ...
|
||||
"plugin:react-hooks/recommended-legacy"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Flat Config (eslint.config.js)
|
||||
|
||||
For [ESLint 9.0.0 and above](https://eslint.org/blog/2024/04/eslint-v9.0.0-released/) users, add the `recommended-latest` config.
|
||||
|
||||
```js
|
||||
import reactHooks from 'eslint-plugin-react-hooks';
|
||||
|
||||
export default [
|
||||
// ...
|
||||
reactHooks.configs['recommended-latest'],
|
||||
];
|
||||
```
|
||||
|
||||
### Custom Configuration
|
||||
|
||||
If you want more fine-grained configuration, you can instead add a snippet like this to your ESLint configuration file:
|
||||
|
||||
#### Legacy Config (.eslintrc)
|
||||
|
||||
```js
|
||||
{
|
||||
"plugins": [
|
||||
// ...
|
||||
"react-hooks"
|
||||
],
|
||||
"rules": {
|
||||
// ...
|
||||
"react-hooks/rules-of-hooks": "error",
|
||||
"react-hooks/exhaustive-deps": "warn"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Flat Config (eslint.config.js)
|
||||
|
||||
```js
|
||||
import reactHooks from 'eslint-plugin-react-hooks';
|
||||
|
||||
export default [
|
||||
{
|
||||
files: ['**/*.{js,jsx}'],
|
||||
plugins: { 'react-hooks': reactHooks },
|
||||
// ...
|
||||
rules: {
|
||||
'react-hooks/rules-of-hooks': 'error',
|
||||
'react-hooks/exhaustive-deps': 'warn',
|
||||
}
|
||||
},
|
||||
];
|
||||
```
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
`exhaustive-deps` can be configured to validate dependencies of custom Hooks with the `additionalHooks` option.
|
||||
This option accepts a regex to match the names of custom Hooks that have dependencies.
|
||||
|
||||
```js
|
||||
{
|
||||
"rules": {
|
||||
// ...
|
||||
"react-hooks/exhaustive-deps": ["warn", {
|
||||
"additionalHooks": "(useMyCustomHook|useMyOtherCustomHook)"
|
||||
}]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
We suggest to use this option **very sparingly, if at all**. Generally saying, we recommend most custom Hooks to not use the dependencies argument, and instead provide a higher-level API that is more focused around a specific use case.
|
||||
|
||||
## Valid and Invalid Examples
|
||||
|
||||
Please refer to the [Rules of Hooks](https://react.dev/reference/rules/rules-of-hooks) documentation to learn more about this rule.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
91
node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.d.ts
generated
vendored
Normal file
91
node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.d.ts
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
import * as estree from 'estree';
|
||||
import { Rule, ESLint } from 'eslint';
|
||||
|
||||
declare const rules: {
|
||||
'rules-of-hooks': {
|
||||
meta: {
|
||||
type: "problem";
|
||||
docs: {
|
||||
description: string;
|
||||
recommended: true;
|
||||
url: string;
|
||||
};
|
||||
};
|
||||
create(context: Rule.RuleContext): {
|
||||
onCodePathSegmentStart: (segment: Rule.CodePathSegment) => number;
|
||||
onCodePathSegmentEnd: () => Rule.CodePathSegment | undefined;
|
||||
onCodePathStart: () => number;
|
||||
onCodePathEnd(codePath: Rule.CodePath, codePathNode: Rule.Node): void;
|
||||
CallExpression(node: estree.CallExpression & Rule.NodeParentExtension): void;
|
||||
Identifier(node: estree.Identifier & Rule.NodeParentExtension): void;
|
||||
'CallExpression:exit'(node: estree.CallExpression & Rule.NodeParentExtension): void;
|
||||
FunctionDeclaration(node: estree.FunctionDeclaration & Rule.NodeParentExtension): void;
|
||||
ArrowFunctionExpression(node: estree.ArrowFunctionExpression & Rule.NodeParentExtension): void;
|
||||
};
|
||||
};
|
||||
'exhaustive-deps': {
|
||||
meta: {
|
||||
type: "suggestion";
|
||||
docs: {
|
||||
description: string;
|
||||
recommended: true;
|
||||
url: string;
|
||||
};
|
||||
fixable: "code";
|
||||
hasSuggestions: true;
|
||||
schema: {
|
||||
type: "object";
|
||||
additionalProperties: false;
|
||||
enableDangerousAutofixThisMayCauseInfiniteLoops: boolean;
|
||||
properties: {
|
||||
additionalHooks: {
|
||||
type: "string";
|
||||
};
|
||||
enableDangerousAutofixThisMayCauseInfiniteLoops: {
|
||||
type: "boolean";
|
||||
};
|
||||
};
|
||||
}[];
|
||||
};
|
||||
create(context: Rule.RuleContext): {
|
||||
CallExpression: (node: estree.CallExpression) => void;
|
||||
};
|
||||
};
|
||||
};
|
||||
declare const configs: {
|
||||
/** Legacy recommended config, to be used with rc-based configurations */
|
||||
'recommended-legacy': {
|
||||
plugins: string[];
|
||||
rules: {
|
||||
'react-hooks/rules-of-hooks': "error";
|
||||
'react-hooks/exhaustive-deps': "warn";
|
||||
};
|
||||
};
|
||||
/**
|
||||
* 'recommended' is currently aliased to the legacy / rc recommended config) to maintain backwards compatibility.
|
||||
* This is deprecated and in v6, it will switch to alias the flat recommended config.
|
||||
*/
|
||||
recommended: {
|
||||
plugins: string[];
|
||||
rules: {
|
||||
'react-hooks/rules-of-hooks': "error";
|
||||
'react-hooks/exhaustive-deps': "warn";
|
||||
};
|
||||
};
|
||||
/** Latest recommended config, to be used with flat configurations */
|
||||
'recommended-latest': {
|
||||
name: string;
|
||||
plugins: {
|
||||
readonly 'react-hooks': ESLint.Plugin;
|
||||
};
|
||||
rules: {
|
||||
'react-hooks/rules-of-hooks': "error";
|
||||
'react-hooks/exhaustive-deps': "warn";
|
||||
};
|
||||
};
|
||||
};
|
||||
declare const meta: {
|
||||
name: string;
|
||||
};
|
||||
|
||||
export { configs, meta, rules };
|
||||
2737
node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js
generated
vendored
Normal file
2737
node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2731
node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js
generated
vendored
Normal file
2731
node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/eslint-plugin-react-hooks/index.d.ts
generated
vendored
Normal file
1
node_modules/eslint-plugin-react-hooks/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './cjs/eslint-plugin-react-hooks';
|
||||
9
node_modules/eslint-plugin-react-hooks/index.js
generated
vendored
Normal file
9
node_modules/eslint-plugin-react-hooks/index.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
// TODO: this doesn't make sense for an ESLint rule.
|
||||
// We need to fix our build process to not create bundles for "raw" packages like this.
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./cjs/eslint-plugin-react-hooks.production.js');
|
||||
} else {
|
||||
module.exports = require('./cjs/eslint-plugin-react-hooks.development.js');
|
||||
}
|
||||
58
node_modules/eslint-plugin-react-hooks/package.json
generated
vendored
Normal file
58
node_modules/eslint-plugin-react-hooks/package.json
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "eslint-plugin-react-hooks",
|
||||
"description": "ESLint rules for React Hooks",
|
||||
"version": "5.2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/react.git",
|
||||
"directory": "packages/eslint-plugin-react-hooks"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"cjs",
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"eslint",
|
||||
"eslint-plugin",
|
||||
"eslintplugin",
|
||||
"react"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/facebook/react/issues"
|
||||
},
|
||||
"main": "./index.js",
|
||||
"types": "./index.d.ts",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"homepage": "https://react.dev/",
|
||||
"peerDependencies": {
|
||||
"eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/eslint-parser": "^7.11.4",
|
||||
"@babel/preset-typescript": "^7.26.0",
|
||||
"@tsconfig/strictest": "^2.0.5",
|
||||
"@typescript-eslint/parser-v2": "npm:@typescript-eslint/parser@^2.26.0",
|
||||
"@typescript-eslint/parser-v3": "npm:@typescript-eslint/parser@^3.10.0",
|
||||
"@typescript-eslint/parser-v4": "npm:@typescript-eslint/parser@^4.1.0",
|
||||
"@typescript-eslint/parser-v5": "npm:@typescript-eslint/parser@^5.62.0",
|
||||
"@types/eslint": "^8.56.12",
|
||||
"@types/estree": "^1.0.6",
|
||||
"@types/estree-jsx": "^1.0.5",
|
||||
"@types/node": "^20.2.5",
|
||||
"babel-eslint": "^10.0.3",
|
||||
"eslint-v7": "npm:eslint@^7.7.0",
|
||||
"eslint-v9": "npm:eslint@^9.0.0",
|
||||
"jest": "^29.5.0",
|
||||
"typescript": "^5.4.3"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user