You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A regex for packages should be treated as internal. Useful when you are utilizing a monorepo setup or developing a set of packages that depend on each other.
408
+
409
+
By default, any package referenced from [`import/external-module-folders`](#importexternal-module-folders) will be considered as "external", including packages in a monorepo like yarn workspace or lerna emvironentment. If you want to mark these packages as "internal" this will be useful.
410
+
411
+
For example, if you pacakges in a monorepo are all in `@scope`, you can configure `import/internal-regex` like this
Copy file name to clipboardExpand all lines: docs/rules/no-duplicates.md
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,31 @@ The motivation is that this is likely a result of two developers importing diffe
36
36
names from the same module at different times (and potentially largely different
37
37
locations in the file.) This rule brings both (or n-many) to attention.
38
38
39
+
### Query Strings
40
+
41
+
By default, this rule ignores query strings (i.e. paths followed by a question mark), and thus imports from `./mod?a` and `./mod?b` will be considered as duplicates. However you can use the option `considerQueryString` to handle them as different (primarily because browsers will resolve those imports differently).
It will still catch duplicates when using the same module and the exact same query string:
57
+
```js
58
+
importSomeDefaultClassfrom'./mod?minify'
59
+
60
+
// This is invalid, assuming `./mod` and `./mod.js` are the same target:
61
+
import*from'./mod.js?minify'
62
+
```
63
+
39
64
## When Not To Use It
40
65
41
66
If the core ESLint version is good enough (i.e. you're _not_ using Flow and you _are_ using [`import/extensions`](./extensions.md)), keep it and don't use this.
Copy file name to clipboardExpand all lines: docs/rules/no-useless-path-segments.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,3 +73,7 @@ import "./pages/index.js"; // should be "./pages" (auto-fixable)
73
73
```
74
74
75
75
Note: `noUselessIndex` only avoids ambiguous imports for `.js` files if you haven't specified other resolved file extensions. See [Settings: import/extensions](https://github.com/benmosher/eslint-plugin-import#importextensions) for details.
76
+
77
+
### commonjs
78
+
79
+
When set to `true`, this rule checks CommonJS imports. Default to `false`.
| group | x | string | one of the allowed groups, the pathGroup will be positioned relative to this group |
108
+
| position || string | defines where around the group the pathGroup will be positioned, can be 'after' or 'before', if not provided pathGroup will be positioned like the group |
0 commit comments