New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jshelf

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jshelf

react project format tool

  • 0.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

JShelf

JShelf is a react project auto format tool, you can use it to format your react project structure easily.

npm

alt text

features:

  • configurable
  • format directory and file names
  • auto modify the module import and export
  • parse module require to import

Installation

you can install jshelf by the npm recommend:

$ npm install jshelf --save-dev

Usage

  1. create a config file jshelf.json for your project, for example:
{
  "root": "./src",
  "ignore": ["./src/app/", "./src/lib/", "./src/util/"],
  "rules": {
    "directory": {
      "case": "kebab"
    },
    "files": [
      {
        "test": "\\.js$|\\.jsx$",
        "case": "camel",
        "ignore": [
          "index",
          "logic",
          "store",
          "actions",
          "util"
        ]
      },
      {
        "test": "\\.less$",
        "case": "mix",
        "ignore": []
      }
    ],
    "default": {
      "case": "mix",
      "ignore": []
    }
  },
  "words": [
    "these",
    "are",
    "words",
    "used",
    "in",
    "your",
    "file",
    "names",
  ]
}
  1. run the command in your project's root directory
$ jshelf

Config options

field nametyperequiredcomment
rootstringtruethe root directory to be formated
ignorearrayfalsethe directorys you don't want to be formated but included in the root
rulesobjecttruethe rules according to which to format
rules.directoryobjectfalsedirectory rules<rule item>
rules.filesarrayfalsefiles rules<rule item>
rules.defaultobjecttruedefault rules<rule item>
wordsarraytruethe words appeard in your file or directory name

Rule item configs:

field nametyperequiredcomment
casestringtrueformat case selectable: camel, kebab, mix, snack
teststringtrueonly file rules has this option, regular expression string to match the file
ignorearrayfalsethe file's name you don't want to format

Cases

now you can format your file or directory name use one of the following cases:

caseexamplewordsformated
kebab'kebabcase'['kebab', 'case']kebab-case
snake'snakecase'['snake', 'case']snake_case
camel'camelcase'['camel', 'case']CamelCase
mix'mixcase'['mix', 'case']mixCase

Words

the words maintain a dictionary to format your project file and directory names, jshelf will spit your file or directory name according these words. before use jshelf, you must scan your project and find all the words you used in your directory and files, exclude ignored files.

for example, now you have a file named jshelfformatfile.js, if you want to formated it to jshelfFormatFile.js, your words config should be ['jshelf', 'format', 'file'] and the case is mix.

Keywords

FAQs

Package last updated on 15 Dec 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc