Skip to content

Instantly share code, notes, and snippets.

@tairosonloa
Last active April 27, 2020 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tairosonloa/ff937aae997afb63d644f0d95428ff17 to your computer and use it in GitHub Desktop.
Save tairosonloa/ff937aae997afb63d644f0d95428ff17 to your computer and use it in GitHub Desktop.
Typescript React project basic setup (VSCode with prettier and ESLint) by Tairosonloa
Typescript React project basic setup (VSCode with prettier and ESLint) by Tairosonloa
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "prettier", "react", "react-hooks"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:react/recommended",
"plugin:prettier/recommended"
],
"rules": {
"prettier/prettier": "error",
"react/prop-types": [
"error",
{
"skipUndeclared": true
}
],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn"
},
"settings": {
"react": {
"version": "detect"
}
},
"env": {
"browser": true,
"node": true,
"jest": true,
"es6": true
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"impliedStrict": true
}
},
"overrides": [
// Override some TypeScript rules just for .js files
{
"files": ["*.js"],
"rules": {
"@typescript-eslint/no-var-requires": "off" //
}
}
]
}
.cache
dist
package.json
package-lock.json
yarn.lock
public
{
"singleQuote": true,
"bracketSpacing": true,
"tabWidth": 2,
"semi": false,
"endOfLine": "lf",
"trailingComma": "all",
"arrowParens": "always",
"jsxBracketSameLine": true,
"printWidth": 100
}
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.enable": true,
"eslint.alwaysShowStatus": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll": true,
"source.organizeImports": true
},
"editor.formatOnSave": true,
"editor.formatOnPaste": false,
// Language custom settings
"[python]": {
"editor.tabSize": 4,
"editor.insertSpaces": true
},
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": false
},
"[javascriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": false
},
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": false
},
"[typescriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": false
},
"javascript.updateImportsOnFileMove.enabled": "always",
"typescript.updateImportsOnFileMove.enabled": "always",
}
{
"compilerOptions": {
"target": "esnext",
"lib": ["esnext", "dom", "dom.iterable"],
"allowJs": true,
"strict": true,
"alwaysStrict": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"noFallthroughCasesInSwitch": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"skipLibCheck": true
},
"exclude": ["node_modules"],
"include": ["**/*.ts", "**/*.tsx"]
}
@tairosonloa
Copy link
Author

tairosonloa commented Apr 15, 2020

Node modules:

yarn add prop-types react react-dom react-helmet
yarn add -D typescript eslint @typescript-eslint/parser eslint-config-prettier eslint-plugin-prettier prettier @types/node @types/jest @types/prop-types @types/react @types/react-dom @typescript-eslint/eslint-plugin```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment