eslint-plugin-react-x 2.4.1-beta.11 → 2.4.1-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +34 -20
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, coerceSettings, getConfigAdapters, getSettingsFromContext, report, toRegExp } from "@eslint-react/shared";
2
2
  import { AST_NODE_TYPES } from "@typescript-eslint/types";
3
3
  import { ESLintUtils } from "@typescript-eslint/utils";
4
- import { isFalseLiteralType, isPropertyReadonlyInType, isTrueLiteralType, isTypeFlagSet, unionConstituents } from "ts-api-utils";
5
4
  import { P, isMatching, match } from "ts-pattern";
6
5
  import ts from "typescript";
7
6
  import * as AST from "@eslint-react/ast";
@@ -11,6 +10,7 @@ import { constFalse, constTrue, flow, getOrElseUpdate, identity, unit } from "@e
11
10
  import { compare } from "compare-versions";
12
11
  import { getConstrainedTypeAtLocation, isTypeReadonly } from "@typescript-eslint/type-utils";
13
12
  import { getStaticValue, isIdentifier, isVariableDeclarator } from "@typescript-eslint/utils/ast-utils";
13
+ import { isPropertyReadonlyInType, unionConstituents } from "ts-api-utils";
14
14
  import "@typescript-eslint/utils/ts-eslint";
15
15
  import { getTypeImmutability, isImmutable, isReadonlyDeep, isReadonlyShallow, isUnknown } from "is-immutable-type";
16
16
  import { camelCase } from "string-ts";
