Skip to content

bringmetheaugust/Beria

Repository files navigation

Beria 🦅

Витя, получишь пизды, если будешь использовать margin-top.

npm package for scanning files and searching content by strings/substrings/chars/regExp.

Intro

The most relevant usage is looking for "forbidden" text/code in Your project.
For example, Your team agreed don't use padding or margin in Your CSS/Scss/Sass files, but someone still uses it. Beria will scan Your project and find this "forbidden" content.
The most practical use with pre-commit git hooks.

Quick start

  • install package using npm i beria --save-dev or yarn beria -D
  • create beria.config.json config file inside root directory
  • run npx beria

Config file examples

Simple config
  • Looking for margin-top and margin-right strings in .scss files inside styles folder
  • Package exits with the error if one of these strings was detected
    {
        "include": [
            {
                "folder": "styles",
                "fileExtention": "scss",
                "targets": [
                    "margin-top",
                    "margin-right"
                ],
            }
        ]
    }
    
Advanced config
  • Looking for margin-top and margin-right strings in .scss files inside styles folder.
    Margin-Top or margiN-Right will'nt be founded cause withRegister option is on.
  • Also looking for zalupa string in .ts files inside types folder.
    Zalupa or zAlupA strings will be detected cause withRegister option is off.
  • package show all founded cases but doesn't exit with the error cause onlyWarning option is on.
    {
        "include": [
            {
                "folder": "styles",
                "fileExtention": "scss",
                "targets": [
                    "margin-top",
                    "margin-right"
                ],
                "withRegister": true
            },
            {
                "folder": "types",
                "fileExtention": "ts",
                "targets": [ "zalupa" ],
                "withRegister": false
            },
        ],
        "onlyWarning": true
    }
    

Options

You should know that CLI options have higher priority than options from the config file.
  • --config

    By default package looks for default beria.config.json config file inside project folder. You can set another path to Your config file. Example: --config=myfolder/conf.json

  • --onlyWarning

    By default, programm exist with error status if search was successful. The option disable this behavior.