TypeScript conventions used by Galvanize projects.
Install Dependency
npm install @galvanize/typescript-conventions --save-dev
Usage
Inside your project create the associated files and artifacts to pick up the convention.
TypeScript Compilation Options
Inside tsconfig.json
{
"extends": "@galvanize/typescript-conventions/tsconfig",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src"]
}
Install TypeScript:
npm install --save-dev typescript @types/node
Prettier
Inside package.json
{
...
"prettier": "@galvanize/typescript-conventions/.prettierrc.json",
...
}
Install prettier
npm install --save-dev prettier
ESLint (base)
Inside .eslintrc.js
module.exports = {
"extends": [
require.resolve("@galvanize/typescript-conventions/.eslintrc.js"),
]
}
Additionally, you'll want to install peer dependencies:
npm install --save-dev @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint \
eslint-config-prettier eslint-plugin-prettier
ESLint (React)
If using React, inside .eslintrc.js
module.exports = {
"extends": [
require.resolve("@galvanize/typescript-conventions/.eslintrc.js"),
require.resolve("@galvanize/typescript-conventions/.eslintrc.react.js"),
]
}
Additionally, you'll want to install peer dependencies:
npm install --save-dev eslint-plugin-react