eslint-plugin-react-naming-convention 2.8.1 → 2.8.2-next.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 +10 -10
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, defineRuleListener, getConfigAdapters, getSettingsFromContext, toRegExp } from "@eslint-react/shared";
2
- import { isComponentName, isCreateContextCall, isUseRefCall, isUseStateCall, useComponentCollector, useComponentCollectorLegacy } from "@eslint-react/core";
2
+ import * as core from "@eslint-react/core";
3
3
  import { ESLintUtils } from "@typescript-eslint/utils";
4
4
  import { findEnclosingAssignmentTarget } from "@eslint-react/var";
5
5
  import { AST_NODE_TYPES } from "@typescript-eslint/types";
@@ -8,7 +8,7 @@ import { P, match } from "ts-pattern";
8
8
  import path from "node:path";
9
9
  import { camelCase, kebabCase, pascalCase, snakeCase } from "string-ts";
10
10
  import { isObject } from "@eslint-react/eff";
11
- import * as AST from "@eslint-react/ast";
11
+ import * as ast from "@eslint-react/ast";
12
12
 
13
13
  //#region rolldown:runtime
14
14
  var __defProp = Object.defineProperty;
@@ -42,7 +42,7 @@ const rules = {
42
42
  //#endregion
43
43
  //#region package.json
44
44
  var name = "eslint-plugin-react-naming-convention";
45
- var version = "2.8.1";
45
+ var version = "2.8.2-next.0";
46
46
 
47
47
  //#endregion
48
48
  //#region src/utils/create-rule.ts
@@ -95,8 +95,8 @@ var component_name_default = createRule({
95
95
  function create$5(context) {
96
96
  const options = normalizeOptions(context.options);
97
97
  const { rule } = options;
98
- const fCollector = useComponentCollector(context);
99
- const cCollector = useComponentCollectorLegacy(context);
98
+ const fCollector = core.useComponentCollector(context);
99
+ const cCollector = core.useComponentCollectorLegacy(context);
100
100
  return defineRuleListener(fCollector.visitor, cCollector.visitor, { "Program:exit"(program) {
101
101
  for (const { id, name, node: component } of fCollector.ctx.getAllComponents(program)) {
102
102
  if (isValidName(name, options)) continue;
@@ -165,7 +165,7 @@ function create$4(context) {
165
165
  const { version } = getSettingsFromContext(context);
166
166
  if (compare(version, "19.0.0", "<")) return {};
167
167
  return { CallExpression(node) {
168
- if (!isCreateContextCall(context, node)) return;
168
+ if (!core.isCreateContextCall(context, node)) return;
169
169
  const [id, name] = match(findEnclosingAssignmentTarget(node)).with({
170
170
  type: AST_NODE_TYPES.Identifier,
171
171
  name: P.string
@@ -174,7 +174,7 @@ function create$4(context) {
174
174
  property: { name: P.string }
175
175
  }, (id) => [id, id.property.name]).otherwise(() => [null, null]);
176
176
  if (id == null) return;
177
- if (isComponentName(name) && name.endsWith("Context")) return;
177
+ if (core.isComponentName(name) && name.endsWith("Context")) return;
178
178
  context.report({
179
179
  messageId: "invalidContextName",
180
180
  node: id
@@ -376,8 +376,8 @@ var ref_name_default = createRule({
376
376
  function create$1(context) {
377
377
  if (!context.sourceCode.text.includes("useRef")) return {};
378
378
  return { CallExpression(node) {
379
- if (!isUseRefCall(node)) return;
380
- if (AST.getUnderlyingExpression(node.parent).type === AST_NODE_TYPES.MemberExpression) return;
379
+ if (!core.isUseRefCall(node)) return;
380
+ if (ast.getUnderlyingExpression(node.parent).type === AST_NODE_TYPES.MemberExpression) return;
381
381
  const [id, name] = match(findEnclosingAssignmentTarget(node)).with({
382
382
  type: AST_NODE_TYPES.Identifier,
383
383
  name: P.string
@@ -432,7 +432,7 @@ var use_state_default = createRule({
432
432
  function create(context) {
433
433
  const { enforceAssignment = false, enforceSetterName = true } = context.options[0] ?? defaultOptions[0];
434
434
  return { CallExpression(node) {
435
- if (!isUseStateCall(node)) return;
435
+ if (!core.isUseStateCall(node)) return;
436
436
  if (node.parent.type !== AST_NODE_TYPES.VariableDeclarator) {
437
437
  if (!enforceAssignment) return;
438
438
  context.report({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-naming-convention",
3
- "version": "2.8.1",
3
+ "version": "2.8.2-next.0",
4
4
  "description": "ESLint React's ESLint plugin for naming convention related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -45,11 +45,11 @@
45
45
  "compare-versions": "^6.1.1",
46
46
  "string-ts": "^2.3.1",
47
47
  "ts-pattern": "^5.9.0",
48
- "@eslint-react/ast": "2.8.1",
49
- "@eslint-react/core": "2.8.1",
50
- "@eslint-react/eff": "2.8.1",
51
- "@eslint-react/shared": "2.8.1",
52
- "@eslint-react/var": "2.8.1"
48
+ "@eslint-react/core": "2.8.2-next.0",
49
+ "@eslint-react/eff": "2.8.2-next.0",
50
+ "@eslint-react/shared": "2.8.2-next.0",
51
+ "@eslint-react/var": "2.8.2-next.0",
52
+ "@eslint-react/ast": "2.8.2-next.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/react": "^19.2.10",