eslint-plugin-react-naming-convention 1.26.3-beta.6 → 1.26.3-beta.7

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.
package/dist/index.d.mts CHANGED
@@ -1,8 +1,10 @@
1
1
  import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
2
 
3
- type MessageID$1 = "filenameExtensionInvalid" | "filenameExtensionUnexpected";
3
+ type MessageID$2 = "useJsxFileExtension" | "useJsxFileExtensionAsNeeded";
4
4
 
5
- type MessageID = "filenameCaseMismatchSuggestion" | "filenameEmpty";
5
+ type MessageID$1 = "filenameCaseMismatchSuggestion" | "filenameEmpty";
6
+
7
+ type MessageID = "usePascalCase" | "useConstantCase";
6
8
 
7
9
  declare const _default: {
8
10
  readonly meta: {
@@ -10,24 +12,24 @@ declare const _default: {
10
12
  readonly version: string;
11
13
  };
12
14
  readonly rules: {
13
- readonly "component-name": _typescript_eslint_utils_ts_eslint.RuleModule<"componentName", readonly [("CONSTANT_CASE" | "PascalCase") | {
15
+ readonly "component-name": _typescript_eslint_utils_ts_eslint.RuleModule<MessageID, readonly [("CONSTANT_CASE" | "PascalCase") | {
14
16
  allowAllCaps?: boolean;
15
17
  allowLeadingUnderscore?: boolean;
16
18
  allowNamespace?: boolean;
17
19
  excepts?: readonly string[];
18
20
  rule?: "CONSTANT_CASE" | "PascalCase";
19
21
  } | undefined], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
20
- readonly filename: _typescript_eslint_utils_ts_eslint.RuleModule<MessageID, readonly [("PascalCase" | "camelCase" | "kebab-case" | "snake_case") | {
22
+ readonly filename: _typescript_eslint_utils_ts_eslint.RuleModule<MessageID$1, readonly [("PascalCase" | "camelCase" | "kebab-case" | "snake_case") | {
21
23
  excepts?: readonly string[];
22
24
  extensions?: readonly string[];
23
25
  rule?: "PascalCase" | "camelCase" | "kebab-case" | "snake_case";
24
26
  } | undefined], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
25
- readonly "filename-extension": _typescript_eslint_utils_ts_eslint.RuleModule<MessageID$1, readonly [("always" | "as-needed") | {
27
+ readonly "filename-extension": _typescript_eslint_utils_ts_eslint.RuleModule<MessageID$2, readonly [("always" | "as-needed") | {
26
28
  allow?: "always" | "as-needed";
27
29
  extensions?: readonly string[];
28
30
  ignoreFilesWithoutCode?: boolean;
29
31
  } | undefined], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
30
- readonly "use-state": _typescript_eslint_utils_ts_eslint.RuleModule<"useState", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
32
+ readonly "use-state": _typescript_eslint_utils_ts_eslint.RuleModule<"unexpected", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
31
33
  };
32
34
  };
33
35
 
package/dist/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
2
2
 
3
- type MessageID$1 = "filenameExtensionInvalid" | "filenameExtensionUnexpected";
3
+ type MessageID$2 = "useJsxFileExtension" | "useJsxFileExtensionAsNeeded";
4
4
 
5
- type MessageID = "filenameCaseMismatchSuggestion" | "filenameEmpty";
5
+ type MessageID$1 = "filenameCaseMismatchSuggestion" | "filenameEmpty";
6
+
7
+ type MessageID = "usePascalCase" | "useConstantCase";
6
8
 
7
9
  declare const _default: {
8
10
  readonly meta: {
@@ -10,24 +12,24 @@ declare const _default: {
10
12
  readonly version: string;
11
13
  };
12
14
  readonly rules: {
13
- readonly "component-name": _typescript_eslint_utils_ts_eslint.RuleModule<"componentName", readonly [("CONSTANT_CASE" | "PascalCase") | {
15
+ readonly "component-name": _typescript_eslint_utils_ts_eslint.RuleModule<MessageID, readonly [("CONSTANT_CASE" | "PascalCase") | {
14
16
  allowAllCaps?: boolean;
15
17
  allowLeadingUnderscore?: boolean;
16
18
  allowNamespace?: boolean;
17
19
  excepts?: readonly string[];
18
20
  rule?: "CONSTANT_CASE" | "PascalCase";
19
21
  } | undefined], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
20
- readonly filename: _typescript_eslint_utils_ts_eslint.RuleModule<MessageID, readonly [("PascalCase" | "camelCase" | "kebab-case" | "snake_case") | {
22
+ readonly filename: _typescript_eslint_utils_ts_eslint.RuleModule<MessageID$1, readonly [("PascalCase" | "camelCase" | "kebab-case" | "snake_case") | {
21
23
  excepts?: readonly string[];
22
24
  extensions?: readonly string[];
23
25
  rule?: "PascalCase" | "camelCase" | "kebab-case" | "snake_case";
24
26
  } | undefined], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
25
- readonly "filename-extension": _typescript_eslint_utils_ts_eslint.RuleModule<MessageID$1, readonly [("always" | "as-needed") | {
27
+ readonly "filename-extension": _typescript_eslint_utils_ts_eslint.RuleModule<MessageID$2, readonly [("always" | "as-needed") | {
26
28
  allow?: "always" | "as-needed";
27
29
  extensions?: readonly string[];
28
30
  ignoreFilesWithoutCode?: boolean;
29
31
  } | undefined], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
30
- readonly "use-state": _typescript_eslint_utils_ts_eslint.RuleModule<"useState", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
32
+ readonly "use-state": _typescript_eslint_utils_ts_eslint.RuleModule<"unexpected", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
31
33
  };
32
34
  };
33
35
 
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.26.3-beta.6";
39
+ var version = "1.26.3-beta.7";
40
40
  var createRule = shared.createRuleForPlugin("naming-convention");
41
41
 
42
42
  // src/rules/component-name.ts
@@ -90,26 +90,32 @@ function normalizeOptions(options) {
90
90
  excepts: opts.excepts?.map((pattern) => new RegExp(pattern, "u")) ?? []
91
91
  };
92
92
  }
93
- function validate(name2, options) {
94
- if (name2 == null) return false;
95
- if (options.excepts.some((regex) => regex.test(name2))) {
96
- return true;
93
+ function getViolationMessage(name2, options) {
94
+ if (name2 == null) return eff._;
95
+ const {
96
+ allowAllCaps = false,
97
+ allowLeadingUnderscore = false,
98
+ allowNamespace = false,
99
+ excepts,
100
+ rule
101
+ } = options;
102
+ if (excepts.some((regex) => regex.test(name2))) {
103
+ return eff._;
97
104
  }
98
105
  let normalized = name2.normalize("NFKD").replace(/[\u0300-\u036F]/g, "");
99
106
  normalized = normalized.split(".").at(-1) ?? normalized;
100
- const { allowLeadingUnderscore = false, allowNamespace = false } = options;
101
107
  if (allowNamespace) {
102
108
  normalized = normalized.replace(":", "");
103
109
  }
104
110
  if (allowLeadingUnderscore) {
105
111
  normalized = normalized.replace(/^_/, "");
106
112
  }
107
- return tsPattern.match(options.rule).with("CONSTANT_CASE", () => shared.RE_CONSTANT_CASE.test(normalized)).with("PascalCase", () => {
113
+ return tsPattern.match(rule).with("CONSTANT_CASE", () => shared.RE_CONSTANT_CASE.test(normalized) ? eff._ : "useConstantCase").with("PascalCase", () => {
108
114
  if (normalized.length > 3 && /^[A-Z]+$/u.test(normalized)) {
109
- return options.allowAllCaps ?? false;
115
+ return allowAllCaps ? eff._ : "usePascalCase";
110
116
  }
111
- return shared.RE_PASCAL_CASE.test(normalized);
112
- }).otherwise(eff.constFalse);
117
+ return shared.RE_PASCAL_CASE.test(normalized) ? eff._ : "usePascalCase";
118
+ }).otherwise(() => eff._);
113
119
  }
114
120
  var component_name_default = createRule({
115
121
  meta: {
@@ -119,7 +125,8 @@ var component_name_default = createRule({
119
125
  description: "enforce component naming convention to 'PascalCase' or 'CONSTANT_CASE'"
120
126
  },
121
127
  messages: {
122
- componentName: "A component name must be in {{case}}."
128
+ useConstantCase: "Component name '{{name}}' must be in CONSTANT_CASE.",
129
+ usePascalCase: "Component name '{{name}}' must be in PascalCase."
123
130
  },
124
131
  schema
125
132
  },
@@ -136,14 +143,13 @@ var component_name_default = createRule({
136
143
  if (/^[a-z]/u.test(name2)) {
137
144
  return;
138
145
  }
139
- if (validate(name2, options)) {
140
- return;
141
- }
146
+ const violation = getViolationMessage(name2, options);
147
+ if (violation == null) return;
142
148
  context.report({
143
- messageId: "componentName",
149
+ messageId: violation,
144
150
  node,
145
151
  data: {
146
- case: options.rule
152
+ name: name2
147
153
  }
148
154
  });
149
155
  },
@@ -153,29 +159,30 @@ var component_name_default = createRule({
153
159
  for (const { node: component } of functionComponents.values()) {
154
160
  const id = AST__namespace.getFunctionIdentifier(component);
155
161
  if (id?.name == null) continue;
156
- if (validate(id.name, options)) {
157
- continue;
158
- }
162
+ const name2 = id.name;
163
+ const violation = getViolationMessage(name2, options);
164
+ if (violation == null) continue;
159
165
  context.report({
160
- messageId: "componentName",
166
+ messageId: violation,
161
167
  node: id,
162
168
  data: {
163
- case: options.rule
169
+ name: name2
164
170
  }
165
171
  });
166
172
  }
167
173
  for (const { node: component } of classComponents.values()) {
168
174
  const id = AST__namespace.getClassIdentifier(component);
169
175
  if (id?.name == null) continue;
170
- if (!validate(id.name, options)) {
171
- context.report({
172
- messageId: "componentName",
173
- node: id,
174
- data: {
175
- case: options.rule
176
- }
177
- });
178
- }
176
+ const name2 = id.name;
177
+ const violation = getViolationMessage(name2, options);
178
+ if (violation == null) continue;
179
+ context.report({
180
+ messageId: violation,
181
+ node: id,
182
+ data: {
183
+ case: options.rule
184
+ }
185
+ });
179
186
  }
180
187
  }
181
188
  };
@@ -238,7 +245,7 @@ var filename_default = createRule({
238
245
  const options = context.options[0] ?? defaultOptions2[0];
239
246
  const rule = typeof options === "string" ? options : options.rule ?? "PascalCase";
240
247
  const excepts = typeof options === "string" ? [] : options.excepts ?? [];
241
- function validate2(name2, casing = rule, ignores = excepts) {
248
+ function validate(name2, casing = rule, ignores = excepts) {
242
249
  const shouldIgnore = ignores.map((pattern) => new RegExp(pattern, "u")).some((pattern) => pattern.test(name2));
243
250
  if (shouldIgnore) return true;
244
251
  return tsPattern.match(casing).with("PascalCase", () => shared.RE_PASCAL_CASE.test(name2)).with("camelCase", () => shared.RE_CAMEL_CASE.test(name2)).with("kebab-case", () => shared.RE_KEBAB_CASE.test(name2)).with("snake_case", () => shared.RE_SNAKE_CASE.test(name2)).exhaustive();
@@ -253,7 +260,7 @@ var filename_default = createRule({
253
260
  context.report({ messageId: "filenameEmpty", node });
254
261
  return;
255
262
  }
256
- if (validate2(basename)) {
263
+ if (validate(basename)) {
257
264
  return;
258
265
  }
259
266
  context.report({
@@ -314,8 +321,8 @@ var filename_extension_default = createRule({
314
321
  description: "enforce naming convention for JSX file extensions"
315
322
  },
316
323
  messages: {
317
- filenameExtensionInvalid: "The JSX file extension is required.",
318
- filenameExtensionUnexpected: "Use JSX file extension as needed."
324
+ useJsxFileExtension: "Use {{extensions}} file extension for JSX files.",
325
+ useJsxFileExtensionAsNeeded: "Do not use {{extensions}} file extension for files without JSX."
319
326
  },
320
327
  schema: schema3
321
328
  },
@@ -324,6 +331,7 @@ var filename_extension_default = createRule({
324
331
  const options = context.options[0] ?? defaultOptions3[0];
325
332
  const allow = eff.isObject(options) ? options.allow : options;
326
333
  const extensions = eff.isObject(options) && "extensions" in options ? options.extensions : defaultOptions3[0].extensions;
334
+ const extensionsString = extensions.map((ext) => `'${ext}'`).join(", ");
327
335
  const filename = context.filename;
328
336
  let hasJSXNode = false;
329
337
  return {
@@ -338,8 +346,11 @@ var filename_extension_default = createRule({
338
346
  const isJSXExt = extensions.includes(fileNameExt);
339
347
  if (hasJSXNode && !isJSXExt) {
340
348
  context.report({
341
- messageId: "filenameExtensionInvalid",
342
- node
349
+ messageId: "useJsxFileExtension",
350
+ node,
351
+ data: {
352
+ extensions: extensionsString
353
+ }
343
354
  });
344
355
  return;
345
356
  }
@@ -350,8 +361,11 @@ var filename_extension_default = createRule({
350
361
  }
351
362
  if (!hasJSXNode && isJSXExt && allow === "as-needed") {
352
363
  context.report({
353
- messageId: "filenameExtensionUnexpected",
354
- node
364
+ messageId: "useJsxFileExtensionAsNeeded",
365
+ node,
366
+ data: {
367
+ extensions: extensionsString
368
+ }
355
369
  });
356
370
  }
357
371
  }
@@ -371,11 +385,11 @@ var use_state_default = createRule({
371
385
  meta: {
372
386
  type: "problem",
373
387
  docs: {
374
- description: "enforce destructuring and symmetric naming of 'useState' hook value and setter variables",
388
+ description: "enforce destructuring and symmetric naming of 'useState' hook value and setter",
375
389
  [Symbol.for("rule_features")]: RULE_FEATURES
376
390
  },
377
391
  messages: {
378
- useState: "An useState call is not destructured into value + setter pair."
392
+ unexpected: "An useState call is not destructured into value + setter pair."
379
393
  },
380
394
  schema: []
381
395
  },
@@ -411,14 +425,14 @@ var use_state_default = createRule({
411
425
  const { id } = hookCall.parent;
412
426
  switch (id.type) {
413
427
  case types.AST_NODE_TYPES.Identifier: {
414
- context.report({ messageId: "useState", node: id });
428
+ context.report({ messageId: "unexpected", node: id });
415
429
  break;
416
430
  }
417
431
  case types.AST_NODE_TYPES.ArrayPattern: {
418
432
  const [state, setState] = id.elements;
419
433
  if (state?.type === types.AST_NODE_TYPES.ObjectPattern && setState?.type === types.AST_NODE_TYPES.Identifier) {
420
434
  if (!isSetterNameLoose(setState.name)) {
421
- context.report({ messageId: "useState", node: id });
435
+ context.report({ messageId: "unexpected", node: id });
422
436
  }
423
437
  break;
424
438
  }
@@ -430,7 +444,7 @@ var use_state_default = createRule({
430
444
  if (setStateName === expectedSetterName) {
431
445
  return;
432
446
  }
433
- context.report({ messageId: "useState", node: id });
447
+ context.report({ messageId: "unexpected", node: id });
434
448
  }
435
449
  }
436
450
  }
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as AST from '@eslint-react/ast';
2
2
  import { useComponentCollector, useComponentCollectorLegacy, DEFAULT_COMPONENT_HINT, isUseStateCall, isReactHookCallWithNameLoose } from '@eslint-react/core';
3
- import { isObject, constFalse } from '@eslint-react/eff';
3
+ import { isObject, _ } from '@eslint-react/eff';
4
4
  import * as JSX from '@eslint-react/jsx';
5
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';
@@ -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.26.3-beta.6";
13
+ var version = "1.26.3-beta.7";
14
14
  var createRule = createRuleForPlugin("naming-convention");
15
15
 
16
16
  // src/rules/component-name.ts
@@ -64,26 +64,32 @@ function normalizeOptions(options) {
64
64
  excepts: opts.excepts?.map((pattern) => new RegExp(pattern, "u")) ?? []
65
65
  };
66
66
  }
67
- function validate(name2, options) {
68
- if (name2 == null) return false;
69
- if (options.excepts.some((regex) => regex.test(name2))) {
70
- return true;
67
+ function getViolationMessage(name2, options) {
68
+ if (name2 == null) return _;
69
+ const {
70
+ allowAllCaps = false,
71
+ allowLeadingUnderscore = false,
72
+ allowNamespace = false,
73
+ excepts,
74
+ rule
75
+ } = options;
76
+ if (excepts.some((regex) => regex.test(name2))) {
77
+ return _;
71
78
  }
72
79
  let normalized = name2.normalize("NFKD").replace(/[\u0300-\u036F]/g, "");
73
80
  normalized = normalized.split(".").at(-1) ?? normalized;
74
- const { allowLeadingUnderscore = false, allowNamespace = false } = options;
75
81
  if (allowNamespace) {
76
82
  normalized = normalized.replace(":", "");
77
83
  }
78
84
  if (allowLeadingUnderscore) {
79
85
  normalized = normalized.replace(/^_/, "");
80
86
  }
81
- return match(options.rule).with("CONSTANT_CASE", () => RE_CONSTANT_CASE.test(normalized)).with("PascalCase", () => {
87
+ return match(rule).with("CONSTANT_CASE", () => RE_CONSTANT_CASE.test(normalized) ? _ : "useConstantCase").with("PascalCase", () => {
82
88
  if (normalized.length > 3 && /^[A-Z]+$/u.test(normalized)) {
83
- return options.allowAllCaps ?? false;
89
+ return allowAllCaps ? _ : "usePascalCase";
84
90
  }
85
- return RE_PASCAL_CASE.test(normalized);
86
- }).otherwise(constFalse);
91
+ return RE_PASCAL_CASE.test(normalized) ? _ : "usePascalCase";
92
+ }).otherwise(() => _);
87
93
  }
88
94
  var component_name_default = createRule({
89
95
  meta: {
@@ -93,7 +99,8 @@ var component_name_default = createRule({
93
99
  description: "enforce component naming convention to 'PascalCase' or 'CONSTANT_CASE'"
94
100
  },
95
101
  messages: {
96
- componentName: "A component name must be in {{case}}."
102
+ useConstantCase: "Component name '{{name}}' must be in CONSTANT_CASE.",
103
+ usePascalCase: "Component name '{{name}}' must be in PascalCase."
97
104
  },
98
105
  schema
99
106
  },
@@ -110,14 +117,13 @@ var component_name_default = createRule({
110
117
  if (/^[a-z]/u.test(name2)) {
111
118
  return;
112
119
  }
113
- if (validate(name2, options)) {
114
- return;
115
- }
120
+ const violation = getViolationMessage(name2, options);
121
+ if (violation == null) return;
116
122
  context.report({
117
- messageId: "componentName",
123
+ messageId: violation,
118
124
  node,
119
125
  data: {
120
- case: options.rule
126
+ name: name2
121
127
  }
122
128
  });
123
129
  },
@@ -127,29 +133,30 @@ var component_name_default = createRule({
127
133
  for (const { node: component } of functionComponents.values()) {
128
134
  const id = AST.getFunctionIdentifier(component);
129
135
  if (id?.name == null) continue;
130
- if (validate(id.name, options)) {
131
- continue;
132
- }
136
+ const name2 = id.name;
137
+ const violation = getViolationMessage(name2, options);
138
+ if (violation == null) continue;
133
139
  context.report({
134
- messageId: "componentName",
140
+ messageId: violation,
135
141
  node: id,
136
142
  data: {
137
- case: options.rule
143
+ name: name2
138
144
  }
139
145
  });
140
146
  }
141
147
  for (const { node: component } of classComponents.values()) {
142
148
  const id = AST.getClassIdentifier(component);
143
149
  if (id?.name == null) continue;
144
- if (!validate(id.name, options)) {
145
- context.report({
146
- messageId: "componentName",
147
- node: id,
148
- data: {
149
- case: options.rule
150
- }
151
- });
152
- }
150
+ const name2 = id.name;
151
+ const violation = getViolationMessage(name2, options);
152
+ if (violation == null) continue;
153
+ context.report({
154
+ messageId: violation,
155
+ node: id,
156
+ data: {
157
+ case: options.rule
158
+ }
159
+ });
153
160
  }
154
161
  }
155
162
  };
@@ -212,7 +219,7 @@ var filename_default = createRule({
212
219
  const options = context.options[0] ?? defaultOptions2[0];
213
220
  const rule = typeof options === "string" ? options : options.rule ?? "PascalCase";
214
221
  const excepts = typeof options === "string" ? [] : options.excepts ?? [];
215
- function validate2(name2, casing = rule, ignores = excepts) {
222
+ function validate(name2, casing = rule, ignores = excepts) {
216
223
  const shouldIgnore = ignores.map((pattern) => new RegExp(pattern, "u")).some((pattern) => pattern.test(name2));
217
224
  if (shouldIgnore) return true;
218
225
  return match(casing).with("PascalCase", () => RE_PASCAL_CASE.test(name2)).with("camelCase", () => RE_CAMEL_CASE.test(name2)).with("kebab-case", () => RE_KEBAB_CASE.test(name2)).with("snake_case", () => RE_SNAKE_CASE.test(name2)).exhaustive();
@@ -227,7 +234,7 @@ var filename_default = createRule({
227
234
  context.report({ messageId: "filenameEmpty", node });
228
235
  return;
229
236
  }
230
- if (validate2(basename)) {
237
+ if (validate(basename)) {
231
238
  return;
232
239
  }
233
240
  context.report({
@@ -288,8 +295,8 @@ var filename_extension_default = createRule({
288
295
  description: "enforce naming convention for JSX file extensions"
289
296
  },
290
297
  messages: {
291
- filenameExtensionInvalid: "The JSX file extension is required.",
292
- filenameExtensionUnexpected: "Use JSX file extension as needed."
298
+ useJsxFileExtension: "Use {{extensions}} file extension for JSX files.",
299
+ useJsxFileExtensionAsNeeded: "Do not use {{extensions}} file extension for files without JSX."
293
300
  },
294
301
  schema: schema3
295
302
  },
@@ -298,6 +305,7 @@ var filename_extension_default = createRule({
298
305
  const options = context.options[0] ?? defaultOptions3[0];
299
306
  const allow = isObject(options) ? options.allow : options;
300
307
  const extensions = isObject(options) && "extensions" in options ? options.extensions : defaultOptions3[0].extensions;
308
+ const extensionsString = extensions.map((ext) => `'${ext}'`).join(", ");
301
309
  const filename = context.filename;
302
310
  let hasJSXNode = false;
303
311
  return {
@@ -312,8 +320,11 @@ var filename_extension_default = createRule({
312
320
  const isJSXExt = extensions.includes(fileNameExt);
313
321
  if (hasJSXNode && !isJSXExt) {
314
322
  context.report({
315
- messageId: "filenameExtensionInvalid",
316
- node
323
+ messageId: "useJsxFileExtension",
324
+ node,
325
+ data: {
326
+ extensions: extensionsString
327
+ }
317
328
  });
318
329
  return;
319
330
  }
@@ -324,8 +335,11 @@ var filename_extension_default = createRule({
324
335
  }
325
336
  if (!hasJSXNode && isJSXExt && allow === "as-needed") {
326
337
  context.report({
327
- messageId: "filenameExtensionUnexpected",
328
- node
338
+ messageId: "useJsxFileExtensionAsNeeded",
339
+ node,
340
+ data: {
341
+ extensions: extensionsString
342
+ }
329
343
  });
330
344
  }
331
345
  }
@@ -345,11 +359,11 @@ var use_state_default = createRule({
345
359
  meta: {
346
360
  type: "problem",
347
361
  docs: {
348
- description: "enforce destructuring and symmetric naming of 'useState' hook value and setter variables",
362
+ description: "enforce destructuring and symmetric naming of 'useState' hook value and setter",
349
363
  [Symbol.for("rule_features")]: RULE_FEATURES
350
364
  },
351
365
  messages: {
352
- useState: "An useState call is not destructured into value + setter pair."
366
+ unexpected: "An useState call is not destructured into value + setter pair."
353
367
  },
354
368
  schema: []
355
369
  },
@@ -385,14 +399,14 @@ var use_state_default = createRule({
385
399
  const { id } = hookCall.parent;
386
400
  switch (id.type) {
387
401
  case AST_NODE_TYPES.Identifier: {
388
- context.report({ messageId: "useState", node: id });
402
+ context.report({ messageId: "unexpected", node: id });
389
403
  break;
390
404
  }
391
405
  case AST_NODE_TYPES.ArrayPattern: {
392
406
  const [state, setState] = id.elements;
393
407
  if (state?.type === AST_NODE_TYPES.ObjectPattern && setState?.type === AST_NODE_TYPES.Identifier) {
394
408
  if (!isSetterNameLoose(setState.name)) {
395
- context.report({ messageId: "useState", node: id });
409
+ context.report({ messageId: "unexpected", node: id });
396
410
  }
397
411
  break;
398
412
  }
@@ -404,7 +418,7 @@ var use_state_default = createRule({
404
418
  if (setStateName === expectedSetterName) {
405
419
  return;
406
420
  }
407
- context.report({ messageId: "useState", node: id });
421
+ context.report({ messageId: "unexpected", node: id });
408
422
  }
409
423
  }
410
424
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-naming-convention",
3
- "version": "1.26.3-beta.6",
3
+ "version": "1.26.3-beta.7",
4
4
  "description": "ESLint React's ESLint plugin for naming convention related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -49,11 +49,11 @@
49
49
  "@typescript-eslint/utils": "^8.23.0",
50
50
  "string-ts": "^2.2.1",
51
51
  "ts-pattern": "^5.6.2",
52
- "@eslint-react/ast": "1.26.3-beta.6",
53
- "@eslint-react/core": "1.26.3-beta.6",
54
- "@eslint-react/jsx": "1.26.3-beta.6",
55
- "@eslint-react/shared": "1.26.3-beta.6",
56
- "@eslint-react/eff": "1.26.3-beta.6"
52
+ "@eslint-react/ast": "1.26.3-beta.7",
53
+ "@eslint-react/core": "1.26.3-beta.7",
54
+ "@eslint-react/eff": "1.26.3-beta.7",
55
+ "@eslint-react/jsx": "1.26.3-beta.7",
56
+ "@eslint-react/shared": "1.26.3-beta.7"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/react": "^19.0.8",