Socket
Book a DemoInstallSign in
Socket

misclint

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

misclint

Lint some simple but useful usecases.

latest
Source
npmnpm
Version
0.2.6
Version published
Maintainers
1
Created
Source

misclint

What's this

Lint some misc stuff:

  • directory size
  • file size
  • directory name
  • file name
  • substring in file

I'm tired of checking & preventing shitty code & output at work. I think I need a tool to finish the chaos.

Usage

Installation

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.

// @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.

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

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.

type Options = true

noKebabCaseFilename

Disallow kebab case file name.

type Options = true

noPattern

Disallow string patterns existing in files.

type Options = { patterns: string[] }

requiredPattern

Force string patterns existing in files.

type Options = { patterns: string[] }

FAQs

Package last updated on 03 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts