@spot-meetings/code-style
Version:
Spot's Code Style guide (ESLint, Prettier)
70 lines (45 loc) • 1.34 kB
Markdown
# @spot-meetings/eslint-config
Spot's Code Style configs (ESLint, Prettier).
Supports Node.js, TypeScript and React.
## Installation
`npm i -D @spot-meetings/code-style`
`yarn add -D @spot-meetings/code-style`
## Configuration
### For JavaScript
`/.eslintrc`
```json
{
"extends": "@spot-meetings/eslint-config/javascript"
}
```
`/.prettierrc.js`
```js
module.exports = require('@spot-meetings/code-style/prettier')
```
### For TypeScript
`/.eslintrc`
```json
{
"extends": "@spot-meetings/eslint-config/typescript"
}
```
`/.prettierrc.js`
```js
module.exports = require('@spot-meetings/code-style/prettier')
```
## Project Setup
After installation, you can run the setup script with:
`$(yarn bin)/spot-setup-code-style`
`$(npm bin)/spot-setup-code-style`
With TypeScript, you may have to update the project configuration to the parser options section of the ESLint config to point to the correct `./tsconfig.json` file:
```json
{
"extends": "@spot-meetings/code-style/typescript",
"parserOptions": {
"project": "./tsconfig.json"
}
}
```
## VSCode
Add the [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions
and configure your formatter to use Prettier as default.