@nordicsemiconductor/asset-tracker-cloud-code-style
v13.1.16
Published
Code style definitions for all nRF Asset Tracker projects.
Downloads
10,195
Readme
Code Style definitions
Code Style definitions for all nRF Asset Tracker projects
- ESLint configuration (with TypeScript support)
- Prettier configuration
Installation
npm i --save-dev --save-exact @nordicsemiconductor/asset-tracker-cloud-code-style
Usage
Update your package.json
:
{
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{ts,tsx}": ["prettier --write", "eslint --ext .js,.ts"],
"*.{md,json,yaml,yml,js}": ["prettier --write"]
}
}
Then:
npm i --save-dev --save-exact @nordicsemiconductor/asset-tracker-cloud-code-style
cp node_modules/@nordicsemiconductor/asset-tracker-cloud-code-style/templates/* ./
cp node_modules/@nordicsemiconductor/asset-tracker-cloud-code-style/templates/.* ./
Use with React
npm install eslint-plugin-react --save-dev
Use this .eslintrc
{
"extends": [
"@nordicsemiconductor/eslint-config-asset-tracker-cloud-typescript",
"plugin:react/recommended"
],
"settings": {
"react": {
"version": "latest"
}
}
}
tsconfig.json
:
{
"extends": "@nordicsemiconductor/asset-tracker-cloud-code-style/tsconfig.json",
"include": ["src/*.tsx", "src/*.ts"],
"exclude": ["src/*.spec.ts"],
"compilerOptions": {
"outDir": "dist/",
"jsx": "react",
"lib": ["DOM", "ES5"],
"target": "es2018",
"esModuleInterop": true
}
}
Use with Creat React App
Use this .eslintrc
{
"extends": [
"@nordicsemiconductor/eslint-config-asset-tracker-cloud-typescript",
"react-app"
]
}
npm i --save-dev --save-exact [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]
Do not use tsconfig.json
from code-style.
Migrating to @nordicsemiconductor/asset-tracker-cloud-code-style
For converting projects to use code-style:
npm uninstall --save --save-dev @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-config-prettier lint-staged prettier semantic-release @nordicsemiconductor/asset-tracker-cloud-code-style tslint lint-staged prettier typescript