Last active
February 16, 2022 07:37
-
-
Save LevPewPew/5791c7f1b4ccd688d5a8f1a8c6d95c0f to your computer and use it in GitHub Desktop.
starter config for TS CRA on Github
This file contains hidden or 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
# Ignore everything: | |
/* | |
# Except src: | |
!/src |
This file contains hidden or 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
Show hidden characters
{ | |
"extends": ["react-app", "eslint:recommended"], | |
"rules": { | |
"default-case": "error", | |
"default-case-last": "error", | |
"default-param-last": "error", | |
"eqeqeq": "error", | |
"no-alert": "warn", | |
"no-console": "warn", | |
"no-magic-numbers": "warn", | |
"no-redeclare": "off", // original no-redeclare rule must be turned off as it can return in correct errors, see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md | |
"@typescript-eslint/no-redeclare": "error", | |
"no-self-compare": "error", | |
"no-shadow": "warn", | |
"no-unreachable-loop": "warn", | |
"no-unsafe-optional-chaining": "error", | |
"no-unused-expressions": "warn", | |
"no-unused-vars": "warn", | |
"no-useless-return": "error", | |
"require-await": "error", | |
"yoda": "error" | |
} | |
} |
This file contains hidden or 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
name: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 12 | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install dependencies | |
run: npm install | |
- name: Run jest tests | |
run: npm run test | |
- name: Check for build errors | |
run: npm run build |
This file contains hidden or 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
# Ignore everything: | |
/* | |
# Except src: | |
!/src |
This file contains hidden or 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
{ | |
"printWidth": 100, | |
"trailingComma": "all", | |
"tabWidth": 2, | |
"useTabs": false, | |
"semi": true, | |
"singleQuote": true, | |
"quoteProps": "as-needed", | |
"jsxSingleQuote": false, | |
"bracketSpacing": true, | |
"jsxBracketSameLine": false, | |
"arrowParens": "always", | |
"proseWrap": "always", | |
"htmlWhitespaceSensitivity": "css", | |
"endOfLine": "lf" | |
} |
This file contains hidden or 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
# need a specific version of husky to avoid an issue with prettier (i've forgotted what the error was) | |
yarn add --dev [email protected] prettier pretty-quick |
This file contains hidden or 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
// add this pre-commit hook to the rest of the file | |
"husky": { | |
"hooks": { | |
"pre-commit": "pretty-quick --staged" | |
} | |
} |
This file contains hidden or 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": { | |
"baseUrl": "src", | |
"target": "es5", | |
"lib": ["dom", "dom.iterable", "esnext"], | |
"allowJs": true, | |
"skipLibCheck": true, | |
"esModuleInterop": true, | |
"allowSyntheticDefaultImports": true, | |
"strict": true, | |
"forceConsistentCasingInFileNames": true, | |
"noFallthroughCasesInSwitch": true, | |
"module": "esnext", | |
"moduleResolution": "node", | |
"resolveJsonModule": true, | |
"isolatedModules": true, | |
"noEmit": true, | |
// this might need to be "jsx": "react" if it isn't the latest CRA where you don't need to import React | |
"jsx": "react-jsx", | |
"noImplicitAny": true | |
}, | |
"include": ["src/**/*.ts"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment