eslint-plugin-react-naming-convention 2.5.2-next.0 → 2.5.3-beta.0

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 +6 -3
  2. package/package.json +12 -11
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
1
- import { RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, getConfigAdapters, toRegExp } from "@eslint-react/shared";
1
+ import { RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, getConfigAdapters, getSettingsFromContext, toRegExp } from "@eslint-react/shared";
2
2
  import * as AST from "@eslint-react/ast";
3
3
  import { getInstanceId, isComponentName, isCreateContextCall, isUseRefCall, isUseStateCall, useComponentCollector, useComponentCollectorLegacy } from "@eslint-react/core";
4
4
  import { ESLintUtils } from "@typescript-eslint/utils";
5
5
  import { AST_NODE_TYPES } from "@typescript-eslint/types";
6
+ import { compare } from "compare-versions";
6
7
  import { P, match } from "ts-pattern";
7
8
  import path from "node:path";
8
9
  import { camelCase, kebabCase, pascalCase, snakeCase } from "string-ts";
@@ -40,7 +41,7 @@ const rules = {
40
41
  //#endregion
41
42
  //#region package.json
42
43
  var name = "eslint-plugin-react-naming-convention";
43
- var version = "2.5.2-next.0";
44
+ var version = "2.5.3-beta.0";
44
45
 
45
46
  //#endregion
46
47
  //#region src/utils/create-rule.ts
@@ -170,6 +171,8 @@ var context_name_default = createRule({
170
171
  });
171
172
  function create$4(context) {
172
173
  if (!context.sourceCode.text.includes("createContext")) return {};
174
+ const { version: version$1 } = getSettingsFromContext(context);
175
+ if (compare(version$1, "19.0.0", "<")) return {};
173
176
  return { CallExpression(node) {
174
177
  if (!isCreateContextCall(context, node)) return;
175
178
  const [id, name$2] = match(getInstanceId(node)).with({
@@ -392,7 +395,7 @@ function create$1(context) {
392
395
  property: { name: P.string }
393
396
  }, (id$1) => [id$1, id$1.property.name]).otherwise(() => [null, null]);
394
397
  if (id == null) return;
395
- if (name$2.endsWith("Ref")) return;
398
+ if (name$2.endsWith("Ref") || name$2 === "ref") return;
396
399
  context.report({
397
400
  messageId: "invalidRefName",
398
401
  node: id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-naming-convention",
3
- "version": "2.5.2-next.0",
3
+ "version": "2.5.3-beta.0",
4
4
  "description": "ESLint React's ESLint plugin for naming convention related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -38,22 +38,23 @@
38
38
  "./package.json"
39
39
  ],
40
40
  "dependencies": {
41
- "@typescript-eslint/scope-manager": "^8.51.0",
42
- "@typescript-eslint/type-utils": "^8.51.0",
43
- "@typescript-eslint/types": "^8.51.0",
44
- "@typescript-eslint/utils": "^8.51.0",
41
+ "@typescript-eslint/scope-manager": "^8.52.0",
42
+ "@typescript-eslint/type-utils": "^8.52.0",
43
+ "@typescript-eslint/types": "^8.52.0",
44
+ "@typescript-eslint/utils": "^8.52.0",
45
+ "compare-versions": "^6.1.1",
45
46
  "string-ts": "^2.3.1",
46
47
  "ts-pattern": "^5.9.0",
47
- "@eslint-react/ast": "2.5.2-next.0",
48
- "@eslint-react/eff": "2.5.2-next.0",
49
- "@eslint-react/shared": "2.5.2-next.0",
50
- "@eslint-react/core": "2.5.2-next.0",
51
- "@eslint-react/var": "2.5.2-next.0"
48
+ "@eslint-react/ast": "2.5.3-beta.0",
49
+ "@eslint-react/core": "2.5.3-beta.0",
50
+ "@eslint-react/eff": "2.5.3-beta.0",
51
+ "@eslint-react/var": "2.5.3-beta.0",
52
+ "@eslint-react/shared": "2.5.3-beta.0"
52
53
  },
53
54
  "devDependencies": {
54
55
  "@types/react": "^19.2.7",
55
56
  "@types/react-dom": "^19.2.3",
56
- "tsdown": "^0.19.0-beta.2",
57
+ "tsdown": "^0.19.0-beta.5",
57
58
  "@local/configs": "0.0.0"
58
59
  },
59
60
  "peerDependencies": {