Skip to content

Commit

Permalink
2.0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Kowalski committed Jul 25, 2024
1 parent ad7b124 commit 04da2a6
Show file tree
Hide file tree
Showing 18 changed files with 250 additions and 1,384 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

60 changes: 42 additions & 18 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,62 @@ module.exports = {
],
settings: {
"project-structure/folder-structure-config-path":
"folderStructure.jsonc",
"folderStructure.json",
"project-structure/independent-modules-config-path":
"independentModules.jsonc",
"independentModules.json",
},
rules: {
"project-structure/independent-modules": "error",
"project-structure/folder-structure": "error",
"project-structure/export-rules": [
"project-structure/naming-rules": [
2,
{
filePattern: "**/*consts.ts",
allowExportNames: ["/^{SNAKE_CASE}$/"],
rules: [
{
nameType: "VariableDeclarator",
allowNames: ["/^{SNAKE_CASE}$/"],
},
],
},
{
filePattern: "**/*.types.ts",
allowExportNames: ["/^{PascalCase}$/"],
},
{
filePattern: ["**/errors/*.ts"],
allowExportNames: [
"/^{filename_PascalCase}Props$/",
"/^{filename_PascalCase}Return$/",
"/^{filename_camelCase}$/",
"/^{filename_PascalCase}$/",
rules: [
{
nameType: [
"TSInterfaceDeclaration",
"TSTypeAliasDeclaration",
"TSEnumDeclaration",
],
allowNamesFileRoot: ["/^{PascalCase}$/"],
},
],
},
{
filePattern: ["**/*.ts", "!index.ts"],
allowExportNames: [
"/^{filename_PascalCase}Props$/",
"/^{filename_PascalCase}Return$/",
"/^{filename_camelCase}$/",
filePattern: "**/*.ts",
rules: [
{
nameType: [
"ArrowFunctionExpression",
"FunctionDeclaration",
],
allowNamesFileRoot: ["/^{filename_camelCase}$/"],
allowNames: ["/^{camelCase}$/"],
},
{
nameType: [
"TSInterfaceDeclaration",
"TSTypeAliasDeclaration",
],
allowNamesFileRoot: [
"/^{filename_PascalCase}Props$/",
"/^{filename_PascalCase}Return$/",
],
},
{
nameType: "VariableDeclarator",
allowNames: ["/^{camelCase}$/"],
},
],
},
],
Expand Down
3 changes: 0 additions & 3 deletions babel.config.js

This file was deleted.

18 changes: 9 additions & 9 deletions documentation/project-structure-folder-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ Add the following lines to **`.eslintrc`**.
"project-structure/folder-structure": "error", // warn | error
},
"settings": {
"project-structure/folder-structure-config-path": "folderStructure.jsonc", // json | jsonc | yaml
"project-structure/folder-structure-config-path": "folderStructure.json", // json | yaml
},
}
```

### Step 3

Create a **`folderStructure.jsonc`**, **`folderStructure.json`** or **`folderStructure.yaml`** in the root of your project.<br>
Create a **`folderStructure.json`** or **`folderStructure.yaml`** in the root of your project.<br>

> [!NOTE]
> You can choose your own file name, just make sure it is the same as in **[Step 2](#step-2)**.
Expand All @@ -138,7 +138,7 @@ If you have any questions **[click here](https://github.com/Igorkowalski94/eslin
```
.
├── ...
├── 📄 folderStructure.jsonc
├── 📄 folderStructure.json
├── 📄 .eslintrc.json
└── 📂 src
├── 📄 index.tsx
Expand All @@ -147,7 +147,7 @@ If you have any questions **[click here](https://github.com/Igorkowalski94/eslin
└── 📄 ComponentName.tsx
```

#### JSON
#### folderStructure.json

```jsonc
{
Expand Down Expand Up @@ -179,7 +179,7 @@ If you have any questions **[click here](https://github.com/Igorkowalski94/eslin
}
```

#### YAML
#### folderStructure.yaml

```yaml
structure:
Expand All @@ -200,7 +200,7 @@ structure:
```
.
├── ...
├── 📄 folderStructure.jsonc
├── 📄 folderStructure.json
├── 📄 .eslintrc.json
└── 📂 src
├── 📂 hooks
Expand Down Expand Up @@ -241,7 +241,7 @@ structure:
└── 📄 useComplexParentComponentHook.ts
```

#### JSON
#### folderStructure.json

```jsonc
{
Expand Down Expand Up @@ -321,7 +321,7 @@ structure:
}
```

#### YAML
#### folderStructure.yaml

```yaml
ignorePatterns:
Expand Down Expand Up @@ -365,7 +365,7 @@ regexParameters:
### **`"$schema"`**: `<string | undefined>` <a id="schema"></a>

Type checking for your **`folderStructure.jsonc`**. It helps to fill configuration correctly.
Type checking for your **`folderStructure.json`**. It helps to fill configuration correctly.

```jsonc
{
Expand Down
12 changes: 6 additions & 6 deletions documentation/project-structure-independent-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ Add the following lines to **`.eslintrc`**.
"project-structure/independent-modules": "error", // warn | error
},
"settings": {
"project-structure/independent-modules-config-path": "independentModules.jsonc", // json | jsonc | yaml
"project-structure/independent-modules-config-path": "independentModules.jsonc", // json | yaml
},
}
```

### Step 2

Create a **`independentModules.jsonc`**, **`independentModules.json`** or **`independentModules.yaml`** in the root of your project.<br>
Create a **`independentModules.json`**, **`independentModules.json`** or **`independentModules.yaml`** in the root of your project.<br>

> [!NOTE]
> You can choose your own file name, just make sure it is the same as in **[Step 2](#step-2)**.
Expand All @@ -80,7 +80,7 @@ If you have any questions **[click here](https://github.com/Igorkowalski94/eslin
```
.
├── ...
├── 📄 independentModules.jsonc
├── 📄 independentModules.json
└── 📂 src
└── 📂 features
├── ...
Expand All @@ -99,7 +99,7 @@ If you have any questions **[click here](https://github.com/Igorkowalski94/eslin
└── 📄 Feature2.tsx Public.
```

#### independentModules.jsonc
#### independentModules.json

```jsonc
{
Expand Down Expand Up @@ -140,7 +140,7 @@ If you have any questions **[click here](https://github.com/Igorkowalski94/eslin
```
.
├── ...
├── 📄 independentModules.jsonc
├── 📄 independentModules.json
└── 📂 src
└── 📂 features
├── ...
Expand All @@ -159,7 +159,7 @@ If you have any questions **[click here](https://github.com/Igorkowalski94/eslin
```

#### independentModules.jsonc
#### independentModules.json

```jsonc
{
Expand Down
74 changes: 37 additions & 37 deletions folderStructure.jsonc → folderStructure.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,108 +6,108 @@
"name": "src",
"children": [
{
"ruleId": "rules_folder",
"ruleId": "rules_folder"
},
{
"ruleId": "helpers_folder",
"ruleId": "helpers_folder"
},
{
"ruleId": "errors_folder",
"ruleId": "errors_folder"
},
{
"name": "consts",
"extension": ".ts",
"extension": ".ts"
},
{
"name": "index",
"extension": ".ts",
},
],
"extension": ".ts"
}
]
},
{
"extension": "*",
},
],
"extension": "*"
}
]
},
"rules": {
"additional_files": {
"name": "/^{parentName}(\\.(types|consts|test))$/",
"extension": ".ts",
"extension": ".ts"
},

"test_file": {
"name": "/^{camelCase}\\.test$/",
"extension": ".ts",
"extension": ".ts"
},

"helper_folder": {
"name": "/^{camelCase}$/",
"children": [
{
"ruleId": "helpers_folder",
"ruleId": "helpers_folder"
},
{
"ruleId": "additional_files",
"ruleId": "additional_files"
},
{
"name": "/^{parentName}$/",
"extension": ".ts",
},
],
"extension": ".ts"
}
]
},
"helpers_folder": {
"name": "helpers",
"children": [
{
"ruleId": "helper_folder",
"ruleId": "helper_folder"
},
{
"ruleId": "test_file",
"ruleId": "test_file"
},
{
"name": "/^{camelCase}$/",
"extension": ".ts",
},
],
"extension": ".ts"
}
]
},
"rule_folder": {
"name": "/^{camelCase}$/",
"children": [
{
"ruleId": "helpers_folder",
"ruleId": "helpers_folder"
},
{
"ruleId": "errors_folder",
"ruleId": "errors_folder"
},
{
"ruleId": "additional_files",
"ruleId": "additional_files"
},
{
"name": "/^{parentName}$/",
"extension": ".ts",
},
],
"extension": ".ts"
}
]
},
"rules_folder": {
"name": "rules",
"children": [
{
"ruleId": "rule_folder",
},
],
"ruleId": "rule_folder"
}
]
},
"errors_folder": {
"name": "errors",
"children": [
{
"name": "/^{camelCase}(\\.test)?$/",
"extension": ".ts",
"extension": ".ts"
},
{
"name": "/^{PascalCase}(\\.test)?$/",
"extension": ".ts",
},
],
},
},
"extension": ".ts"
}
]
}
}
}
Loading

0 comments on commit 04da2a6

Please sign in to comment.