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
Copy file name to clipboardexpand all lines: CONTRIBUTING.md
+9-9
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,12 @@ Thanks for your interest in helping out! Here are a **few** _weird_ tricks to ~~
5
5
## TL;DR: Checklist
6
6
7
7
When opening an [issue](#issues):
8
+
8
9
-[ ] search open/closed issues
9
10
-[ ] discuss bug/enhancement in new or old issue
10
11
11
12
[PR](#prs) time:
13
+
12
14
-[ ] write tests
13
15
-[ ] implement feature/fix bug
14
16
-[ ] update docs
@@ -18,13 +20,13 @@ Remember, you don't need to do it all yourself; any of these are helpful! 😎
18
20
19
21
## Issues
20
22
21
-
### Search open + closed issues for similar cases.
23
+
### Search open + closed issues for similar cases
22
24
23
25
You may find an open issue that closely matches what you are thinking. You may also find a closed issue with discussion that either solves your problem or explains why we are unlikely to solve it in the near future.
24
26
25
27
If you find a matching issue that is open, and marked `accepted` and/or `help wanted`, you might want to [open a PR](#prs).
26
28
27
-
### Open an issue.
29
+
### Open an issue
28
30
29
31
Let's discuss your issue. Could be as simple as unclear documentation or a wonky config file.
30
32
If you're suggesting a feature, it might exist and need better documentation, or it might be in process. Even given those, some discussion might be warranted to ensure the enhancement is clear.
@@ -48,21 +50,19 @@ Here are some things to keep in mind when working on a PR:
48
50
If a PR is open, but unfortunately the author is, for any reason, not available to apply code review fixes or rebase the source branch, then please **do not open a new PR**.
49
51
Instead, paste a link to your own branch in the PR, and the maintainers can pull in your changes and update the existing PR in-place.
50
52
51
-
####Tests
53
+
### Tests
52
54
53
55
A PR that is just failing test cases for an existing issue is very helpful, as this can take as much time (if not more) as it takes to implement a new feature or fix a bug.
54
56
55
57
If you only have enough time to write tests, fantastic! Submit away. This is a great jumping-off point for a core contributor or even another PR to continue what you've started.
56
58
57
-
#### Docs
58
-
59
-
For enhancements to rules, please update the docs in `docs/rules` matching the rule filename from `src/rules`.
59
+
### Docs
60
60
61
-
Also, take a quick look at the rule summary in [README.md] in case it could use tweaking, or add a line if you've implemented a new rule.
61
+
For enhancements to rules, please update the docs in `docs/rules` matching the rule filename from `src/rules` or the rule description in `meta.docs.description`. Running `npm run update:eslint-docs` will update the [README.md] and rule doc header.
62
62
63
63
Bugfixes may not warrant docs changes, though it's worth skimming the existing docs to see if there are any relevant caveats that need to be removed.
64
64
65
-
####Changelog
65
+
### Changelog
66
66
67
67
Please add a quick blurb to the [**Unreleased**](./CHANGELOG.md#unreleased) section of the change log. Give yourself some credit, and please link back to the PR for future reference. This is especially helpful for resolver changes, as the resolvers are less frequently modified and published.
68
68
@@ -72,4 +72,4 @@ Note also that the change log can't magically link back to Github entities (i.e.
72
72
73
73
Please familiarize yourself with the [Code of Conduct](https://github.com/import-js/.github/blob/main/CODE_OF_CONDUCT.md).
Copy file name to clipboardexpand all lines: docs/rules/consistent-type-specifier-style.md
+4
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
# import/consistent-type-specifier-style
2
2
3
+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
4
+
5
+
<!-- end auto-generated rule header -->
6
+
3
7
In both Flow and TypeScript you can mark an import as a type-only import by adding a "kind" marker to the import. Both languages support two positions for marker.
4
8
5
9
**At the top-level** which marks all names in the import as type-only and applies to named, default, and namespace (for TypeScript) specifiers:
Copy file name to clipboardexpand all lines: docs/rules/dynamic-import-chunkname.md
+2
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# import/dynamic-import-chunkname
2
2
3
+
<!-- end auto-generated rule header -->
4
+
3
5
This rule reports any dynamic imports without a webpackChunkName specified in a leading block comment in the proper format.
4
6
5
7
This rule enforces naming of webpack chunks in dynamic imports. When you don't explicitly name chunks, webpack will autogenerate chunk names that are not consistent across builds, which prevents long-term browser caching.
Copy file name to clipboardexpand all lines: docs/rules/exports-last.md
+2
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# import/exports-last
2
2
3
+
<!-- end auto-generated rule header -->
4
+
3
5
This rule enforces that all exports are declared at the bottom of the file. This rule will report any export declarations that comes before any non-export statements.
Copy file name to clipboardexpand all lines: docs/rules/extensions.md
+5-2
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,6 @@
1
-
# import/extensions - Ensure consistent use of file extension within the import path
1
+
# import/extensions
2
+
3
+
<!-- end auto-generated rule header -->
2
4
3
5
Some file resolve algorithms allow you to omit the file extension within the import source path. For example the `node` resolver can resolve `./foo/bar` to the absolute path `/User/someone/foo/bar.js` because the `.js` extension is resolved automatically by default. Depending on the resolver you can configure more extensions to get resolved automatically.
4
6
@@ -37,6 +39,7 @@ By providing both a string and an object, the string will set the default settin
37
39
For example, `["error", "never", { "svg": "always" }]` would require that all extensions are omitted, except for "svg".
38
40
39
41
`ignorePackages` can be set as a separate boolean option like this:
42
+
40
43
```
41
44
"import/extensions": [
42
45
<severity>,
@@ -49,10 +52,10 @@ For example, `["error", "never", { "svg": "always" }]` would require that all ex
49
52
}
50
53
]
51
54
```
55
+
52
56
In that case, if you still want to specify extensions, you can do so inside the **pattern** property.
53
57
Default value of `ignorePackages` is `false`.
54
58
55
-
56
59
### Exception
57
60
58
61
When disallowing the use of certain extensions this rule makes an exception and allows the use of extension when the file would not be resolvable without extension.
Copy file name to clipboardexpand all lines: docs/rules/group-exports.md
+2
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# import/group-exports
2
2
3
+
<!-- end auto-generated rule header -->
4
+
3
5
Reports when named exports are not grouped together in a single `export` declaration or when multiple assignments to CommonJS `module.exports` or `exports` object are present in a single file.
4
6
5
7
**Rationale:** An `export` declaration or `module.exports` assignment can appear anywhere in the code. By requiring a single export declaration all your exports will remain at one place, making it easier to see what exports a module provides.
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
6
+
7
+
<!-- end auto-generated rule header -->
8
+
3
9
This rule was **deprecated** in eslint-plugin-import v2.0.0. Please use the corresponding rule [`first`](https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/first.md).
Copy file name to clipboardexpand all lines: docs/rules/max-dependencies.md
+2
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# import/max-dependencies
2
2
3
+
<!-- end auto-generated rule header -->
4
+
3
5
Forbid modules to have too many dependencies (`import` or `require` statements).
4
6
5
7
This is a useful rule because a module with too many dependencies is a code smell, and usually indicates the module is doing too much and/or should be broken up into smaller modules.
Copy file name to clipboardexpand all lines: docs/rules/namespace.md
+4
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
# import/namespace
2
2
3
+
💼 This rule is enabled in the following configs: ❗ `errors`, ☑️ `recommended`.
4
+
5
+
<!-- end auto-generated rule header -->
6
+
3
7
Enforces names exist at the time they are dereferenced, when imported as a full namespace (i.e. `import * as foo from './foo'; foo.bar();` will report if `bar` is not exported by `./foo`.).
4
8
5
9
Will report at the import declaration if there are _no_ exported names found.
Copy file name to clipboardexpand all lines: docs/rules/no-absolute-path.md
+5-1
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,11 @@
1
-
# import/no-absolute-path: Forbid import of modules using absolute paths
1
+
# import/no-absolute-path
2
+
3
+
<!-- end auto-generated rule header -->
2
4
3
5
Node.js allows the import of modules using an absolute path such as `/home/xyz/file.js`. That is a bad practice as it ties the code using it to your computer, and therefore makes it unusable in packages distributed on `npm` for instance.
4
6
7
+
This rule forbids the import of modules using absolute paths.
Copy file name to clipboardexpand all lines: docs/rules/no-anonymous-default-export.md
+2
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# import/no-anonymous-default-export
2
2
3
+
<!-- end auto-generated rule header -->
4
+
3
5
Reports if a module's default export is unnamed. This includes several types of unnamed data types; literals, object expressions, arrays, anonymous functions, arrow functions, and anonymous class declarations.
4
6
5
7
Ensuring that default exports are named helps improve the grepability of the codebase by encouraging the re-use of the same identifier for the module's default export at its declaration site and at its import sites.
Copy file name to clipboardexpand all lines: docs/rules/no-dynamic-require.md
+4-2
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,10 @@
1
-
# import/no-dynamic-require: Forbid `require()` calls with expressions
1
+
# import/no-dynamic-require
2
+
3
+
<!-- end auto-generated rule header -->
2
4
3
5
The `require` method from CommonJS is used to import modules from different files. Unlike the ES6 `import` syntax, it can be given expressions that will be resolved at runtime. While this is sometimes necessary and useful, in most cases it isn't. Using expressions (for instance, concatenating a path and variable) as the argument makes it harder for tools to do static code analysis, or to find where in the codebase a module is used.
4
6
5
-
This rule checks every call to `require()` that uses expressions for the module name argument.
7
+
This rule forbids every call to `require()` that uses expressions for the module name argument.
Copy file name to clipboardexpand all lines: docs/rules/no-empty-named-blocks.md
+4
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
# import/no-empty-named-blocks
2
2
3
+
🔧💡 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) and manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
Copy file name to clipboardexpand all lines: docs/rules/no-extraneous-dependencies.md
+3-1
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,6 @@
1
-
# import/no-extraneous-dependencies: Forbid the use of extraneous packages
1
+
# import/no-extraneous-dependencies
2
+
3
+
<!-- end auto-generated rule header -->
2
4
3
5
Forbid the import of external modules that are not declared in the `package.json`'s `dependencies`, `devDependencies`, `optionalDependencies`, `peerDependencies`, or `bundledDependencies`.
4
6
The closest parent `package.json` will be used. If no `package.json` is found, the rule will not lint anything. This behavior can be changed with the rule option `packageDir`. Normally ignores imports of modules marked internal, but this can be changed with the rule option `includeInternal`. Type imports can be verified by specifying `includeTypes`.
Copy file name to clipboardexpand all lines: docs/rules/no-namespace.md
+4
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
# import/no-namespace
2
2
3
+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
4
+
5
+
<!-- end auto-generated rule header -->
6
+
3
7
Enforce a convention of not using namespace (a.k.a. "wildcard" `*`) imports.
4
8
5
9
+(fixable) The `--fix` option on the [command line] automatically fixes problems reported by this rule, provided that the namespace object is only used for direct member access, e.g. `namespace.a`.
0 commit comments