Last active
May 6, 2023 19:29
-
-
Save LucasBonafe/f4a64ec82fdcb4317643a150a0808351 to your computer and use it in GitHub Desktop.
tsc --init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tutorial: https://www.youtube.com/watch?v=aTf8QTjw4RE | |
yarn init -y | |
yarn add -D typescript sucrase @types/node | |
mkdir src | |
touch src/server.ts | |
+package.json: | |
"scripts": { | |
"dev": "nodemon src/server.ts", | |
"build": "sucrase ./src -d ./dist --transforms typescript,imports" | |
}, | |
yarn add -D nodemon | |
touch nodemon.json | |
+nodemon.json: | |
{ | |
"watch": ["src"], | |
"ext": "ts", | |
"execMap": { | |
"ts": "sucrase-node src/server.ts" | |
} | |
} | |
touch .gitignore | |
+.gitignore: | |
node_modules/ | |
yarn add -D eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin | |
yarn eslint --init | |
>To check syntax, find problems, and enforce code style | |
>JavaScript modules (import/export) | |
>None of these | |
>Node | |
>Use a popular style guide | |
>Standard | |
>JavaScript | |
>Yes | |
-package-lock.json | |
yarn | |
+.eslintrc.js: | |
module.exports = { | |
parser: '@typescript-eslint/parser', | |
env: { | |
'es6': true, | |
'node': true | |
}, | |
plugins: ['@typescript-eslint'], | |
extends: [ | |
'plugin:@typescript-eslint/recommended', | |
'standard' | |
], | |
globals: { | |
'Atomics': 'readonly', | |
'SharedArrayBuffer': 'readonly' | |
}, | |
parserOptions: { | |
'ecmaVersion': 2018, | |
'sourceType': 'module' | |
}, | |
rules: { | |
} | |
} | |
+settings.json://Configuração do VSCode | |
"eslint.autoFixOnSave": true,//ESLint | |
"eslint.validate": [ | |
"javascript", | |
"javascriptreact", | |
{"language": "typescript", "autoFix": true}, | |
{"language": "typescriptreac", "autoFix": true} | |
], | |
yarn add -D @types/node |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment