Giter VIP home page Giter VIP logo

treets's Introduction

Treets

Experimentan library to work with very nested objects. Based in traverse.

yarn add https://github.com/juanmait/treets

Usage

import { traverse } from 'treets'

Development

TL;DR

# install dependencies
$ yarn install

start (compile + watch):

$ yarn start

Install vscode extensions:

vscode shortcuts:

  • ctrl+i: auto fix/format using prettier.
  • ctrl+alt+n: run the current file with ts-node if ends with .ts and with jest if ends with .test.ts.

Linting

Combines tslint & prettier without conflicting each other by using tslint-config-prettier. For vscode the recommended extensions are prettier-vscode and vscode-typescript-tslint-plugin. Those enables linting, auto formating and auto fixing via ctrl+i, on file save, on paste and more (check config at .vscode/settings.json).

Linting scripts (yarn/npm)

$ yarn checkTslint
# check for any conflict between tslint and prettier configs. Run this when you
# add new rules to your tslint.json file. It will warn you about what are the
# rules that you should avoid.

$ yarn lint
# run tslint on all `.ts` files inside the `./src` folder.

$ yarn prettier-tslint
# run tslint and prettier to find errors and fix those that are possible to
# auto-fix.

Check package.json files in the "scripts" field for details.


Git Hooks

Includes a pre-commit hook that runs prettier and tslint in your staged files to check for errors (and auto fix them when possible) before commits. It will abort the commit phase if errors prevails after the auto fixing. It uses husky and lint-staged for that.


Typescript

The typescript configuration is pretty strict. Is up to you to make it less restrictive if you want. Check tsconfig.json.

Typescript scripts (yarn/npm)

# transpile all `.ts` files in `./src` folder and place the result in the `./dist` folder
$ yarn compile

# same as `compile` but enables a watcher to auto build on file changes
$ yarn watch

Testing with JEST

$ yarn jest # run all tests inside `./src` folder

Vscode support:

  • use prettier for auto formating ctrl+i, format on save, format on paste.
  • run *.ts and *.test.ts files directly from the IDE with key shortcut ctrl+alt+n. It will use ts-node for *.ts files and jest with [ts-jest] preset for *.test.ts. It uses vscode extension code-runner with a custom config in .vscode/settings.json. By default it will run the process opening a vscode terminal, you can configure this in .vscode/settings.json under "code-runner.runInTerminal".

treets's People

Contributors

juanmait avatar dependabot[bot] avatar

Watchers

 avatar

treets's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.