From e26b9cd46dbad293c1f6cf0657520a2dbf229639 Mon Sep 17 00:00:00 2001 From: Eva1ent Date: Tue, 23 Jul 2024 16:50:54 +0800 Subject: [PATCH] release: 1.5.31-beta.1 --- VERSION | 2 +- package.json | 2 +- packages/core/package.json | 2 +- .../eslint-plugin-react-debug/package.json | 2 +- .../src/rules/function-component.spec.ts | 93 +++++++++++++++++++ .../eslint-plugin-react-dom/package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../eslint-plugin-react-x/package.json | 2 +- .../rules/no-leaked-conditional-rendering.ts | 34 +++---- packages/plugins/eslint-plugin/package.json | 2 +- packages/shared/package.json | 2 +- packages/tools/package.json | 2 +- packages/types/package.json | 2 +- packages/utilities/ast/package.json | 2 +- packages/utilities/jsx/package.json | 2 +- packages/utilities/var/package.json | 2 +- 17 files changed, 125 insertions(+), 32 deletions(-) diff --git a/VERSION b/VERSION index 4fc04de85..e1ffb6dc9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.31-next.1 +1.5.31-beta.1 diff --git a/package.json b/package.json index 44d54f7e9..e58d0970d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@eslint-react/monorepo", - "version": "1.5.31-next.1", + "version": "1.5.31-beta.1", "private": true, "description": "A series of composable ESLint rules for libraries and frameworks that use React as a UI runtime.", "keywords": [ diff --git a/packages/core/package.json b/packages/core/package.json index 40b3dd483..56a84ee0d 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@eslint-react/core", - "version": "1.5.31-next.1", + "version": "1.5.31-beta.1", "description": "ESLint React's ESLint utility module for static analysis of React core APIs and Patterns.", "homepage": "https://github.com/rel1cx/eslint-react", "bugs": { diff --git a/packages/plugins/eslint-plugin-react-debug/package.json b/packages/plugins/eslint-plugin-react-debug/package.json index a57a618c7..f2b5900ad 100644 --- a/packages/plugins/eslint-plugin-react-debug/package.json +++ b/packages/plugins/eslint-plugin-react-debug/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-react-debug", - "version": "1.5.31-next.1", + "version": "1.5.31-beta.1", "description": "ESLint React's ESLint plugin for debugging related rules.", "homepage": "https://github.com/rel1cx/eslint-react", "bugs": { diff --git a/packages/plugins/eslint-plugin-react-debug/src/rules/function-component.spec.ts b/packages/plugins/eslint-plugin-react-debug/src/rules/function-component.spec.ts index 2eef66475..b675824a9 100644 --- a/packages/plugins/eslint-plugin-react-debug/src/rules/function-component.spec.ts +++ b/packages/plugins/eslint-plugin-react-debug/src/rules/function-component.spec.ts @@ -1366,6 +1366,99 @@ ruleTesterWithTypes.run(RULE_NAME, rule, { }, ], }, + // TODO: Add support for Atomico + // { + // code: /* tsx */ ` + // import { c, useState } from "atomico"; + + // function component(){ + // const [ count, setCount ] = useState(0); + // return { count }; + // } + + // export const Counter = c(counter); + // `, + // errors: [ + // { + // data: { + // name: "component", + // forwardRef: false, + // hookCalls: 1, + // memo: false, + // }, + // messageId: "FUNCTION_COMPONENT", + // }, + // ], + // settings: { + // "react-x": { + // importSource: "atomico", + // }, + // }, + // }, + // TODO: Add support for Atomico + // { + // code: /* tsx */ ` + // import { Props, c } from "atomico"; // 2.5kB + + // function component({ name }:Props) { + // return Hello, {name}; + // } + + // component.props = { + // name: String, + // }; + + // export const Component = c(component); + // `, + // errors: [ + // { + // data: { + // name: "component", + // forwardRef: false, + // hookCalls: 0, + // memo: false, + // }, + // messageId: "FUNCTION_COMPONENT", + // }, + // ], + // settings: { + // "react-x": { + // importSource: "atomico", + // }, + // }, + // }, + // TODO: Add support for Atomico + // { + // code: /* tsx */ ` + // import { Props, c } from "atomico"; // 2.5kB + + // function component({ name }:Props) { + // return Hello, {name}; + // } + + // component.props = { + // name: String, + // }; + + // customElements.define("my-component", c(component)); + // `, + // errors: [ + // { + // data: { + // name: "component", + // forwardRef: false, + // hookCalls: 0, + // memo: false, + // }, + // messageId: "FUNCTION_COMPONENT", + // }, + // ], + // settings: { + // "react-x": { + // importSource: "atomico", + // }, + // }, + // }, ], valid: [ ...allFunctions, diff --git a/packages/plugins/eslint-plugin-react-dom/package.json b/packages/plugins/eslint-plugin-react-dom/package.json index c86f2cbff..f084f96b0 100644 --- a/packages/plugins/eslint-plugin-react-dom/package.json +++ b/packages/plugins/eslint-plugin-react-dom/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-react-dom", - "version": "1.5.31-next.1", + "version": "1.5.31-beta.1", "description": "ESLint React's ESLint plugin for React DOM related rules.", "homepage": "https://github.com/rel1cx/eslint-react", "bugs": { diff --git a/packages/plugins/eslint-plugin-react-hooks-extra/package.json b/packages/plugins/eslint-plugin-react-hooks-extra/package.json index 0121d2d1b..f112d4335 100644 --- a/packages/plugins/eslint-plugin-react-hooks-extra/package.json +++ b/packages/plugins/eslint-plugin-react-hooks-extra/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-react-hooks-extra", - "version": "1.5.31-next.1", + "version": "1.5.31-beta.1", "description": "ESLint React's ESLint plugin for React Hooks related rules.", "homepage": "https://github.com/rel1cx/eslint-react", "bugs": { diff --git a/packages/plugins/eslint-plugin-react-naming-convention/package.json b/packages/plugins/eslint-plugin-react-naming-convention/package.json index d3655d9e6..bd569a34b 100644 --- a/packages/plugins/eslint-plugin-react-naming-convention/package.json +++ b/packages/plugins/eslint-plugin-react-naming-convention/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-react-naming-convention", - "version": "1.5.31-next.1", + "version": "1.5.31-beta.1", "description": "ESLint React's ESLint plugin for naming convention related rules.", "homepage": "https://github.com/rel1cx/eslint-react", "bugs": { diff --git a/packages/plugins/eslint-plugin-react-x/package.json b/packages/plugins/eslint-plugin-react-x/package.json index d43698637..d30d7d7a3 100644 --- a/packages/plugins/eslint-plugin-react-x/package.json +++ b/packages/plugins/eslint-plugin-react-x/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-react-x", - "version": "1.5.31-next.1", + "version": "1.5.31-beta.1", "description": "ESLint React's ESLint plugin for React related rules.", "homepage": "https://github.com/rel1cx/eslint-react", "bugs": { diff --git a/packages/plugins/eslint-plugin-react-x/src/rules/no-leaked-conditional-rendering.ts b/packages/plugins/eslint-plugin-react-x/src/rules/no-leaked-conditional-rendering.ts index 4ed405627..25399c587 100644 --- a/packages/plugins/eslint-plugin-react-x/src/rules/no-leaked-conditional-rendering.ts +++ b/packages/plugins/eslint-plugin-react-x/src/rules/no-leaked-conditional-rendering.ts @@ -55,7 +55,7 @@ const allowedVariants = [ "truthy string", ] as const satisfies VariantType[]; -const tsHelper = { +const tsHelpers = { isAnyType: (type: ts.Type) => isTypeFlagSet(type, ts.TypeFlags.TypeParameter | ts.TypeFlags.Any), isBigIntType: (type: ts.Type) => isTypeFlagSet(type, ts.TypeFlags.BigIntLike), isBooleanType: (type: ts.Type) => isTypeFlagSet(type, ts.TypeFlags.BooleanLike), @@ -102,14 +102,14 @@ const tsHelper = { */ function inspectVariantTypes(types: ts.Type[]) { const variantTypes = new Set(); - if (types.some(tsHelper.isUnknownType)) { + if (types.some(tsHelpers.isUnknownType)) { variantTypes.add("unknown"); return variantTypes; } - if (types.some(tsHelper.isNullishType)) { + if (types.some(tsHelpers.isNullishType)) { variantTypes.add("nullish"); } - const booleans = types.filter(tsHelper.isBooleanType); + const booleans = types.filter(tsHelpers.isBooleanType); // If incoming type is either "true" or "false", there will be one type // object with intrinsicName set accordingly // If incoming type is boolean, there will be two type objects with @@ -134,40 +134,40 @@ function inspectVariantTypes(types: ts.Type[]) { break; } } - const strings = types.filter(tsHelper.isStringType); + const strings = types.filter(tsHelpers.isStringType); if (strings.length > 0) { const evaluated = match(strings) - .when(types => types.every(tsHelper.isTruthyStringType), F.constant("truthy string")) - .when(types => types.every(tsHelper.isFalsyStringType), F.constant("falsy string")) + .when(types => types.every(tsHelpers.isTruthyStringType), F.constant("truthy string")) + .when(types => types.every(tsHelpers.isFalsyStringType), F.constant("falsy string")) .otherwise(F.constant("string")); variantTypes.add(evaluated); } - const bigints = types.filter(tsHelper.isBigIntType); + const bigints = types.filter(tsHelpers.isBigIntType); if (bigints.length > 0) { const evaluated = match(bigints) - .when(types => types.every(tsHelper.isTruthyBigIntType), F.constant("truthy bigint")) - .when(types => types.every(tsHelper.isFalsyBigIntType), F.constant("falsy bigint")) + .when(types => types.every(tsHelpers.isTruthyBigIntType), F.constant("truthy bigint")) + .when(types => types.every(tsHelpers.isFalsyBigIntType), F.constant("falsy bigint")) .otherwise(F.constant("bigint")); variantTypes.add(evaluated); } - const numbers = types.filter(tsHelper.isNumberType); + const numbers = types.filter(tsHelpers.isNumberType); if (numbers.length > 0) { const evaluated = match(numbers) - .when(types => types.every(tsHelper.isTruthyNumberType), F.constant("truthy number")) - .when(types => types.every(tsHelper.isFalsyNumberType), F.constant("falsy number")) + .when(types => types.every(tsHelpers.isTruthyNumberType), F.constant("truthy number")) + .when(types => types.every(tsHelpers.isFalsyNumberType), F.constant("falsy number")) .otherwise(F.constant("number")); variantTypes.add(evaluated); } - if (types.some(tsHelper.isEnumType)) { + if (types.some(tsHelpers.isEnumType)) { variantTypes.add("enum"); } - if (types.some(tsHelper.isObjectType)) { + if (types.some(tsHelpers.isObjectType)) { variantTypes.add("object"); } - if (types.some(tsHelper.isAnyType)) { + if (types.some(tsHelpers.isAnyType)) { variantTypes.add("any"); } - if (types.some(tsHelper.isNeverType)) { + if (types.some(tsHelpers.isNeverType)) { variantTypes.add("never"); } return variantTypes; diff --git a/packages/plugins/eslint-plugin/package.json b/packages/plugins/eslint-plugin/package.json index a6846820f..82367edda 100644 --- a/packages/plugins/eslint-plugin/package.json +++ b/packages/plugins/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@eslint-react/eslint-plugin", - "version": "1.5.31-next.1", + "version": "1.5.31-beta.1", "description": "The main ESLint plugin of ESLint React. Contains all the rules and presets of ESLint React.", "keywords": [ "eslint", diff --git a/packages/shared/package.json b/packages/shared/package.json index bc8ce6fbc..6d94cc1d1 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@eslint-react/shared", - "version": "1.5.31-next.1", + "version": "1.5.31-beta.1", "description": "ESLint React's Shared constants and functions.", "homepage": "https://github.com/rel1cx/eslint-react", "bugs": { diff --git a/packages/tools/package.json b/packages/tools/package.json index f347448e1..2fd5c09ca 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@eslint-react/tools", - "version": "1.5.31-next.1", + "version": "1.5.31-beta.1", "description": "ESLint React's std library and primitives.", "homepage": "https://github.com/rel1cx/eslint-react", "bugs": { diff --git a/packages/types/package.json b/packages/types/package.json index e173a3cf5..74bcec0cb 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@eslint-react/types", - "version": "1.5.31-next.1", + "version": "1.5.31-beta.1", "description": "ESLint React's type definitions.", "homepage": "https://github.com/rel1cx/eslint-react", "bugs": { diff --git a/packages/utilities/ast/package.json b/packages/utilities/ast/package.json index 71967c7a1..9ba5779fc 100644 --- a/packages/utilities/ast/package.json +++ b/packages/utilities/ast/package.json @@ -1,6 +1,6 @@ { "name": "@eslint-react/ast", - "version": "1.5.31-next.1", + "version": "1.5.31-beta.1", "description": "ESLint React's TSESTree AST utility module.", "homepage": "https://github.com/rel1cx/eslint-react", "bugs": { diff --git a/packages/utilities/jsx/package.json b/packages/utilities/jsx/package.json index 35f4f7314..7be2ba390 100644 --- a/packages/utilities/jsx/package.json +++ b/packages/utilities/jsx/package.json @@ -1,6 +1,6 @@ { "name": "@eslint-react/jsx", - "version": "1.5.31-next.1", + "version": "1.5.31-beta.1", "description": "ESLint React's TSESTree AST utility module for static analysis of JSX.", "homepage": "https://github.com/rel1cx/eslint-react", "bugs": { diff --git a/packages/utilities/var/package.json b/packages/utilities/var/package.json index 4d5d21242..3b98c3adb 100644 --- a/packages/utilities/var/package.json +++ b/packages/utilities/var/package.json @@ -1,6 +1,6 @@ { "name": "@eslint-react/var", - "version": "1.5.31-next.1", + "version": "1.5.31-beta.1", "description": "TSESTree AST utility module for static analysis of variables", "homepage": "https://github.com/rel1cx/eslint-react", "bugs": {