Skip to content

Commit 9070f17

Browse files
committed
chore: update documentation for eslint ignore
1 parent ca641a9 commit 9070f17

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

API.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -632,10 +632,17 @@ Your project's eslint configuration will now extend the default **lab** configur
632632

633633
### Ignoring files in linting
634634

635-
Since [eslint](http://eslint.org/) is used to lint, you can create an `.eslintignore` containing paths to be ignored:
636-
```
637-
node_modules/*
638-
**/vendor/*.js
635+
Since [eslint](http://eslint.org/) is used to lint, if you don't already have an `eslint.config.{js|cjs|mjs|ts|mts|cts}` you can create one,
636+
and add an `ignores` rule containing paths to be ignored. Here is an example preserving default hapi rules:
637+
```javascript
638+
import HapiPlugin from '@hapi/eslint-plugin';
639+
640+
export default [
641+
{
642+
ignores: ['node_modules/*', '**/vendor/*.js'],
643+
},
644+
...HapiPlugin.configs.module,
645+
];
639646
```
640647

641648
### Only run linting

lib/linter/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ exports.lint = async function () {
2121

2222
if (!Fs.existsSync('eslint.config.js') &&
2323
!Fs.existsSync('eslint.config.cjs') &&
24-
!Fs.existsSync('eslint.config.mjs')) {
24+
!Fs.existsSync('eslint.config.mjs') &&
25+
!Fs.existsSync('eslint.config.ts') &&
26+
!Fs.existsSync('eslint.config.mts') &&
27+
!Fs.existsSync('eslint.config.cts')) {
2528
// No configuration file found, using the default one
2629
usingDefault = true;
2730
configuration.baseConfig = require('./.eslintrc.js');

0 commit comments

Comments
 (0)