eslint-plugin-react-naming-convention 2.12.5-next.2 → 2.12.5-next.4
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.js +23 -21
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -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.12.5-next.
|
|
45
|
+
var version = "2.12.5-next.4";
|
|
46
46
|
|
|
47
47
|
//#endregion
|
|
48
48
|
//#region src/utils/create-rule.ts
|
|
@@ -151,7 +151,7 @@ function isValidName(name, options) {
|
|
|
151
151
|
const RULE_NAME$4 = "context-name";
|
|
152
152
|
var context_name_default = createRule({
|
|
153
153
|
meta: {
|
|
154
|
-
type: "
|
|
154
|
+
type: "suggestion",
|
|
155
155
|
docs: { description: "Enforces the context name to be a valid component name with the suffix 'Context'." },
|
|
156
156
|
messages: { invalidContextName: "A context name must be a valid component name with the suffix 'Context'." },
|
|
157
157
|
schema: []
|
|
@@ -183,8 +183,8 @@ function create$4(context) {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
//#endregion
|
|
186
|
-
//#region src/rules/
|
|
187
|
-
const RULE_NAME$3 = "
|
|
186
|
+
//#region src/rules/file-name.ts
|
|
187
|
+
const RULE_NAME$3 = "file-name";
|
|
188
188
|
const defaultOptions$2 = [{
|
|
189
189
|
excepts: [
|
|
190
190
|
"index",
|
|
@@ -230,14 +230,14 @@ const schema$2 = [{ anyOf: [{
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
}] }];
|
|
233
|
-
var
|
|
233
|
+
var file_name_default = createRule({
|
|
234
234
|
meta: {
|
|
235
|
-
type: "
|
|
235
|
+
type: "suggestion",
|
|
236
236
|
defaultOptions: [...defaultOptions$2],
|
|
237
237
|
docs: { description: "Enforces consistent file-naming conventions." },
|
|
238
238
|
messages: {
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
fileNameEmpty: "A source file must have non-empty name.",
|
|
240
|
+
fileNameInvalidCase: "A source file with name '{{name}}' does not match {{rule}}. Rename it to '{{suggestion}}'."
|
|
241
241
|
},
|
|
242
242
|
schema: schema$2
|
|
243
243
|
},
|
|
@@ -262,14 +262,14 @@ function create$3(context) {
|
|
|
262
262
|
const [basename = "", ...rest] = path.basename(context.filename).split(".");
|
|
263
263
|
if (basename.length === 0) {
|
|
264
264
|
context.report({
|
|
265
|
-
messageId: "
|
|
265
|
+
messageId: "fileNameEmpty",
|
|
266
266
|
node
|
|
267
267
|
});
|
|
268
268
|
return;
|
|
269
269
|
}
|
|
270
270
|
if (validate(basename)) return;
|
|
271
271
|
context.report({
|
|
272
|
-
messageId: "
|
|
272
|
+
messageId: "fileNameInvalidCase",
|
|
273
273
|
node,
|
|
274
274
|
data: {
|
|
275
275
|
name: context.filename,
|
|
@@ -281,8 +281,8 @@ function create$3(context) {
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
//#endregion
|
|
284
|
-
//#region src/rules/
|
|
285
|
-
const RULE_NAME$2 = "
|
|
284
|
+
//#region src/rules/file-name-extension.ts
|
|
285
|
+
const RULE_NAME$2 = "file-name-extension";
|
|
286
286
|
const defaultOptions$1 = [{
|
|
287
287
|
allow: "as-needed",
|
|
288
288
|
extensions: [".jsx", ".tsx"],
|
|
@@ -307,14 +307,14 @@ const schema$1 = [{ anyOf: [{
|
|
|
307
307
|
ignoreFilesWithoutCode: { type: "boolean" }
|
|
308
308
|
}
|
|
309
309
|
}] }];
|
|
310
|
-
var
|
|
310
|
+
var file_name_extension_default = createRule({
|
|
311
311
|
meta: {
|
|
312
|
-
type: "
|
|
312
|
+
type: "suggestion",
|
|
313
313
|
defaultOptions: [...defaultOptions$1],
|
|
314
314
|
docs: { description: "Enforces consistent use of the JSX file extension." },
|
|
315
315
|
messages: {
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
missingJsxExtension: "Use {{extensions}} file extension for JSX files.",
|
|
317
|
+
unnecessaryJsxExtension: "Do not use {{extensions}} file extension for files without JSX."
|
|
318
318
|
},
|
|
319
319
|
schema: schema$1
|
|
320
320
|
},
|
|
@@ -341,7 +341,7 @@ function create$2(context) {
|
|
|
341
341
|
const isJSXExt = extensions.includes(fileNameExt);
|
|
342
342
|
if (hasJSXNode && !isJSXExt) {
|
|
343
343
|
context.report({
|
|
344
|
-
messageId: "
|
|
344
|
+
messageId: "missingJsxExtension",
|
|
345
345
|
node: program,
|
|
346
346
|
data: { extensions: extensionsString }
|
|
347
347
|
});
|
|
@@ -351,7 +351,7 @@ function create$2(context) {
|
|
|
351
351
|
const ignoreFilesWithoutCode = isObject(options) && options.ignoreFilesWithoutCode === true;
|
|
352
352
|
if (!hasCode && ignoreFilesWithoutCode) return;
|
|
353
353
|
if (!hasJSXNode && isJSXExt && allow === "as-needed") context.report({
|
|
354
|
-
messageId: "
|
|
354
|
+
messageId: "unnecessaryJsxExtension",
|
|
355
355
|
node: program,
|
|
356
356
|
data: { extensions: extensionsString }
|
|
357
357
|
});
|
|
@@ -417,7 +417,7 @@ const schema = [{
|
|
|
417
417
|
}];
|
|
418
418
|
var use_state_default = createRule({
|
|
419
419
|
meta: {
|
|
420
|
-
type: "
|
|
420
|
+
type: "suggestion",
|
|
421
421
|
docs: { description: "Enforces destructuring and symmetric naming of the 'useState' hook value and setter." },
|
|
422
422
|
messages: {
|
|
423
423
|
invalidAssignment: "useState should be destructured into a value and setter pair, e.g., const [state, setState] = useState(...).",
|
|
@@ -501,8 +501,10 @@ const plugin = {
|
|
|
501
501
|
rules: {
|
|
502
502
|
["component-name"]: component_name_default,
|
|
503
503
|
["context-name"]: context_name_default,
|
|
504
|
-
["
|
|
505
|
-
["
|
|
504
|
+
["file-name"]: file_name_default,
|
|
505
|
+
["file-name-extension"]: file_name_extension_default,
|
|
506
|
+
["filename"]: file_name_default,
|
|
507
|
+
["filename-extension"]: file_name_extension_default,
|
|
506
508
|
["ref-name"]: ref_name_default,
|
|
507
509
|
["use-state"]: use_state_default
|
|
508
510
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-naming-convention",
|
|
3
|
-
"version": "2.12.5-next.
|
|
3
|
+
"version": "2.12.5-next.4",
|
|
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.12.5-next.
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/var": "2.12.5-next.
|
|
52
|
-
"@eslint-react/
|
|
48
|
+
"@eslint-react/ast": "2.12.5-next.4",
|
|
49
|
+
"@eslint-react/core": "2.12.5-next.4",
|
|
50
|
+
"@eslint-react/eff": "2.12.5-next.4",
|
|
51
|
+
"@eslint-react/var": "2.12.5-next.4",
|
|
52
|
+
"@eslint-react/shared": "2.12.5-next.4"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/react": "^19.2.13",
|