eslint-plugin-react-naming-convention 1.22.2-next.1 → 1.22.2-next.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.js +6 -7
- package/dist/index.mjs +7 -8
- package/package.json +10 -10
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.22.2-next.
|
|
39
|
+
var version = "1.22.2-next.10";
|
|
40
40
|
var createRule = shared.createRuleForPlugin("naming-convention");
|
|
41
41
|
|
|
42
42
|
// src/rules/component-name.ts
|
|
@@ -312,19 +312,18 @@ var filename_extension_default = createRule({
|
|
|
312
312
|
const allow = eff.isObject(options) ? options.allow : options;
|
|
313
313
|
const extensions = eff.isObject(options) && "extensions" in options ? options.extensions : defaultOptions3[0].extensions;
|
|
314
314
|
const filename = context.filename;
|
|
315
|
-
|
|
315
|
+
let hasJSXNode = false;
|
|
316
316
|
return {
|
|
317
317
|
JSXElement() {
|
|
318
|
-
|
|
318
|
+
hasJSXNode = true;
|
|
319
319
|
},
|
|
320
320
|
JSXFragment() {
|
|
321
|
-
|
|
321
|
+
hasJSXNode = true;
|
|
322
322
|
},
|
|
323
323
|
"Program:exit"(node) {
|
|
324
324
|
const fileNameExt = filename.slice(filename.lastIndexOf("."));
|
|
325
325
|
const isJSXExt = extensions.includes(fileNameExt);
|
|
326
|
-
|
|
327
|
-
if (hasJSXCode && !isJSXExt) {
|
|
326
|
+
if (hasJSXNode && !isJSXExt) {
|
|
328
327
|
context.report({
|
|
329
328
|
messageId: "filenameExtensionInvalid",
|
|
330
329
|
node
|
|
@@ -334,7 +333,7 @@ var filename_extension_default = createRule({
|
|
|
334
333
|
const hasCode = node.body.length > 0;
|
|
335
334
|
const ignoreFilesWithoutCode = eff.isObject(options) && options.ignoreFilesWithoutCode;
|
|
336
335
|
if (!hasCode && ignoreFilesWithoutCode) return;
|
|
337
|
-
if (!
|
|
336
|
+
if (!hasJSXNode && isJSXExt && allow === "as-needed") {
|
|
338
337
|
context.report({
|
|
339
338
|
messageId: "filenameExtensionUnexpected",
|
|
340
339
|
node
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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,
|
|
3
|
+
import { O, isString, isObject, F, isNullable } from '@eslint-react/eff';
|
|
4
4
|
import * as JSX from '@eslint-react/jsx';
|
|
5
5
|
import { createRuleForPlugin, decodeSettings, 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.22.2-next.
|
|
13
|
+
var version = "1.22.2-next.10";
|
|
14
14
|
var createRule = createRuleForPlugin("naming-convention");
|
|
15
15
|
|
|
16
16
|
// src/rules/component-name.ts
|
|
@@ -286,19 +286,18 @@ var filename_extension_default = createRule({
|
|
|
286
286
|
const allow = isObject(options) ? options.allow : options;
|
|
287
287
|
const extensions = isObject(options) && "extensions" in options ? options.extensions : defaultOptions3[0].extensions;
|
|
288
288
|
const filename = context.filename;
|
|
289
|
-
|
|
289
|
+
let hasJSXNode = false;
|
|
290
290
|
return {
|
|
291
291
|
JSXElement() {
|
|
292
|
-
|
|
292
|
+
hasJSXNode = true;
|
|
293
293
|
},
|
|
294
294
|
JSXFragment() {
|
|
295
|
-
|
|
295
|
+
hasJSXNode = true;
|
|
296
296
|
},
|
|
297
297
|
"Program:exit"(node) {
|
|
298
298
|
const fileNameExt = filename.slice(filename.lastIndexOf("."));
|
|
299
299
|
const isJSXExt = extensions.includes(fileNameExt);
|
|
300
|
-
|
|
301
|
-
if (hasJSXCode && !isJSXExt) {
|
|
300
|
+
if (hasJSXNode && !isJSXExt) {
|
|
302
301
|
context.report({
|
|
303
302
|
messageId: "filenameExtensionInvalid",
|
|
304
303
|
node
|
|
@@ -308,7 +307,7 @@ var filename_extension_default = createRule({
|
|
|
308
307
|
const hasCode = node.body.length > 0;
|
|
309
308
|
const ignoreFilesWithoutCode = isObject(options) && options.ignoreFilesWithoutCode;
|
|
310
309
|
if (!hasCode && ignoreFilesWithoutCode) return;
|
|
311
|
-
if (!
|
|
310
|
+
if (!hasJSXNode && isJSXExt && allow === "as-needed") {
|
|
312
311
|
context.report({
|
|
313
312
|
messageId: "filenameExtensionUnexpected",
|
|
314
313
|
node
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-naming-convention",
|
|
3
|
-
"version": "1.22.2-next.
|
|
3
|
+
"version": "1.22.2-next.10",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for naming convention related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
"eslint-plugin",
|
|
11
11
|
"eslint-plugin-react-naming-convention"
|
|
12
12
|
],
|
|
13
|
-
"homepage": "https://github.com/
|
|
13
|
+
"homepage": "https://github.com/rEl1cx/eslint-react",
|
|
14
14
|
"bugs": {
|
|
15
|
-
"url": "https://github.com/
|
|
15
|
+
"url": "https://github.com/rEl1cx/eslint-react/issues"
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "git+https://github.com/
|
|
19
|
+
"url": "git+https://github.com/rEl1cx/eslint-react.git",
|
|
20
20
|
"directory": "packages/plugins/eslint-plugin-react-naming-convention"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"@typescript-eslint/utils": "^8.18.2",
|
|
48
48
|
"string-ts": "^2.2.0",
|
|
49
49
|
"ts-pattern": "^5.6.0",
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/jsx": "1.22.2-next.
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/types": "1.22.2-next.
|
|
50
|
+
"@eslint-react/core": "1.22.2-next.10",
|
|
51
|
+
"@eslint-react/ast": "1.22.2-next.10",
|
|
52
|
+
"@eslint-react/jsx": "1.22.2-next.10",
|
|
53
|
+
"@eslint-react/eff": "1.22.2-next.10",
|
|
54
|
+
"@eslint-react/shared": "1.22.2-next.10",
|
|
55
|
+
"@eslint-react/types": "1.22.2-next.10"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/react": "^19.0.2",
|