Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itwillwork/eslint-plugin-file-structure-control
https://github.com/itwillwork/eslint-plugin-file-structure-control
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/itwillwork/eslint-plugin-file-structure-control
- Owner: itwillwork
- Created: 2023-04-26T17:09:03.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-04-26T17:20:10.000Z (over 1 year ago)
- Last Synced: 2024-04-28T20:05:48.787Z (7 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# eslint-plugin-file-structure-control
Eslint plugin for linting file structure
## Installation
```
npm i --save-dev eslint-plugin-file-structure-control
```## Usage
Create an .eslint.json file with the following:
```json
"plugins": [
"file-structure-control"
]
```Then, you can add the custom rules to the .eslint.json file:
```json
"rules": {
"file-structure-control/sync-relative-files": "error"
}
```To lint your project with ESLint, add the following script to your package.json:
```json
{
"scripts": {
"lint": "eslint ."
}
}
```and run the linter with:
```
npm run lint
```## Rules
#### file-structure-control/sync-relative-files
Config example:
```js
"file-structure-control/sync-relative-files": ["error", {
relations: {
'.test.tsx': ['.tsx'],
'.test.ts': ['.ts'],
'.classes.ts': ['.tsx'],
},
}],
```Examples of incorrect code for this rule:
```
/components
/Time.classes.ts
/Times.tsx <--- correct Time.tsx
/utils
/time.test.ts
/time-utils.ts <--- correct time.ts
```Examples of correct code for this rule:
```
/components
/Time.tsx
/Time.classes.ts
/utils
/time.test.ts
/time.ts
```