Skip to content

Commit 78244fc

Browse files
authored
note __dirname as a way to define packageDir
fixes #1061
1 parent d3a58f8 commit 78244fc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/rules/no-extraneous-dependencies.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,14 @@ You can also use an array of globs instead of literal booleans:
2929

3030
When using an array of globs, the setting will be set to `true` (no errors reported) if the name of the file being linted matches a single glob in the array, and `false` otherwise.
3131

32-
Also there is one more option called `packageDir`, this option is to specify the path to the folder containing package.json and is relative to the current working directory.
32+
Also there is one more option called `packageDir`, this option is to specify the path to the folder containing package.json.
33+
34+
If provided as a relative path string, will be computed relative to the current working directory at linter execution time. If this is not ideal (does not work with some editor integrations), consider using `__dirname` to provide a path relative to your configuration.
3335

3436
```js
3537
"import/no-extraneous-dependencies": ["error", {"packageDir": './some-dir/'}]
38+
// or
39+
"import/no-extraneous-dependencies": ["error", {"packageDir": path.join(__dirname, 'some-dir')}]
3640
```
3741

3842
It may also be an array of multiple paths, to support monorepos or other novel project

0 commit comments

Comments
 (0)