项目根目录文件
- index.html
- 404.html
- favicon.ico
- robots.txt
- humans.txt
- package.json
- tsconfig.json
- jsconfig.json
- lerna.json
- cypress.json
- cypress 前端 e2e测试工具
- mlc_config.json
- sandbox.config.json
- .editorconfig
- .gitignore
- LICENSE.txt
- README.md
- CHANGELOG.md
- HTML语义化检测
- section,article 最好都有标题
- charset的声明要在 页面的 1024字符内
- 更新最新浏览器
package.json
{
"script": {
"translations": "node ./translations.js"
}
}
jsconfig.json
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"baseUrl": ".",
"paths": { // 路径别名,软连接
"@components": ["./src/components/"],
"@models": ["./src/models/"],
"@routes": ["./src/routes/"],
"@utils": ["./src/utils/"],
"@i18n": ["./src/i18n/"],
},
"target": "ES6",
"module": "commonjs",
"allowSyntheticDefaultImports": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
tsconfig.json
- tsconfig配置参考 https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
{
"include": ["**/*"], // blob 格式
}
eslint配置
- 安装 eslint插件 ```jsx “eslint”: “^4.19.1”, “eslint-plugin-import”: “^2.11.0”, “eslint-plugin-react”: “^7.7.0”, “eslint-plugin-react-hooks”: “^1.1.0-alpha.1”, “redbox-react”: “^1.3.6”, “redux-devtools-extension”: “2.13.0”
npm install eslint eslint-plugin-import eslint-plugin-react -D
<a name="0TS7O"></a>
## translationrc.js
1. Manage all translations based on the extracted messages of the babel-plugin-react-intl
2. [https://github.com/GertjanReynaert/react-intl-translations-manager](https://github.com/GertjanReynaert/react-intl-translations-manager)
3. i18n 多语言
```jsx
yarn add react-intl --save
yarn add react-intl-translations-manager --dev
// translations.js
const manageTranslations = require('react-intl-translations-manager').default
manageTranslations({
messagesDirectory: 'src/translations/extractedMessages'
translationsDirectory: 'src/translations/',
whitelistsDirectory: 'src/translations/allowList/', // 白名单
languages: ['zh', 'en'],
singleMessagesFile: true,
})
// package.json 使用 npm run translations
{
"script": {
"translations": "node ./translations.js"
}
}