Skip to content

Commit

Permalink
release: 1.5.31-beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Rel1cx committed Jul 23, 2024
1 parent c6a3d45 commit e26b9cd
Show file tree
Hide file tree
Showing 17 changed files with 125 additions and 32 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.31-next.1
1.5.31-beta.1
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin-react-debug/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <host>{ count }</host>;
// }

// 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<typeof component.props>) {
// return <host shadowDom>Hello, {name}</host>;
// }

// 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<typeof component.props>) {
// return <host shadowDom>Hello, {name}</host>;
// }

// 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,
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin-react-dom/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin-react-x/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -102,14 +102,14 @@ const tsHelper = {
*/
function inspectVariantTypes(types: ts.Type[]) {
const variantTypes = new Set<VariantType>();
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
Expand All @@ -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<ts.Type[], VariantType>(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<ts.Type[], VariantType>(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<ts.Type[], VariantType>(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;
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/tools/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/ast/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/jsx/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/var/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit e26b9cd

Please sign in to comment.