eslint-plugin-react-naming-convention 2.0.0-next.164 → 2.0.0-next.166

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 +27 -27
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ const rules = { "react-naming-convention/context-name": "warn" };
31
31
  //#endregion
32
32
  //#region package.json
33
33
  var name = "eslint-plugin-react-naming-convention";
34
- var version = "2.0.0-next.164";
34
+ var version = "2.0.0-next.166";
35
35
 
36
36
  //#endregion
37
37
  //#region src/utils/create-rule.ts
@@ -71,7 +71,7 @@ var component_name_default = createRule({
71
71
  type: "problem",
72
72
  defaultOptions: [...defaultOptions$2],
73
73
  docs: { description: "Enforces naming conventions for components." },
74
- messages: { invalid: "A component name '{{name}}' does not match {{rule}}." },
74
+ messages: { invalidComponentName: "A component name '{{name}}' does not match {{rule}}." },
75
75
  schema: schema$2
76
76
  },
77
77
  name: RULE_NAME$4,
@@ -95,7 +95,7 @@ function create$4(context) {
95
95
  const name$2 = id.name;
96
96
  if (isValidName(name$2, options)) continue;
97
97
  context.report({
98
- messageId: "invalid",
98
+ messageId: "invalidComponentName",
99
99
  node: id,
100
100
  data: {
101
101
  name: name$2,
@@ -109,7 +109,7 @@ function create$4(context) {
109
109
  const name$2 = id.name;
110
110
  if (isValidName(name$2, options)) continue;
111
111
  context.report({
112
- messageId: "invalid",
112
+ messageId: "invalidComponentName",
113
113
  node: id,
114
114
  data: {
115
115
  name: name$2,
@@ -151,7 +151,7 @@ var context_name_default = createRule({
151
151
  meta: {
152
152
  type: "problem",
153
153
  docs: { description: "Enforces context name to be a valid component name with the suffix `Context`." },
154
- messages: { invalid: "A context name must be a valid component name with the suffix 'Context'." },
154
+ messages: { invalidContextName: "A context name must be a valid component name with the suffix 'Context'." },
155
155
  schema: []
156
156
  },
157
157
  name: RULE_NAME$3,
@@ -173,7 +173,7 @@ function create$3(context) {
173
173
  }, identity).otherwise(() => null);
174
174
  if (name$2 != null && ER.isComponentName(name$2) && name$2.endsWith("Context")) return;
175
175
  context.report({
176
- messageId: "invalid",
176
+ messageId: "invalidContextName",
177
177
  node: id
178
178
  });
179
179
  } };
@@ -185,10 +185,10 @@ const RULE_NAME$2 = "filename";
185
185
  const defaultOptions$1 = [{
186
186
  excepts: [
187
187
  "index",
188
- "/^_/",
189
- "/^\\$/",
190
- "/^[0-9]+$/",
191
- "/^\\[[^\\]]+\\]$/"
188
+ String.raw`/^_/`,
189
+ String.raw`/^\$/`,
190
+ String.raw`/^[0-9]+$/`,
191
+ String.raw`/^\[[^\]]+\]$/`
192
192
  ],
193
193
  rule: "PascalCase"
194
194
  }];
@@ -233,8 +233,8 @@ var filename_default = createRule({
233
233
  defaultOptions: [...defaultOptions$1],
234
234
  docs: { description: "Enforces consistent file naming conventions." },
235
235
  messages: {
236
- filenameEmpty: "A file must have non-empty name.",
237
- filenameInvalid: "A file with name '{{name}}' does not match {{rule}}. Rename it to '{{suggestion}}'."
236
+ empty: "A file must have non-empty name.",
237
+ invalidCase: "A file with name '{{name}}' does not match {{rule}}. Rename it to '{{suggestion}}'."
238
238
  },
239
239
  schema: schema$1
240
240
  },
@@ -248,7 +248,7 @@ function create$2(context) {
248
248
  const excepts = typeof options === "string" ? [] : (options.excepts ?? []).map((s) => RegExp.toRegExp(s));
249
249
  function validate(name$2, casing = rule, ignores = excepts) {
250
250
  if (ignores.some((pattern) => pattern.test(name$2))) return true;
251
- const filteredName = name$2.match(/[\w-]/gu)?.join("") ?? "";
251
+ const filteredName = name$2.match(/[\w.-]/gu)?.join("") ?? "";
252
252
  if (filteredName.length === 0) return true;
253
253
  return match(casing).with("PascalCase", () => RegExp.PASCAL_CASE.test(filteredName)).with("camelCase", () => RegExp.CAMEL_CASE.test(filteredName)).with("kebab-case", () => RegExp.KEBAB_CASE.test(filteredName)).with("snake_case", () => RegExp.SNAKE_CASE.test(filteredName)).exhaustive();
254
254
  }
@@ -259,14 +259,14 @@ function create$2(context) {
259
259
  const [basename = "", ...rest] = path.basename(context.filename).split(".");
260
260
  if (basename.length === 0) {
261
261
  context.report({
262
- messageId: "filenameEmpty",
262
+ messageId: "empty",
263
263
  node
264
264
  });
265
265
  return;
266
266
  }
267
267
  if (validate(basename)) return;
268
268
  context.report({
269
- messageId: "filenameInvalid",
269
+ messageId: "invalidCase",
270
270
  node,
271
271
  data: {
272
272
  name: context.filename,
@@ -310,8 +310,8 @@ var filename_extension_default = createRule({
310
310
  defaultOptions: [...defaultOptions],
311
311
  docs: { description: "Enforces consistent file naming conventions." },
312
312
  messages: {
313
- useJsxFileExtension: "Use {{extensions}} file extension for JSX files.",
314
- useNonJsxFileExtension: "Do not use {{extensions}} file extension for files without JSX."
313
+ missingJSXExtension: "Use {{extensions}} file extension for JSX files.",
314
+ unnecessaryJSXExtension: "Do not use {{extensions}} file extension for files without JSX."
315
315
  },
316
316
  schema
317
317
  },
@@ -338,7 +338,7 @@ function create$1(context) {
338
338
  const isJSXExt = extensions.includes(fileNameExt);
339
339
  if (hasJSXNode && !isJSXExt) {
340
340
  context.report({
341
- messageId: "useJsxFileExtension",
341
+ messageId: "missingJSXExtension",
342
342
  node: program,
343
343
  data: { extensions: extensionsString }
344
344
  });
@@ -348,7 +348,7 @@ function create$1(context) {
348
348
  const ignoreFilesWithoutCode = isObject(options) && options.ignoreFilesWithoutCode === true;
349
349
  if (!hasCode && ignoreFilesWithoutCode) return;
350
350
  if (!hasJSXNode && isJSXExt && allow === "as-needed") context.report({
351
- messageId: "useNonJsxFileExtension",
351
+ messageId: "unnecessaryJSXExtension",
352
352
  node: program,
353
353
  data: { extensions: extensionsString }
354
354
  });
@@ -368,8 +368,8 @@ var use_state_default = createRule({
368
368
  [Symbol.for("rule_features")]: RULE_FEATURES
369
369
  },
370
370
  messages: {
371
- invalidSetterNaming: "The setter should be named 'set' followed by the capitalized state variable name, e.g., 'setState' for 'state'.",
372
- missingDestructuring: "useState should be destructured into a value and setter pair, e.g., const [state, setState] = useState(...)."
371
+ invalidSetterName: "The setter should be named 'set' followed by the capitalized state variable name, e.g., 'setState' for 'state'.",
372
+ invalidAssignment: "useState should be destructured into a value and setter pair, e.g., const [state, setState] = useState(...)."
373
373
  },
374
374
  schema: []
375
375
  },
@@ -384,7 +384,7 @@ function create(context) {
384
384
  if (!isUseStateCall(node)) return;
385
385
  if (node.parent.type !== AST_NODE_TYPES.VariableDeclarator) {
386
386
  context.report({
387
- messageId: "missingDestructuring",
387
+ messageId: "invalidAssignment",
388
388
  node
389
389
  });
390
390
  return;
@@ -392,7 +392,7 @@ function create(context) {
392
392
  const id = ER.getInstanceId(node);
393
393
  if (id?.type !== AST_NODE_TYPES.ArrayPattern) {
394
394
  context.report({
395
- messageId: "missingDestructuring",
395
+ messageId: "invalidAssignment",
396
396
  node: id ?? node
397
397
  });
398
398
  return;
@@ -400,7 +400,7 @@ function create(context) {
400
400
  const [value, setter] = id.elements;
401
401
  if (value == null || setter == null) {
402
402
  context.report({
403
- messageId: "missingDestructuring",
403
+ messageId: "invalidAssignment",
404
404
  node: id
405
405
  });
406
406
  return;
@@ -408,7 +408,7 @@ function create(context) {
408
408
  const setterName = match(setter).with({ type: AST_NODE_TYPES.Identifier }, (id$1) => id$1.name).otherwise(() => null);
409
409
  if (setterName == null || !setterName.startsWith("set")) {
410
410
  context.report({
411
- messageId: "invalidSetterNaming",
411
+ messageId: "invalidSetterName",
412
412
  node: setter
413
413
  });
414
414
  return;
@@ -422,14 +422,14 @@ function create(context) {
422
422
  }).otherwise(() => null);
423
423
  if (valueName == null) {
424
424
  context.report({
425
- messageId: "invalidSetterNaming",
425
+ messageId: "invalidSetterName",
426
426
  node: value
427
427
  });
428
428
  return;
429
429
  }
430
430
  if (snakeCase(setterName) !== `set_${valueName}`) {
431
431
  context.report({
432
- messageId: "invalidSetterNaming",
432
+ messageId: "invalidSetterName",
433
433
  node: setter
434
434
  });
435
435
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-naming-convention",
3
- "version": "2.0.0-next.164",
3
+ "version": "2.0.0-next.166",
4
4
  "description": "ESLint React's ESLint plugin for naming convention related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -41,12 +41,12 @@
41
41
  "@typescript-eslint/utils": "^8.42.0",
42
42
  "string-ts": "^2.2.1",
43
43
  "ts-pattern": "^5.8.0",
44
- "@eslint-react/ast": "2.0.0-next.164",
45
- "@eslint-react/eff": "2.0.0-next.164",
46
- "@eslint-react/shared": "2.0.0-next.164",
47
- "@eslint-react/var": "2.0.0-next.164",
48
- "@eslint-react/core": "2.0.0-next.164",
49
- "@eslint-react/kit": "2.0.0-next.164"
44
+ "@eslint-react/ast": "2.0.0-next.166",
45
+ "@eslint-react/kit": "2.0.0-next.166",
46
+ "@eslint-react/core": "2.0.0-next.166",
47
+ "@eslint-react/shared": "2.0.0-next.166",
48
+ "@eslint-react/eff": "2.0.0-next.166",
49
+ "@eslint-react/var": "2.0.0-next.166"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/react": "^19.1.12",