-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- removed frontend related code from config
- updated readme, less steps and fixed install peerdependency script
- Loading branch information
Showing
5 changed files
with
3,893 additions
and
11,748 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,24 @@ | ||
# eslint-config | ||
# @bedandbreakfasteu/eslint-config | ||
|
||
The ESLint configuration for Bedandbreakfast.eu | ||
|
||
## Usage | ||
|
||
1. Setup your project to use `@bedandbreakfasteu/prettier-config` by [following this README](https://github.com/bedandbreakfasteu/prettier-config#readme). | ||
|
||
2. Make sure `@bedandbreakfasteu/eslint-config` is available in your project. | ||
|
||
3. Add an `.eslintrc.js` file at the root of your project that extends this config: | ||
|
||
```js | ||
module.exports = { | ||
extends: '@bedandbreakfasteu/eslint-config', | ||
}; | ||
``` | ||
|
||
4. Install the required dependencies into your project using: | ||
1. Install this package along with our [prettier-config](https://github.com/bedandbreakfasteu/prettier-config) using: | ||
|
||
```bash | ||
( | ||
export PKG=@bedandbreakfasteu/eslint-config; | ||
npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev | ||
) | ||
yarn add --dev @bedandbreakfasteu/eslint-config@bedandbreakfasteu/eslint-config#2.0.0 @bedandbreakfasteu/prettier-config@bedandbreakfasteu/prettier-config#1.0.1 | ||
``` | ||
|
||
This copies the peerDependencies of this project as devDependencies into yours. | ||
|
||
On Windows this should work using [Git for Windows](https://gitforwindows.org/). | ||
|
||
5. To run ESLint as a pre-commit hook and automatically fix issues add [husky](https://github.com/typicode/husky) and [lint-staged](https://github.com/okonet/lint-staged) using: | ||
2. Install the required devDependencies using: | ||
|
||
```bash | ||
npm install husky lint-staged --save-dev | ||
curl -o - https://raw.githubusercontent.com/bedandbreakfasteu/eslint-config/main/package.json \ | ||
| jq '{ "peerDependencies" }.peerDependencies' \ | ||
| command sed 's/[\{\},]//g ; s/: /@/g' \ | ||
| xargs yarn add --dev | ||
``` | ||
|
||
Then copy the following to your `package.json`: | ||
|
||
```json | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.{js,jsx,ts,tsx}": [ | ||
"eslint --fix", | ||
"git add" | ||
] | ||
} | ||
``` | ||
3. Add `"extends": "@bedandbreakfasteu/eslint-config"` to your `.eslintrc` | ||
|
||
That's it, happy coding! | ||
That's it, happy coding! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.