eslint-plugin-react-naming-convention 1.23.1 → 1.23.2-beta.6

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 (3) hide show
  1. package/dist/index.js +20 -20
  2. package/dist/index.mjs +22 -22
  3. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ var path__default = /*#__PURE__*/_interopDefault(path);
36
36
 
37
37
  // package.json
38
38
  var name = "eslint-plugin-react-naming-convention";
39
- var version = "1.23.1";
39
+ var version = "1.23.2-beta.6";
40
40
  var createRule = shared.createRuleForPlugin("naming-convention");
41
41
 
42
42
  // src/rules/component-name.ts
@@ -97,7 +97,7 @@ function validate(name2, options) {
97
97
  normalized = normalized.replace(/^_/, "");
98
98
  }
99
99
  return tsPattern.match(options.rule).with("CONSTANT_CASE", () => shared.RE_CONSTANT_CASE.test(normalized)).with("PascalCase", () => {
100
- if ([...normalized].length > 3 && /^[A-Z]+$/u.test(normalized)) return options.allowAllCaps;
100
+ if (normalized.length > 3 && /^[A-Z]+$/u.test(normalized)) return options.allowAllCaps;
101
101
  return shared.RE_PASCAL_CASE.test(normalized);
102
102
  }).otherwise(eff.F.constFalse);
103
103
  }
