Skip to content

Commit

Permalink
Use new @hapi/eslint-plugin with embedded config (#990)
Browse files Browse the repository at this point in the history
  • Loading branch information
kanongil authored Sep 16, 2020
1 parent 31c319d commit f7f55c7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,11 @@ As stated at the beginning of the document, `--ignore` parameter is an alias for

## Linting

**lab** uses a shareable [eslint](http://eslint.org/) config, and a plugin containing several **hapi** specific linting rules. If you want to extend the default linter you must:
**lab** uses a shareable [eslint](http://eslint.org/) plugin containing a recommended config and several **hapi** specific linting rules. If you want to extend the default linter you must:

1. Add `@hapi/eslint-plugin-hapi` and `@hapi/eslint-config-hapi` as dependencies in your `package.json`. You must add both the plugin and the config because eslint treats them as peer dependencies. For more background, see [eslint/eslint#3458](https://github.com/eslint/eslint/issues/3458) and [eslint/eslint#2518](https://github.com/eslint/eslint/issues/2518).
1. Add `@hapi/eslint-plugin` as a dependency in your `package.json`.

2. In your project's eslint configuration, add `"extends": "@hapi/eslint-config-hapi"`.
2. In your project's eslint configuration, add `"extends": "plugin:@hapi/recommended"`.

Your project's eslint configuration will now extend the default **lab** configuration.

Expand Down
2 changes: 1 addition & 1 deletion lib/linter/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module.exports = {
parser: 'babel-eslint',
extends: require.resolve('@hapi/eslint-config-hapi'),
extends: 'plugin:@hapi/recommended',
parserOptions: {
loc: true,
comment: true,
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
],
"dependencies": {
"@hapi/bossy": "5.x.x",
"@hapi/eslint-config-hapi": "13.x.x",
"@hapi/eslint-plugin-hapi": "4.x.x",
"@hapi/eslint-plugin": "5.x.x",
"@hapi/hoek": "9.x.x",
"babel-eslint": "10.x.x",
"diff": "4.x.x",
Expand Down

0 comments on commit f7f55c7

Please sign in to comment.