iov-core icon indicating copy to clipboard operation
iov-core copied to clipboard

Implement better filename approach

Open willclarktech opened this issue 5 years ago • 0 comments

Our current filename approach is pretty inconsistent. Eg:

Lowercase with no separation:

$ tree packages/iov-core/src
packages/iov-core/src
├── index.ts
├── integrationtests
│   ├── atomicswapbnsbcp.spec.ts
│   └── atomicswapbnseth.spec.ts
├── jsrpc.spec.ts
├── jsrpc.ts
├── jsrpcsigningserver.spec.ts
├── jsrpcsigningserver.ts
├── multichainsigner.spec.ts
├── multichainsigner.ts
├── signingservercore.spec.ts
├── signingservercore.ts
├── signingservice.spec.ts
└── workers
    └── signingservice.worker.ts

Lowercase separated by underscores

$ tree scripts/bnsd
scripts/bnsd
├── README.md
├── bnsd_app.sh
├── bnsd_init.sh
├── bnsd_tm.sh
├── genesis_app_state.json
├── start.sh
└── stop.sh

CamelCase:

$ tree scripts/ethereum/deployment/src
scripts/ethereum/deployment/src
├── AshToken.ts
├── AshTokenAbi.ts
├── AtomicSwapErc20.ts
├── AtomicSwapErc20Abi.ts
├── AtomicSwapEther.ts
├── AtomicSwapEtherAbi.ts
├── TrashToken.ts
├── TrashTokenAbi.ts
└── deploy_contracts.ts

Long names without any kind of separation between words is ugly and difficult to read. Mixed-case filenames can cause lots of trouble because they might be handled differently by different OSes (sorting etc) and the default git setting is to ignore case. I therefore propose renaming all files to meet the following standard:

  1. Only lowercase letters. (I could also support making an exception for .md files, where it's traditional to use all-caps in some situations.)
  2. Underscore separation between words. (I could also support hyphen separation, but we already use underscore separation fairly widely.)
  3. Dot-separation at the end of the name before the file type should be used for a defined set of file sub-types (eg we currently use .spec.ts, .worker.ts etc).

willclarktech avatar Apr 18 '19 15:04 willclarktech