0.0.1-alpha.0 • Published 3 years ago

@guidecx/config-typescript v0.0.1-alpha.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

GCX Typescript Config

This module contains the configuration files for Typescript that are used by all GuideCX applications.

Installing library into another project

The tsconfig.json file exports our typescript configuration. In the project you are adding this configuration file to, you can do the following in your tsconfig.json or tsconfig.eslint.json files assuming you have installed the dependency via npm install --save-dev @guidecx/config-typescript:

{
  extends["@guidecx/config-typescript"],
  // overwritten rules as needed. EG:
  // includes: ["**/*"]
};

Running typescript automatically in each application

Generally it is a good idea to make sure that all of our projects are using husky pre-commit hooks with lint-staged to run typescript against all of the files that were changed in a commit.

According to the lint-staged docs, the easiest way to install husky and lint-staged together is by running npx mrm lint-staged.

Follow the installation instructions provided in the husky documentation, then add the follow lines to the package.json file:

"scripts": {
  "tsc": "tsc",
},
"husky": {
  "hooks": {
    "pre-commit": "lint-staged"
  }
},
"lint-staged": {
  "src/**/*.{ts,tsx}": [
    "npm run tsc --noEmit"
  ],
}