All Projects → denisraslov → folderslint

denisraslov / folderslint

Licence: MIT license
📁 Directory structure linter for JavaScript projects

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to folderslint

lints
Lint all your JavaScript, CSS, HTML, Markdown and Dockerfiles with a single command
Stars: ✭ 14 (-89.31%)
Mutual labels:  lint, linter
KaiZen-OpenApi-Parser
High-performance Parser, Validator, and Java Object Model for OpenAPI 3.x
Stars: ✭ 119 (-9.16%)
Mutual labels:  lint, linter
lint-html-with-css
Lint HTML with CSS. A collection of CSS snippets from the hashtag #lintHTMLwithCSS on twitter. These CSS snippets intend to warn developers about common mistakes made in HTML.
Stars: ✭ 35 (-73.28%)
Mutual labels:  lint, linter
nano-staged
Tiny tool to run commands for modified, staged, and committed files in a GIT repository.
Stars: ✭ 347 (+164.89%)
Mutual labels:  lint, linter
makefiles
No description or website provided.
Stars: ✭ 23 (-82.44%)
Mutual labels:  lint, linter
flexlint
A flexible linter with rules defined by regular expression
Stars: ✭ 19 (-85.5%)
Mutual labels:  lint, linter
therapist
Work out your commitment issues.
Stars: ✭ 29 (-77.86%)
Mutual labels:  lint, linter
Sql Lint
An SQL linter
Stars: ✭ 243 (+85.5%)
Mutual labels:  lint, linter
li18nt
🌎 Lint your i18n translation files. Detect conflicting properties, duplicates and make it more readable and easier to maintain by formatting it!
Stars: ✭ 29 (-77.86%)
Mutual labels:  lint, linter
mllint
`mllint` is a command-line utility to evaluate the technical quality of Python Machine Learning (ML) projects by means of static analysis of the project's repository.
Stars: ✭ 67 (-48.85%)
Mutual labels:  lint, linter
yamburger
YAML syntax got you down? That's a YAMBURGER!
Stars: ✭ 32 (-75.57%)
Mutual labels:  lint, linter
breakcheck
Backwards compatibility linter for Go.
Stars: ✭ 66 (-49.62%)
Mutual labels:  lint, linter
Husky.Net
Git hooks made easy with Husky.Net internal task runner! 🐶 It brings the dev-dependency concept to the .NET world!
Stars: ✭ 394 (+200.76%)
Mutual labels:  lint, linter
actionlint
Static checker for GitHub Actions workflow files
Stars: ✭ 1,385 (+957.25%)
Mutual labels:  lint, linter
elm-lint
elm-lint lints Elm source code, to add additional guarantees to your project.
Stars: ✭ 27 (-79.39%)
Mutual labels:  lint, linter
npm-groovy-lint
Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle files using command line
Stars: ✭ 124 (-5.34%)
Mutual labels:  lint, linter
D Scanner
Swiss-army knife for D source code
Stars: ✭ 221 (+68.7%)
Mutual labels:  lint, linter
Fsharplint
Lint tool for F#
Stars: ✭ 224 (+70.99%)
Mutual labels:  lint, linter
eslint-plugin-roku
ESLint plugin to parse and lint BrightScript files
Stars: ✭ 44 (-66.41%)
Mutual labels:  lint, linter
rubocop-linter-action
Rubocop Linter Action: A GitHub Action to run Rubocop against your code!
Stars: ✭ 86 (-34.35%)
Mutual labels:  lint, linter

FoldersLint FoldersLint logo

Directory structure linter for JavaScript projects

FoldersLint in action

  Easily configured in a single file

  Flexible & Fast

  Can be used with lint-staged

Why

Make you project sctructure pretty by linting it 🗂

Directory structure rules are important part of any project. These rules help to raise clarity of the project and reduce its complexity. Having a clearly defined structure make developers always know where to put files and where to find them. If the project is big enough, it is necessary to avoid chaos in it.

folderslint let you configure directory structure rules and check if existed or new files fit these rules.

Quick Overview

Install folderslint globally:

npm install -g folderslint

Setup a config file .folderslintrc in the root of the project.

Run folderslint to check the whole project or a directory (i.e. /components):

folderslint components

Configuration

folderslint needs configuration file named .folderslintrc in the root of the project.

The example of the config:

{
  "root": "src", // optional
  "rules": [
    "components/*",
    "pages/components/*/utils",
    "hooks",
    "legacy/**"
   ]
}

root is the directory the structure of which should be checked.

rules is an array of rules which define permitted directory paths.

Root directory

You have to specify root if you want to check structure in a specific directory. Directories which are out if the root will not be checked. If you want all the directories of the project to be checked, you don't need to specify root.

Rules syntax

There are 3 ways to specify a rule:

  • the exact path of a directory,
  • * instead of a directory name if any directory accepted on that level,
  • ** instead of a directory name if any directory accepted on any lower level.

For example:

Rule Meaning
hooks   The directory hooks (and files in it) is accepted.
  Any nested directory is not accepted.
components/*   The directory components is accepted.
  Any first level nested directory is accepted.
  Any second level nested directory is not accepted.
components/*/utils   The directory components is accepted.
  Any first level nested directory is accepted.
  The second level nested directory utils is accepted.
  Any other second level nested directory is not accepted.
legacy/**   The directory legacy is accepted.
  Any nested directory on any level is accepted.

⚠️ A rule like components/*/utils automatically make the components and components/* rules work. So, no need to specify a rule for every level directory. You need to specify the deepest path.

⚠️ It's not recommended to overuse ** pattern. It lets absence of structure to sprout in your project. Still it could be useful for some directories which have messy structure by its nature - i.e. node_modules, not maintained legacy directories.

Usage with lint-staged

It is handy to use folderslint together with lint-staged. In this case folderslint checks only the files which were modified for a commit.

For that, add folderslint to the lint-staged section of your package.json.

For example, this is how package.json can look like if you want to run folderslint as a pre-commit hook via husky tool:

"husky": {
  "hooks": {
    "pre-commit": "lint-staged",
  }
},
"lint-staged": {
  "*.{js,ts,tsx}": [
    "folderslint"
  ]
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].