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.
Files changed (3) hide show
  1. package/README.md +3 -3
  2. package/index.js +21 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -9,6 +9,7 @@
9
9
  [![ESLint](https://img.shields.io/badge/ESLint-%3E%3D9.0.0-4B32C3?style=for-the-badge&logo=eslint&logoColor=white)](https://eslint.org/)
10
10
  [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18.0.0-339933?style=for-the-badge&logo=node.js&logoColor=white)](https://nodejs.org/)
11
11
  [![React](https://img.shields.io/badge/React-JSX%20Support-61DAFB?style=for-the-badge&logo=react&logoColor=black)](https://react.dev/)
12
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Supported-3178C6?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
12
13
 
13
14
  [![GitHub stars](https://img.shields.io/github/stars/Mohamed-Elhawary/eslint-plugin-code-style?style=for-the-badge&logo=github&color=yellow)](https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/stargazers)
14
15
  [![GitHub issues](https://img.shields.io/github/issues/Mohamed-Elhawary/eslint-plugin-code-style?style=for-the-badge&logo=github)](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 + TypeScript** | React + TypeScript | *Coming Soon* |
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 && (source === `./${itemName}/index` || source === `./${itemName}/index.js` || source === `./${itemName}/index.jsx`)) {
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 indexPath = nodePath.join(dirPath, "index.js");
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
- if (!fs.existsSync(indexPath) && !fs.existsSync(indexPathJsx)) {
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.js to export all modules.`,
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-code-style",
3
- "version": "1.0.41",
3
+ "version": "1.1.2",
4
4
  "description": "A custom ESLint plugin for enforcing consistent code formatting and style rules in React/JSX projects",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",