@@ -34,7 +34,7 @@ var __exportAll = (all, symbols) => {
34
34
  //#endregion
35
35
  //#region package.json
36
36
  var name$6 = "eslint-plugin-react-x";
37
- var version = "2.4.1-beta.11";
37
+ var version = "2.4.1-beta.13";
38
38
 
39
39
  //#endregion
40
40
  //#region src/utils/create-rule.ts
@@ -45,6 +45,20 @@ const createRule = ESLintUtils.RuleCreator(getDocsUrl);
45
45
 
46
46
  //#endregion
47
47
  //#region src/utils/type-is.ts
48
+ function isFlagSet(allFlags, flag) {
49
+ return (allFlags & flag) !== 0;
50
+ }
51
+ function isFlagSetOnObject(obj, flag) {
52
+ return isFlagSet(obj.flags, flag);
53
+ }
54
+ const isTypeFlagSet = isFlagSetOnObject;
55
+ function isBooleanLiteralType(type) {
56
+ return isTypeFlagSet(type, ts.TypeFlags.BooleanLiteral);
57
+ }
58
+ /** @internal */
59
+ const isFalseLiteralType = (type) => isBooleanLiteralType(type) && type.intrinsicName === "false";
60
+ /** @internal */
61
+ const isTrueLiteralType = (type) => isBooleanLiteralType(type) && type.intrinsicName === "true";
48
62
  /** @internal */
49
63
  const isAnyType = (type) => isTypeFlagSet(type, ts.TypeFlags.TypeParameter | ts.TypeFlags.Any);
50
64
  /** @internal */
@@ -217,7 +231,7 @@ const RULE_NAME$60 = "jsx-no-comment-textnodes";
217
231
  var jsx_no_comment_textnodes_default = createRule({
218
232
  meta: {
219
233
  type: "problem",
220
- docs: { description: "Prevents comment strings (e.g., beginning with '//' or '/*') from being accidentally inserted into the JSX element's textnodes." },
234
+ docs: { description: "Prevents comment strings (e.g., beginning with '//' or '/*') from being accidentally inserted into a JSX element's text nodes." },
221
235
  messages: { jsxNoCommentTextnodes: "Possible misused comment in text node. Comments inside children section of tag should be placed inside braces." },
222
236
  schema: []
223
237
  },
@@ -443,7 +457,7 @@ const RULE_NAME$54 = "jsx-uses-react";
443
457
  var jsx_uses_react_default = createRule({
444
458
  meta: {
445
459
  type: "problem",
446
- docs: { description: "Marks React variables as used when JSX is used." },
460
+ docs: { description: "Marks React variables as used when JSX is present." },
447
461
  messages: { jsxUsesReact: "Marked {{name}} as used." },
448
462
  schema: []
449
463
  },
@@ -639,7 +653,7 @@ function getIdentifiersFromBinaryExpression(side) {
639
653
  var no_array_index_key_default = createRule({
640
654
  meta: {
641
655
  type: "problem",
642
- docs: { description: "Disallows an item's index in the array as its key." },
656
+ docs: { description: "Disallows using an item's index in the array as its key." },
643
657
  messages: { noArrayIndexKey: "Do not use item index in the array as its key." },
644
658
  schema: []
645
659
  },
@@ -911,7 +925,7 @@ const RULE_NAME$42 = "no-component-will-mount";
911
925
  var no_component_will_mount_default = createRule({
912
926
  meta: {
913
927
  type: "problem",
914
- docs: { description: "Replaces usages of 'componentWillMount' with 'UNSAFE_componentWillMount'." },
928
+ docs: { description: "Replaces usage of 'componentWillMount' with 'UNSAFE_componentWillMount'." },
915
929
  fixable: "code",
916
930
  messages: { noComponentWillMount: "[Deprecated] Use 'UNSAFE_componentWillMount' instead." },
917
931
  schema: []
@@ -947,7 +961,7 @@ const RULE_NAME$41 = "no-component-will-receive-props";
947
961
  var no_component_will_receive_props_default = createRule({
948
962
  meta: {
949
963
  type: "problem",
950
- docs: { description: "Replaces usages of 'componentWillReceiveProps' with 'UNSAFE_componentWillReceiveProps'." },
964
+ docs: { description: "Replaces usage of 'componentWillReceiveProps' with 'UNSAFE_componentWillReceiveProps'." },
951
965
  fixable: "code",
952
966
  messages: { noComponentWillReceiveProps: "[Deprecated] Use 'UNSAFE_componentWillReceiveProps' instead." },
953
967
  schema: []
@@ -983,7 +997,7 @@ const RULE_NAME$40 = "no-component-will-update";
983
997
  var no_component_will_update_default = createRule({
984
998
  meta: {
985
999
  type: "problem",
986
- docs: { description: "Replaces usages of 'componentWillUpdate' with 'UNSAFE_componentWillUpdate'." },
1000
+ docs: { description: "Replaces usage of 'componentWillUpdate' with 'UNSAFE_componentWillUpdate'." },
987
1001
  fixable: "code",
988
1002
  messages: { noComponentWillUpdate: "[Deprecated] Use 'UNSAFE_componentWillUpdate' instead." },
989
1003
  schema: []
@@ -1019,7 +1033,7 @@ const RULE_NAME$39 = "no-context-provider";
1019
1033
  var no_context_provider_default = createRule({
1020
1034
  meta: {
1021
1035
  type: "problem",
1022
- docs: { description: "Replaces usages of '<Context.Provider>' with '<Context>'." },
1036
+ docs: { description: "Replaces usage of '<Context.Provider>' with '<Context>'." },
1023
1037
  fixable: "code",
1024
1038
  messages: { noContextProvider: "In React 19, you can render '<Context>' as a provider instead of '<Context.Provider>'." },
1025
1039
  schema: []
@@ -1210,7 +1224,7 @@ const RULE_NAME$34 = "no-forward-ref";
1210
1224
  var no_forward_ref_default = createRule({
1211
1225
  meta: {
1212
1226
  type: "problem",
1213
- docs: { description: "Replaces usages of 'forwardRef' with passing 'ref' as a prop." },
1227
+ docs: { description: "Replaces usage of 'forwardRef' with passing 'ref' as a prop." },
1214
1228
  fixable: "code",
1215
1229
  messages: { noForwardRef: "In React 19, 'forwardRef' is no longer necessary. Pass 'ref' as a prop instead." },
1216
1230
  schema: []
@@ -1892,8 +1906,8 @@ const RULE_NAME$23 = "no-set-state-in-component-did-mount";
1892
1906
  var no_set_state_in_component_did_mount_default = createRule({
1893
1907
  meta: {
1894
1908
  type: "problem",
1895
- docs: { description: "Disallows calling 'this.setState' in 'componentDidMount' outside of functions such as callbacks." },
1896
- messages: { noSetStateInComponentDidMount: "Do not call `this.setState` in `componentDidMount` outside of functions such as callbacks." },
1909
+ docs: { description: "Disallows calling 'this.setState' in 'componentDidMount' outside functions such as callbacks." },
1910
+ messages: { noSetStateInComponentDidMount: "Do not call `this.setState` in `componentDidMount` outside functions such as callbacks." },
1897
1911
  schema: []
1898
1912
  },
1899
1913
  name: RULE_NAME$23,
@@ -1922,8 +1936,8 @@ const RULE_NAME$22 = "no-set-state-in-component-did-update";
1922
1936
  var no_set_state_in_component_did_update_default = createRule({
1923
1937
  meta: {
1924
1938
  type: "problem",
1925
- docs: { description: "Disallows calling 'this.setState' in 'componentDidUpdate' outside of functions such as callbacks." },
1926
- messages: { noSetStateInComponentDidUpdate: "Do not call `this.setState` in `componentDidUpdate` outside of functions such as callbacks." },
1939
+ docs: { description: "Disallows calling 'this.setState' in 'componentDidUpdate' outside functions such as callbacks." },
1940
+ messages: { noSetStateInComponentDidUpdate: "Do not call `this.setState` in `componentDidUpdate` outside functions such as callbacks." },
1927
1941
  schema: []
1928
1942
  },
1929
1943
  name: RULE_NAME$22,
@@ -1952,8 +1966,8 @@ const RULE_NAME$21 = "no-set-state-in-component-will-update";
1952
1966
  var no_set_state_in_component_will_update_default = createRule({
1953
1967
  meta: {
1954
1968
  type: "problem",
1955
- docs: { description: "Disallows calling 'this.setState' in 'componentWillUpdate' outside of functions such as callbacks." },
1956
- messages: { noSetStateInComponentWillUpdate: "Do not call `this.setState` in `componentWillUpdate` outside of functions such as callbacks." },
1969
+ docs: { description: "Disallows calling 'this.setState' in 'componentWillUpdate' outside functions such as callbacks." },
1970
+ messages: { noSetStateInComponentWillUpdate: "Do not call `this.setState` in `componentWillUpdate` outside functions such as callbacks." },
1957
1971
  schema: []
1958
1972
  },
1959
1973
  name: RULE_NAME$21,
@@ -2273,7 +2287,7 @@ const RULE_NAME$15 = "no-unsafe-component-will-mount";
2273
2287
  var no_unsafe_component_will_mount_default = createRule({
2274
2288
  meta: {
2275
2289
  type: "problem",
2276
- docs: { description: "Warns about the usage of 'UNSAFE_componentWillMount' in class components." },
2290
+ docs: { description: "Warns about the use of 'UNSAFE_componentWillMount' in class components." },
2277
2291
  messages: { noUnsafeComponentWillMount: "Do not use 'UNSAFE_componentWillMount'." },
2278
2292
  schema: []
2279
2293
  },
@@ -2304,7 +2318,7 @@ const RULE_NAME$14 = "no-unsafe-component-will-receive-props";
2304
2318
  var no_unsafe_component_will_receive_props_default = createRule({
2305
2319
  meta: {
2306
2320
  type: "problem",
2307
- docs: { description: "Warns about the usage of 'UNSAFE_componentWillReceiveProps' in class components." },
2321
+ docs: { description: "Warns about the use of 'UNSAFE_componentWillReceiveProps' in class components." },
2308
2322
  messages: { noUnsafeComponentWillReceiveProps: "Do not use 'UNSAFE_componentWillReceiveProps'." },
2309
2323
  schema: []
2310
2324
  },
@@ -2335,7 +2349,7 @@ const RULE_NAME$13 = "no-unsafe-component-will-update";
2335
2349
  var no_unsafe_component_will_update_default = createRule({
2336
2350
  meta: {
2337
2351
  type: "problem",
2338
- docs: { description: "Warns about the usage of 'UNSAFE_componentWillUpdate' in class components." },
2352
+ docs: { description: "Warns about the use of 'UNSAFE_componentWillUpdate' in class components." },
2339
2353
  messages: { noUnsafeComponentWillUpdate: "Do not use 'UNSAFE_componentWillUpdate'." },
2340
2354
  schema: []
2341
2355
  },
@@ -2855,7 +2869,7 @@ const RULE_NAME$7 = "no-use-context";
2855
2869
  var no_use_context_default = createRule({
2856
2870
  meta: {
2857
2871
  type: "problem",
2858
- docs: { description: "Replaces usages of 'useContext' with 'use'." },
2872
+ docs: { description: "Replaces usage of 'useContext' with 'use'." },
2859
2873
  fixable: "code",
2860
2874
  messages: { noUseContext: "In React 19, 'use' is preferred over 'useContext' because it is more flexible." },
2861
2875
  schema: []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "2.4.1-beta.11",
3
+ "version": "2.4.1-beta.13",
4
4
  "description": "A set of composable ESLint rules for for libraries and frameworks that use React as a UI runtime.",
5
5
  "keywords": [
6
6
  "react",
@@ -46,16 +46,16 @@
46
46
  "string-ts": "^2.3.1",
47
47
  "ts-api-utils": "^2.3.0",
48
48
  "ts-pattern": "^5.9.0",
49
- "@eslint-react/core": "2.4.1-beta.11",
50
- "@eslint-react/eff": "2.4.1-beta.11",
51
- "@eslint-react/ast": "2.4.1-beta.11",
52
- "@eslint-react/shared": "2.4.1-beta.11",
53
- "@eslint-react/var": "2.4.1-beta.11"
49
+ "@eslint-react/ast": "2.4.1-beta.13",
50
+ "@eslint-react/shared": "2.4.1-beta.13",
51
+ "@eslint-react/core": "2.4.1-beta.13",
52
+ "@eslint-react/eff": "2.4.1-beta.13",
53
+ "@eslint-react/var": "2.4.1-beta.13"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/react": "^19.2.7",
57
57
  "@types/react-dom": "^19.2.3",
58
- "tsdown": "^0.18.3",
58
+ "tsdown": "^0.18.4",
59
59
  "@local/configs": "0.0.0"
60
60
  },
61
61
  "peerDependencies": {