eslint-plugin-code-style 1.0.41 → 1.1.2
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/README.md +3 -3
- package/index.js +21 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
[](https://eslint.org/)
|
|
10
10
|
[](https://nodejs.org/)
|
|
11
11
|
[](https://react.dev/)
|
|
12
|
+
[](https://www.typescriptlang.org/)
|
|
12
13
|
|
|
13
14
|
[](https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/stargazers)
|
|
14
15
|
[](https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/issues)
|
|
@@ -68,8 +69,7 @@ We provide **ready-to-use ESLint flat configuration files** that combine `eslint
|
|
|
68
69
|
| Configuration | Description | Link |
|
|
69
70
|
|---------------|-------------|------|
|
|
70
71
|
| **React** | React.js projects (JavaScript, JSX) | [View Config](./recommended-configs/react/) |
|
|
71
|
-
| **React +
|
|
72
|
-
| **React + TS + Tailwind** | React + TypeScript + Tailwind CSS | *Coming Soon* |
|
|
72
|
+
| **React + TS + Tailwind** | React + TypeScript + Tailwind CSS | [View Config](./recommended-configs/react-ts-tw/) |
|
|
73
73
|
|
|
74
74
|
### ⚡ Quick Start with Recommended Config
|
|
75
75
|
|
|
@@ -1339,7 +1339,7 @@ import { Button } from "@/components/Button/Button"; // Avoid this!
|
|
|
1339
1339
|
`apis`, `assets`, `atoms`, `components`, `constants`, `contexts`, `data`, `hooks`, `layouts`, `middlewares`, `providers`, `redux`, `requests`, `routes`, `schemas`, `services`, `styles`, `theme`, `utils`, `views`
|
|
1340
1340
|
|
|
1341
1341
|
**Default Ignore Patterns:**
|
|
1342
|
-
`index.js`, `index.jsx`, `index.ts`, `index.tsx`, `.DS_Store`, `__tests__`, `__mocks__`, `*.test.js`, `*.test.jsx`, `*.spec.js`, `*.spec.jsx`
|
|
1342
|
+
`index.js`, `index.jsx`, `index.ts`, `index.tsx`, `.DS_Store`, `__tests__`, `__mocks__`, `*.test.js`, `*.test.jsx`, `*.test.ts`, `*.test.tsx`, `*.spec.js`, `*.spec.jsx`, `*.spec.ts`, `*.spec.tsx`
|
|
1343
1343
|
|
|
1344
1344
|
**Customization Options:**
|
|
1345
1345
|
|
package/index.js
CHANGED
|
@@ -3185,8 +3185,12 @@ const moduleIndexExports = {
|
|
|
3185
3185
|
"__mocks__",
|
|
3186
3186
|
"*.test.js",
|
|
3187
3187
|
"*.test.jsx",
|
|
3188
|
+
"*.test.ts",
|
|
3189
|
+
"*.test.tsx",
|
|
3188
3190
|
"*.spec.js",
|
|
3189
3191
|
"*.spec.jsx",
|
|
3192
|
+
"*.spec.ts",
|
|
3193
|
+
"*.spec.tsx",
|
|
3190
3194
|
];
|
|
3191
3195
|
|
|
3192
3196
|
// Files/folders to ignore
|
|
@@ -3320,7 +3324,13 @@ const moduleIndexExports = {
|
|
|
3320
3324
|
}
|
|
3321
3325
|
|
|
3322
3326
|
// Handle cases like ./folder/index
|
|
3323
|
-
if (isDirectory && (
|
|
3327
|
+
if (isDirectory && (
|
|
3328
|
+
source === `./${itemName}/index`
|
|
3329
|
+
|| source === `./${itemName}/index.js`
|
|
3330
|
+
|| source === `./${itemName}/index.jsx`
|
|
3331
|
+
|| source === `./${itemName}/index.ts`
|
|
3332
|
+
|| source === `./${itemName}/index.tsx`
|
|
3333
|
+
)) {
|
|
3324
3334
|
return true;
|
|
3325
3335
|
}
|
|
3326
3336
|
|
|
@@ -3371,12 +3381,19 @@ const moduleIndexExports = {
|
|
|
3371
3381
|
|
|
3372
3382
|
if (moduleFolders.includes(folderName) && fileName !== "index") {
|
|
3373
3383
|
const dirPath = nodePath.dirname(filename);
|
|
3374
|
-
const
|
|
3384
|
+
const indexPathJs = nodePath.join(dirPath, "index.js");
|
|
3375
3385
|
const indexPathJsx = nodePath.join(dirPath, "index.jsx");
|
|
3386
|
+
const indexPathTs = nodePath.join(dirPath, "index.ts");
|
|
3387
|
+
const indexPathTsx = nodePath.join(dirPath, "index.tsx");
|
|
3376
3388
|
|
|
3377
|
-
|
|
3389
|
+
const hasIndexFile = fs.existsSync(indexPathJs)
|
|
3390
|
+
|| fs.existsSync(indexPathJsx)
|
|
3391
|
+
|| fs.existsSync(indexPathTs)
|
|
3392
|
+
|| fs.existsSync(indexPathTsx);
|
|
3393
|
+
|
|
3394
|
+
if (!hasIndexFile) {
|
|
3378
3395
|
context.report({
|
|
3379
|
-
message: `Module folder "${folderName}" is missing an index file. Create index
|
|
3396
|
+
message: `Module folder "${folderName}" is missing an index file. Create an index file to export all modules.`,
|
|
3380
3397
|
node,
|
|
3381
3398
|
});
|
|
3382
3399
|
}
|
package/package.json
CHANGED