Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/07akioni/misclint
https://github.com/07akioni/misclint
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/07akioni/misclint
- Owner: 07akioni
- Created: 2023-01-16T18:53:55.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-03T04:45:33.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T01:05:50.801Z (8 months ago)
- Language: TypeScript
- Size: 43.9 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# misclint
## What's this
Lint some misc stuff:
- directory size
- file size
- directory name
- file name
- substring in fileI'm tired of checking & preventing shitty code & output at work. I think I need a tool to finish the chaos.
## Usage
### Installation
```sh
npm install misclint
```### Create config file
Create a file with name `misclint.config.mjs` (or any other names, it doesn't matter).
Just make sure do not use `.js` suffix since it can only be run with es module.
```js
// @ts-check
import { executeConfig } from 'misclint'executeConfig({
overrides: [
{
// glob, array can also be used, for example 'src/**/*', ['src', 'dist']
files: 'dist',
rules: {
maxDirectorySize: {
size: 51200
}
}
},
// ... other { files, rules }
]
})
```### Run lint
```
node mistlint.config.mjs
```## Rules
### `maxFileSize`
Limit max file size.
```ts
type Options = {
// bytes
size: number
// Whether to show size info even if there's no error
// @default false
showInfo?: boolean
}
```### `maxDirectorySize`
Limit max directory size
```ts
type Options = {
// bytes
size: number
// Whether to ingore folder size. In different file system, such as ext or
// apfs, size of folders are different thus the result in different system
// may be inaccurate
// @default false
ignoreFolderSize?: boolean
// Whether to show size info even if there's no error
// @default false
showInfo?: boolean
}
```### `noKebabCaseDirname`
Disallow kebab case directory name.
```ts
type Options = true
```### `noKebabCaseFilename`
Disallow kebab case file name.
```ts
type Options = true
```### `noPattern`
Disallow string patterns existing in files.
```ts
type Options = { patterns: string[] }
```### `requiredPattern`
Force string patterns existing in files.
```ts
type Options = { patterns: string[] }
```