cra-template-code-standards
This create-react-app template adds in standardized eslint
, prettier
, browserlist
settings. As well as lays the groundwork for standardizing unit tests with enzyme
and react-testing-library
.
Installation
Run the following command.
npx create-react-app example --template file:../templates/cra-template-workspaces-app
package.json Remove
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
update .env files
replace instances of example
with your package name
this will be the folder where the app will be served from
delete .gitignore, it only exists to make template complete successfully
Add Scope to package name
"name": "@bsc-features/package-name-here",
Additional Scripts
In the project directory, you can run:
yarn lint
Runs eslint
. It will output issues to the console as well as fix any fixable issues.
yarn lint:build
Runs eslint
. It will output issues to the console.
yarn format
Runs prettier
. It will output issues to the console as well as fix any fixable issues.
yarn format:build
Runs prettier
. It will output issues to the console.
yarn test:coverage
Launches the test runner without the interactive watch mode.
Generated code coverage reports will reside in /coverage
Generated junit compatible test results will reside in /src/tests/junit.xml