Skip to content

Commit

Permalink
chore: update ESLint docs
Browse files Browse the repository at this point in the history
  • Loading branch information
staylor committed Jun 18, 2020
1 parent a1ce5c6 commit ff67872
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 74 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"scripts": {
"bootstrap": "npm i && lerna bootstrap --hoist",
"clean-bootstrap": "lerna clean --yes && rm -rf node_modules && npm run bootstrap",
"publish": "lerna publish --conventional-commits --create-release github",
"publish": "lerna publish --exact --conventional-commits --conventional-graduate --create-release github",
"test:starter": "lerna exec --scope \"kyt-starter-{server,static,universal}-src\" --",
"test": "jest && npm run test:starter -- npm t",
"test:ci": "jest --ci && npm run test:starter -- npm t -- --ci",
Expand Down
152 changes: 79 additions & 73 deletions packages/eslint-config-kyt/README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,74 @@
# kyt ESLint Linter and JavaScript Style Guide

This is an extension of the Airbnb [**JavaScript**](https://github.com/airbnb/javascript) and [**React**](https://github.com/airbnb/javascript/tree/master/react) style guides and [ESLint](http://eslint.org/) linter.

## Install

Note, setting up a `starter-kyt` will install this package automatically.

1. Install `eslint-config-kyt` and its dependencies:
```sh
yarn add --dev [email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
eslint-config-kyt \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected]
```
```sh
npm i --save-dev --save-exact [email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
eslint-config-kyt \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected]
```
2. Copy the following into an `.eslintrc.js` in your project:

```js
module.exports = {
extends: ['eslint-config-kyt'],
// shorthand: ['kyt']
rules: {
/* If you must, override rules here :P */
},
};
### eslint-config-kyt

## Installation

#### yarn
```sh
yarn add --dev [email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
eslint-config-kyt \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected]

# or

npm i --save-dev --save-exact [email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
eslint-config-kyt \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected]
```

Add to the `extends` section of your ESLint configuration:

`.eslintrc(.json)`:
```json
{
"extends": ["eslint-config-kyt"],
"rules": {}
}
```
`.eslintrc.js`:
```js
module.exports = {
extends: ['eslint-config-kyt'],
// shorthand: ['kyt']
rules: {
/* If you must, override rules here :P */
},
};
```

To add a subset of rules, you can specify one of the following:

```js
module.exports = {
extends: [
// extends airbnb/base and contains all of our custom rules
'kyt/base',
// adds `jest` and `jest-formatting` plugins
'kyt/jest',
// adds Airbnb's React rules before our custom rules
'kyt/react',
// all rules
'kyt'
]
}
```
```js
module.exports = {
extends: [
// extends airbnb/base and contains all of our custom rules
'kyt/base',
// adds `jest` and `jest-formatting` plugins
'kyt/jest',
// adds Airbnb's React rules before our custom rules
'kyt/react',
// all rules
'kyt'
]
}
```

## Prettier Support

Expand All @@ -72,13 +78,13 @@ npx eslint . --fix

Or add to your `package.json`:

```
{
"scripts": {
"lint": "eslint .",
"lint-fix": "eslint . --fix"
}
```json
{
"scripts": {
"lint": "eslint .",
"lint-fix": "eslint . --fix"
}
}
```

To keep things formatted as you develop, install an editor package. See more [here](/docs/Recipes.md#editor-configuration).
Expand All @@ -87,20 +93,20 @@ To keep things formatted as you develop, install an editor package. See more [he

A `kyt` app should work with any editor, but we recommend that you install and configure ESLint with one of the following editors:

### VSCode
#### VSCode

1. go to View > Extensions
1. Install `ESLint`
1. Install `Prettier`
1. Go to `Code > Preferences`
1. Change the following preferences to `true`:

```
"prettier.eslintIntegration": true,
"editor.formatOnSave": true
```
```
"prettier.eslintIntegration": true,
"editor.formatOnSave": true
```

### Atom
#### Atom

1. Go to `Preferences > Install`
1. Install `linter`
Expand Down

0 comments on commit ff67872

Please sign in to comment.