Last active
April 27, 2020 15:17
-
-
Save tairosonloa/ff937aae997afb63d644f0d95428ff17 to your computer and use it in GitHub Desktop.
Typescript React project basic setup (VSCode with prettier and ESLint) by Tairosonloa
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
Typescript React project basic setup (VSCode with prettier and ESLint) by Tairosonloa |
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
*.js | |
.cache |
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
{ | |
"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" // | |
} | |
} | |
] | |
} |
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
.cache | |
dist | |
package.json | |
package-lock.json | |
yarn.lock | |
public |
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
{ | |
"singleQuote": true, | |
"bracketSpacing": true, | |
"tabWidth": 2, | |
"semi": false, | |
"endOfLine": "lf", | |
"trailingComma": "all", | |
"arrowParens": "always", | |
"jsxBracketSameLine": true, | |
"printWidth": 100 | |
} |
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
{ | |
"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", | |
} |
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
{ | |
"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"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Node modules:
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```