Skip to content

Commit

Permalink
chore: update documentation for eslint ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
Marsup committed Oct 22, 2024
1 parent ca641a9 commit 9070f17
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
15 changes: 11 additions & 4 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,17 @@ Your project's eslint configuration will now extend the default **lab** configur

### Ignoring files in linting

Since [eslint](http://eslint.org/) is used to lint, you can create an `.eslintignore` containing paths to be ignored:
```
node_modules/*
**/vendor/*.js
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,
and add an `ignores` rule containing paths to be ignored. Here is an example preserving default hapi rules:
```javascript
import HapiPlugin from '@hapi/eslint-plugin';

export default [
{
ignores: ['node_modules/*', '**/vendor/*.js'],
},
...HapiPlugin.configs.module,
];
```

### Only run linting
Expand Down
5 changes: 4 additions & 1 deletion lib/linter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ exports.lint = async function () {

if (!Fs.existsSync('eslint.config.js') &&
!Fs.existsSync('eslint.config.cjs') &&
!Fs.existsSync('eslint.config.mjs')) {
!Fs.existsSync('eslint.config.mjs') &&
!Fs.existsSync('eslint.config.ts') &&
!Fs.existsSync('eslint.config.mts') &&
!Fs.existsSync('eslint.config.cts')) {
// No configuration file found, using the default one
usingDefault = true;
configuration.baseConfig = require('./.eslintrc.js');
Expand Down

0 comments on commit 9070f17

Please sign in to comment.