eslint-plugin-react-naming-convention 1.26.3-beta.1 → 1.26.3-beta.10

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 = "filenameCaseMismatch" | "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 = "filenameCaseMismatch" | "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.1";
39
+ var version = "1.26.3-beta.10";
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
  };
@@ -227,8 +234,7 @@ var filename_default = createRule({
227
234
  description: "enforce naming convention for JSX filenames"
228
235
  },
229
236
  messages: {
230
- // filenameCaseMismatch: "A file with name '{{name}}' does not match {{rule}}.",
231
- filenameCaseMismatchSuggestion: "A file with name '{{name}}' does not match {{rule}}. Should rename to '{{suggestion}}'.",
237
+ filenameCaseMismatch: "A file with name '{{name}}' does not match {{rule}}. Should rename to '{{suggestion}}'.",
232
238
  filenameEmpty: "A file must have non-empty name."
233
239
  },
234
240
  schema: schema2
@@ -238,7 +244,7 @@ var filename_default = createRule({
238
244
  const options = context.options[0] ?? defaultOptions2[0];
239
245
  const rule = typeof options === "string" ? options : options.rule ?? "PascalCase";
240
246
  const excepts = typeof options === "string" ? [] : options.excepts ?? [];
241
- function validate2(name2, casing = rule, ignores = excepts) {
247
+ function validate(name2, casing = rule, ignores = excepts) {
242
248
  const shouldIgnore = ignores.map((pattern) => new RegExp(pattern, "u")).some((pattern) => pattern.test(name2));
243
249
  if (shouldIgnore) return true;
244
250
  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,11 +259,11 @@ var filename_default = createRule({
253
259
  context.report({ messageId: "filenameEmpty", node });
254
260
  return;
255
261
  }
256
- if (validate2(basename)) {
262
+ if (validate(basename)) {
257
263
  return;
258
264
  }
259
265
  context.report({
260
- messageId: "filenameCaseMismatchSuggestion",
266
+ messageId: "filenameCaseMismatch",
261
267
  node,
262
268
  data: {
263
269
  name: context.filename,
@@ -314,8 +320,8 @@ var filename_extension_default = createRule({
314
320
  description: "enforce naming convention for JSX file extensions"
315
321
  },
316
322
  messages: {
317
- filenameExtensionInvalid: "The JSX file extension is required.",
318
- filenameExtensionUnexpected: "Use JSX file extension as needed."
323
+ useJsxFileExtension: "Use {{extensions}} file extension for JSX files.",
324
+ useJsxFileExtensionAsNeeded: "Do not use {{extensions}} file extension for files without JSX."
319
325
  },
320
326
  schema: schema3
321
327
  },
@@ -324,6 +330,7 @@ var filename_extension_default = createRule({
324
330
  const options = context.options[0] ?? defaultOptions3[0];
325
331
  const allow = eff.isObject(options) ? options.allow : options;
326
332
  const extensions = eff.isObject(options) && "extensions" in options ? options.extensions : defaultOptions3[0].extensions;
333
+ const extensionsString = extensions.map((ext) => `'${ext}'`).join(", ");
327
334
  const filename = context.filename;
328
335
  let hasJSXNode = false;
329
336
  return {
@@ -338,8 +345,11 @@ var filename_extension_default = createRule({
338
345
  const isJSXExt = extensions.includes(fileNameExt);
339
346
  if (hasJSXNode && !isJSXExt) {
340
347
  context.report({
341
- messageId: "filenameExtensionInvalid",
342
- node
348
+ messageId: "useJsxFileExtension",
349
+ node,
350
+ data: {
351
+ extensions: extensionsString
352
+ }
343
353
  });
344
354
  return;
345
355
  }
@@ -350,8 +360,11 @@ var filename_extension_default = createRule({
350
360
  }
351
361
  if (!hasJSXNode && isJSXExt && allow === "as-needed") {
352
362
  context.report({
353
- messageId: "filenameExtensionUnexpected",
354
- node
363
+ messageId: "useJsxFileExtensionAsNeeded",
364
+ node,
365
+ data: {
366
+ extensions: extensionsString
367
+ }
355
368
  });
356
369
  }
357
370
  }
@@ -371,11 +384,11 @@ var use_state_default = createRule({
371
384
  meta: {
372
385
  type: "problem",
373
386
  docs: {
374
- description: "enforce destructuring and symmetric naming of 'useState' hook value and setter variables",
387
+ description: "enforce destructuring and symmetric naming of 'useState' hook value and setter",
375
388
  [Symbol.for("rule_features")]: RULE_FEATURES
376
389
  },
377
390
  messages: {
378
- useState: "An useState call is not destructured into value + setter pair."
391
+ unexpected: "An useState call is not destructured into value + setter pair."
379
392
  },
380
393
  schema: []
381
394
  },
@@ -411,14 +424,14 @@ var use_state_default = createRule({
411
424
  const { id } = hookCall.parent;
412
425
  switch (id.type) {
413
426
  case types.AST_NODE_TYPES.Identifier: {
414
- context.report({ messageId: "useState", node: id });
427
+ context.report({ messageId: "unexpected", node: id });
415
428
  break;
416
429
  }
417
430
  case types.AST_NODE_TYPES.ArrayPattern: {
418
431
  const [state, setState] = id.elements;
419
432
  if (state?.type === types.AST_NODE_TYPES.ObjectPattern && setState?.type === types.AST_NODE_TYPES.Identifier) {
420
433
  if (!isSetterNameLoose(setState.name)) {
421
- context.report({ messageId: "useState", node: id });
434
+ context.report({ messageId: "unexpected", node: id });
422
435
  }
423
436
  break;
424
437
  }
@@ -430,7 +443,7 @@ var use_state_default = createRule({
430
443
  if (setStateName === expectedSetterName) {
431
444
  return;
432
445
  }
433
- context.report({ messageId: "useState", node: id });
446
+ context.report({ messageId: "unexpected", node: id });
434
447
  }
435
448
  }
436
449
  }
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.1";
13
+ var version = "1.26.3-beta.10";
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
  };
@@ -201,8 +208,7 @@ var filename_default = createRule({
201
208
  description: "enforce naming convention for JSX filenames"
202
209
  },
203
210
  messages: {
204
- // filenameCaseMismatch: "A file with name '{{name}}' does not match {{rule}}.",
205
- filenameCaseMismatchSuggestion: "A file with name '{{name}}' does not match {{rule}}. Should rename to '{{suggestion}}'.",
211
+ filenameCaseMismatch: "A file with name '{{name}}' does not match {{rule}}. Should rename to '{{suggestion}}'.",
206
212
  filenameEmpty: "A file must have non-empty name."
207
213
  },
208
214
  schema: schema2
@@ -212,7 +218,7 @@ var filename_default = createRule({
212
218
  const options = context.options[0] ?? defaultOptions2[0];
213
219
  const rule = typeof options === "string" ? options : options.rule ?? "PascalCase";
214
220
  const excepts = typeof options === "string" ? [] : options.excepts ?? [];
215
- function validate2(name2, casing = rule, ignores = excepts) {
221
+ function validate(name2, casing = rule, ignores = excepts) {
216
222
  const shouldIgnore = ignores.map((pattern) => new RegExp(pattern, "u")).some((pattern) => pattern.test(name2));
217
223
  if (shouldIgnore) return true;
218
224
  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,11 +233,11 @@ var filename_default = createRule({
227
233
  context.report({ messageId: "filenameEmpty", node });
228
234
  return;
229
235
  }
230
- if (validate2(basename)) {
236
+ if (validate(basename)) {
231
237
  return;
232
238
  }
233
239
  context.report({
234
- messageId: "filenameCaseMismatchSuggestion",
240
+ messageId: "filenameCaseMismatch",
235
241
  node,
236
242
  data: {
237
243
  name: context.filename,
@@ -288,8 +294,8 @@ var filename_extension_default = createRule({
288
294
  description: "enforce naming convention for JSX file extensions"
289
295
  },
290
296
  messages: {
291
- filenameExtensionInvalid: "The JSX file extension is required.",
292
- filenameExtensionUnexpected: "Use JSX file extension as needed."
297
+ useJsxFileExtension: "Use {{extensions}} file extension for JSX files.",
298
+ useJsxFileExtensionAsNeeded: "Do not use {{extensions}} file extension for files without JSX."
293
299
  },
294
300
  schema: schema3
295
301
  },
@@ -298,6 +304,7 @@ var filename_extension_default = createRule({
298
304
  const options = context.options[0] ?? defaultOptions3[0];
299
305
  const allow = isObject(options) ? options.allow : options;
300
306
  const extensions = isObject(options) && "extensions" in options ? options.extensions : defaultOptions3[0].extensions;
307
+ const extensionsString = extensions.map((ext) => `'${ext}'`).join(", ");
301
308
  const filename = context.filename;
302
309
  let hasJSXNode = false;
303
310
  return {
@@ -312,8 +319,11 @@ var filename_extension_default = createRule({
312
319
  const isJSXExt = extensions.includes(fileNameExt);
313
320
  if (hasJSXNode && !isJSXExt) {
314
321
  context.report({
315
- messageId: "filenameExtensionInvalid",
316
- node
322
+ messageId: "useJsxFileExtension",
323
+ node,
324
+ data: {
325
+ extensions: extensionsString
326
+ }
317
327
  });
318
328
  return;
319
329
  }
@@ -324,8 +334,11 @@ var filename_extension_default = createRule({
324
334
  }
325
335
  if (!hasJSXNode && isJSXExt && allow === "as-needed") {
326
336
  context.report({
327
- messageId: "filenameExtensionUnexpected",
328
- node
337
+ messageId: "useJsxFileExtensionAsNeeded",
338
+ node,
339
+ data: {
340
+ extensions: extensionsString
341
+ }
329
342
  });
330
343
  }
331
344
  }
@@ -345,11 +358,11 @@ var use_state_default = createRule({
345
358
  meta: {
346
359
  type: "problem",
347
360
  docs: {
348
- description: "enforce destructuring and symmetric naming of 'useState' hook value and setter variables",
361
+ description: "enforce destructuring and symmetric naming of 'useState' hook value and setter",
349
362
  [Symbol.for("rule_features")]: RULE_FEATURES
350
363
  },
351
364
  messages: {
352
- useState: "An useState call is not destructured into value + setter pair."
365
+ unexpected: "An useState call is not destructured into value + setter pair."
353
366
  },
354
367
  schema: []
355
368
  },
@@ -385,14 +398,14 @@ var use_state_default = createRule({
385
398
  const { id } = hookCall.parent;
386
399
  switch (id.type) {
387
400
  case AST_NODE_TYPES.Identifier: {
388
- context.report({ messageId: "useState", node: id });
401
+ context.report({ messageId: "unexpected", node: id });
389
402
  break;
390
403
  }
391
404
  case AST_NODE_TYPES.ArrayPattern: {
392
405
  const [state, setState] = id.elements;
393
406
  if (state?.type === AST_NODE_TYPES.ObjectPattern && setState?.type === AST_NODE_TYPES.Identifier) {
394
407
  if (!isSetterNameLoose(setState.name)) {
395
- context.report({ messageId: "useState", node: id });
408
+ context.report({ messageId: "unexpected", node: id });
396
409
  }
397
410
  break;
398
411
  }
@@ -404,7 +417,7 @@ var use_state_default = createRule({
404
417
  if (setStateName === expectedSetterName) {
405
418
  return;
406
419
  }
407
- context.report({ messageId: "useState", node: id });
420
+ context.report({ messageId: "unexpected", node: id });
408
421
  }
409
422
  }
410
423
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-naming-convention",
3
- "version": "1.26.3-beta.1",
3
+ "version": "1.26.3-beta.10",
4
4
  "description": "ESLint React's ESLint plugin for naming convention related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -43,23 +43,23 @@
43
43
  "./package.json"
44
44
  ],
45
45
  "dependencies": {
46
- "@typescript-eslint/scope-manager": "^8.23.0",
47
- "@typescript-eslint/type-utils": "^8.23.0",
48
- "@typescript-eslint/types": "^8.23.0",
49
- "@typescript-eslint/utils": "^8.23.0",
46
+ "@typescript-eslint/scope-manager": "^8.24.0",
47
+ "@typescript-eslint/type-utils": "^8.24.0",
48
+ "@typescript-eslint/types": "^8.24.0",
49
+ "@typescript-eslint/utils": "^8.24.0",
50
50
  "string-ts": "^2.2.1",
51
51
  "ts-pattern": "^5.6.2",
52
- "@eslint-react/ast": "1.26.3-beta.1",
53
- "@eslint-react/core": "1.26.3-beta.1",
54
- "@eslint-react/eff": "1.26.3-beta.1",
55
- "@eslint-react/jsx": "1.26.3-beta.1",
56
- "@eslint-react/shared": "1.26.3-beta.1"
52
+ "@eslint-react/ast": "1.26.3-beta.10",
53
+ "@eslint-react/jsx": "1.26.3-beta.10",
54
+ "@eslint-react/eff": "1.26.3-beta.10",
55
+ "@eslint-react/shared": "1.26.3-beta.10",
56
+ "@eslint-react/core": "1.26.3-beta.10"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/react": "^19.0.8",
60
60
  "@types/react-dom": "^19.0.3",
61
61
  "tsup": "^8.3.6",
62
- "@workspace/configs": "0.0.0"
62
+ "@local/configs": "0.0.0"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "eslint": "^8.57.0 || ^9.0.0",