Update checked-in dependencies

This commit is contained in:
github-actions[bot]
2024-09-30 17:13:32 +00:00
parent 3fe5410805
commit 931cd264c2
72 changed files with 2295 additions and 1569 deletions

View File

@@ -1,5 +1,7 @@
# import/dynamic-import-chunkname
💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).
<!-- end auto-generated rule header -->
This rule reports any dynamic imports without a webpackChunkName specified in a leading block comment in the proper format.
@@ -15,7 +17,8 @@ You can also configure the regex format you'd like to accept for the webpackChun
{
"dynamic-import-chunkname": [2, {
importFunctions: ["dynamicImport"],
webpackChunknameFormat: "[a-zA-Z0-57-9-/_]+"
webpackChunknameFormat: "[a-zA-Z0-57-9-/_]+",
allowEmpty: false
}]
}
```
@@ -55,6 +58,13 @@ import(
// webpackChunkName: "someModule"
'someModule',
);
// chunk names are disallowed when eager mode is set
import(
/* webpackMode: "eager" */
/* webpackChunkName: "someModule" */
'someModule',
)
```
### valid
@@ -87,6 +97,38 @@ The following patterns are valid:
);
```
### `allowEmpty: true`
If you want to allow dynamic imports without a webpackChunkName, you can set `allowEmpty: true` in the rule config. This will allow dynamic imports without a leading comment, or with a leading comment that does not contain a webpackChunkName.
Given `{ "allowEmpty": true }`:
<!-- markdownlint-disable-next-line MD024 -- duplicate header -->
### valid
The following patterns are valid:
```javascript
import('someModule');
import(
/* webpackChunkName: "someModule" */
'someModule',
);
```
<!-- markdownlint-disable-next-line MD024 -- duplicate header -->
### invalid
The following patterns are invalid:
```javascript
// incorrectly formatted comment
import(
/*webpackChunkName:"someModule"*/
'someModule',
);
```
## When Not To Use It
If you don't care that webpack will autogenerate chunk names and may blow up browser caches and bundle size reports.

View File

@@ -1,6 +1,6 @@
# import/no-empty-named-blocks
🔧💡 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).
🔧💡 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/latest/use/core-concepts#rule-suggestions).
<!-- end auto-generated rule header -->

View File

@@ -32,7 +32,7 @@ You can also use an array of globs instead of literal booleans:
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.js", "**/*.spec.js"]}]
```
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.
When using an array of globs, the setting will be set to `true` (no errors reported) if the name of the file being linted (i.e. not the imported file/module) matches a single glob in the array, and `false` otherwise.
There are 2 boolean options to opt into checking extra imports that are normally ignored: `includeInternal`, which enables the checking of internal modules, and `includeTypes`, which enables checking of type imports in TypeScript.

View File

@@ -29,8 +29,9 @@ This rule takes the following option:
- **`missingExports`**: if `true`, files without any exports are reported (defaults to `false`)
- **`unusedExports`**: if `true`, exports without any static usage within other modules are reported (defaults to `false`)
- `src`: an array with files/paths to be analyzed. It only applies to unused exports. Defaults to `process.cwd()`, if not provided
- `ignoreExports`: an array with files/paths for which unused exports will not be reported (e.g module entry points in a published package)
- **`ignoreUnusedTypeExports`**: if `true`, TypeScript type exports without any static usage within other modules are reported (defaults to `false` and has no effect unless `unusedExports` is `true`)
- **`src`**: an array with files/paths to be analyzed. It only applies to unused exports. Defaults to `process.cwd()`, if not provided
- **`ignoreExports`**: an array with files/paths for which unused exports will not be reported (e.g module entry points in a published package)
### Example for missing exports
@@ -116,6 +117,16 @@ export function doAnything() {
export default 5 // will not be reported
```
### Unused exports with `ignoreUnusedTypeExports` set to `true`
The following will not be reported:
```ts
export type Foo = {}; // will not be reported
export interface Foo = {}; // will not be reported
export enum Foo {}; // will not be reported
```
#### Important Note
Exports from files listed as a main file (`main`, `browser`, or `bin` fields in `package.json`) will be ignored by default. This only applies if the `package.json` is not set to `private: true`

View File

@@ -77,6 +77,25 @@ import foo from './foo';
var path = require('path');
```
## Limitations of `--fix`
Unbound imports are assumed to have side effects, and will never be moved/reordered. This can cause other imports to get "stuck" around them, and the fix to fail.
```javascript
import b from 'b'
import 'format.css'; // This will prevent --fix from working.
import a from 'a'
```
As a workaround, move unbound imports to be entirely above or below bound ones.
```javascript
import 'format1.css'; // OK
import b from 'b'
import a from 'a'
import 'format2.css'; // OK
```
## Options
This rule supports the following options:
@@ -174,7 +193,7 @@ Example:
### `pathGroupsExcludedImportTypes: [array]`
This defines import types that are not handled by configured pathGroups.
This is mostly needed when you want to handle path groups that look like external imports.
If you have added path groups with patterns that look like `"builtin"` or `"external"` imports, you have to remove this group (`"builtin"` and/or `"external"`) from the default exclusion list (e.g., `["builtin", "external", "object"]`, etc) to sort these path groups correctly.
Example:
@@ -193,29 +212,7 @@ Example:
}
```
You can also use `patterns`(e.g., `react`, `react-router-dom`, etc).
Example:
```json
{
"import/order": [
"error",
{
"pathGroups": [
{
"pattern": "react",
"group": "builtin",
"position": "before"
}
],
"pathGroupsExcludedImportTypes": ["react"]
}
]
}
```
The default value is `["builtin", "external", "object"]`.
[Import Type](https://github.com/import-js/eslint-plugin-import/blob/HEAD/src/core/importType.js#L90) is resolved as a fixed string in predefined set, it can't be a `patterns`(e.g., `react`, `react-router-dom`, etc). See [#2156] for details.
### `newlines-between: [ignore|always|always-and-inside-groups|never]`