@@ -137,11 +137,10 @@ var component_name_default = createRule({
137
137
  const functionComponents = collector.ctx.getAllComponents(node);
138
138
  const classComponents = collectorLegacy.ctx.getAllComponents(node);
139
139
  for (const { node: component } of functionComponents.values()) {
140
- const maybeId = AST__namespace.getFunctionIdentifier(component);
141
- if (eff.O.isNone(maybeId)) continue;
142
- const id = maybeId.value;
143
- const { name: name2 } = id;
144
- if (validate(name2, options)) continue;
140
+ const mbId = AST__namespace.getFunctionIdentifier(component);
141
+ if (eff.O.isNone(mbId)) continue;
142
+ const id = mbId.value;
143
+ if (validate(id.name, options)) continue;
145
144
  context.report({
146
145
  messageId: "componentName",
147
146
  node: id,
@@ -151,18 +150,19 @@ var component_name_default = createRule({
151
150
  });
152
151
  }
153
152
  for (const { node: component } of classComponents.values()) {
154
- const maybeId = AST__namespace.getClassIdentifier(component);
155
- if (eff.O.isNone(maybeId)) continue;
156
- const id = maybeId.value;
157
- const { name: name2 } = id;
158
- if (validate(name2, options)) continue;
159
- context.report({
160
- messageId: "componentName",
161
- node: id,
162
- data: {
163
- case: options.rule
164
- }
165
- });
153
+ eff.F.pipe(
154
+ AST__namespace.getClassIdentifier(component),
155
+ eff.O.filter((id) => !validate(id.name, options)),
156
+ eff.O.map((id) => {
157
+ context.report({
158
+ messageId: "componentName",
159
+ node: id,
160
+ data: {
161
+ case: options.rule
162
+ }
163
+ });
164
+ })
165
+ );
166
166
  }
167
167
  }
168
168
  };
@@ -366,7 +366,7 @@ var use_state_default = createRule({
366
366
  },
367
367
  name: RULE_NAME4,
368
368
  create(context) {
369
- const alias = shared.decodeSettings(context.settings).additionalHooks?.useState ?? [];
369
+ const alias = shared.getSettingsFromContext(context).additionalHooks?.useState ?? [];
370
370
  const { ctx, listeners } = core.useComponentCollector(context);
371
371
  return {
372
372
  ...listeners,
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as AST from '@eslint-react/ast';
2
2
  import { useComponentCollector, useComponentCollectorLegacy, isUseStateCall, isReactHookCallWithNameLoose } from '@eslint-react/core';
3
- import { O, isString, isObject, F, isNullable } from '@eslint-react/eff';
3
+ import { O, F, isString, isObject, isNullable } from '@eslint-react/eff';
4
4
  import * as JSX from '@eslint-react/jsx';
5
- import { createRuleForPlugin, decodeSettings, RE_CONSTANT_CASE, RE_PASCAL_CASE, RE_CAMEL_CASE, RE_KEBAB_CASE, RE_SNAKE_CASE } from '@eslint-react/shared';
5
+ import { createRuleForPlugin, getSettingsFromContext, RE_CONSTANT_CASE, RE_PASCAL_CASE, RE_CAMEL_CASE, RE_KEBAB_CASE, RE_SNAKE_CASE } from '@eslint-react/shared';
6
6
  import { match } from 'ts-pattern';
7
7
  import path from 'node:path';
8
8
  import { capitalize, pascalCase, camelCase, kebabCase, snakeCase } from 'string-ts';
@@ -10,7 +10,7 @@ import { AST_NODE_TYPES } from '@typescript-eslint/types';
10
10
 
11
11
  // package.json
12
12
  var name = "eslint-plugin-react-naming-convention";
13
- var version = "1.23.1";
13
+ var version = "1.23.2-beta.6";
14
14
  var createRule = createRuleForPlugin("naming-convention");
15
15
 
16
16
  // src/rules/component-name.ts
@@ -71,7 +71,7 @@ function validate(name2, options) {
71
71
  normalized = normalized.replace(/^_/, "");
72
72
  }
73
73
  return match(options.rule).with("CONSTANT_CASE", () => RE_CONSTANT_CASE.test(normalized)).with("PascalCase", () => {
74
- if ([...normalized].length > 3 && /^[A-Z]+$/u.test(normalized)) return options.allowAllCaps;
74
+ if (normalized.length > 3 && /^[A-Z]+$/u.test(normalized)) return options.allowAllCaps;
75
75
  return RE_PASCAL_CASE.test(normalized);
76
76
  }).otherwise(F.constFalse);
77
77
  }
@@ -111,11 +111,10 @@ var component_name_default = createRule({
111
111
  const functionComponents = collector.ctx.getAllComponents(node);
112
112
  const classComponents = collectorLegacy.ctx.getAllComponents(node);
113
113
  for (const { node: component } of functionComponents.values()) {
114
- const maybeId = AST.getFunctionIdentifier(component);
115
- if (O.isNone(maybeId)) continue;
116
- const id = maybeId.value;
117
- const { name: name2 } = id;
118
- if (validate(name2, options)) continue;
114
+ const mbId = AST.getFunctionIdentifier(component);
115
+ if (O.isNone(mbId)) continue;
116
+ const id = mbId.value;
117
+ if (validate(id.name, options)) continue;
119
118
  context.report({
120
119
  messageId: "componentName",
121
120
  node: id,
@@ -125,18 +124,19 @@ var component_name_default = createRule({
125
124
  });
126
125
  }
127
126
  for (const { node: component } of classComponents.values()) {
128
- const maybeId = AST.getClassIdentifier(component);
129
- if (O.isNone(maybeId)) continue;
130
- const id = maybeId.value;
131
- const { name: name2 } = id;
132
- if (validate(name2, options)) continue;
133
- context.report({
134
- messageId: "componentName",
135
- node: id,
136
- data: {
137
- case: options.rule
138
- }
139
- });
127
+ F.pipe(
128
+ AST.getClassIdentifier(component),
129
+ O.filter((id) => !validate(id.name, options)),
130
+ O.map((id) => {
131
+ context.report({
132
+ messageId: "componentName",
133
+ node: id,
134
+ data: {
135
+ case: options.rule
136
+ }
137
+ });
138
+ })
139
+ );
140
140
  }
141
141
  }
142
142
  };
@@ -340,7 +340,7 @@ var use_state_default = createRule({
340
340
  },
341
341
  name: RULE_NAME4,
342
342
  create(context) {
343
- const alias = decodeSettings(context.settings).additionalHooks?.useState ?? [];
343
+ const alias = getSettingsFromContext(context).additionalHooks?.useState ?? [];
344
344
  const { ctx, listeners } = useComponentCollector(context);
345
345
  return {
346
346
  ...listeners,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-naming-convention",
3
- "version": "1.23.1",
3
+ "version": "1.23.2-beta.6",
4
4
  "description": "ESLint React's ESLint plugin for naming convention related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -41,21 +41,21 @@
41
41
  "./package.json"
42
42
  ],
43
43
  "dependencies": {
44
- "@typescript-eslint/scope-manager": "^8.19.0",
45
- "@typescript-eslint/type-utils": "^8.19.0",
46
- "@typescript-eslint/types": "^8.19.0",
47
- "@typescript-eslint/utils": "^8.19.0",
44
+ "@typescript-eslint/scope-manager": "^8.19.1",
45
+ "@typescript-eslint/type-utils": "^8.19.1",
46
+ "@typescript-eslint/types": "^8.19.1",
47
+ "@typescript-eslint/utils": "^8.19.1",
48
48
  "string-ts": "^2.2.0",
49
49
  "ts-pattern": "^5.6.0",
50
- "@eslint-react/jsx": "1.23.1",
51
- "@eslint-react/shared": "1.23.1",
52
- "@eslint-react/eff": "1.23.1",
53
- "@eslint-react/types": "1.23.1",
54
- "@eslint-react/core": "1.23.1",
55
- "@eslint-react/ast": "1.23.1"
50
+ "@eslint-react/ast": "1.23.2-beta.6",
51
+ "@eslint-react/core": "1.23.2-beta.6",
52
+ "@eslint-react/jsx": "1.23.2-beta.6",
53
+ "@eslint-react/eff": "1.23.2-beta.6",
54
+ "@eslint-react/shared": "1.23.2-beta.6",
55
+ "@eslint-react/types": "1.23.2-beta.6"
56
56
  },
57
57
  "devDependencies": {
58
- "@types/react": "^19.0.2",
58
+ "@types/react": "^19.0.3",
59
59
  "@types/react-dom": "^19.0.2",
60
60
  "tsup": "^8.3.5",
61
61
  "@workspace/configs": "0.0.0"