Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2021-07-27 16:54:26 +00:00
parent 6b0d45a5c6
commit cc1adb825a
4247 changed files with 144820 additions and 149530 deletions

View file

@ -39,12 +39,6 @@ import(
'someModule',
);
// using single quotes instead of double quotes
import(
/* webpackChunkName: 'someModule' */
'someModule',
);
// invalid syntax for webpack comment
import(
/* totally not webpackChunkName: "someModule" */
@ -78,6 +72,12 @@ The following patterns are valid:
/* webpackChunkName: "someModule", webpackPrefetch: true */
'someModule',
);
// using single quotes instead of double quotes
import(
/* webpackChunkName: 'someModule' */
'someModule',
);
```
## When Not To Use It

View file

@ -1,7 +1,7 @@
# import/no-extraneous-dependencies: Forbid the use of extraneous packages
Forbid the import of external modules that are not declared in the `package.json`'s `dependencies`, `devDependencies`, `optionalDependencies`, `peerDependencies`, or `bundledDependencies`.
The closest parent `package.json` will be used. If no `package.json` is found, the rule will not lint anything. This behaviour can be changed with the rule option `packageDir`.
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`.
Modules have to be installed for this rule to work.
@ -13,7 +13,7 @@ This rule supports the following options:
`optionalDependencies`: If set to `false`, then the rule will show an error when `optionalDependencies` are imported. Defaults to `true`.
`peerDependencies`: If set to `false`, then the rule will show an error when `peerDependencies` are imported. Defaults to `false`.
`peerDependencies`: If set to `false`, then the rule will show an error when `peerDependencies` are imported. Defaults to `true`.
`bundledDependencies`: If set to `false`, then the rule will show an error when `bundledDependencies` are imported. Defaults to `true`.

View file

@ -0,0 +1,74 @@
# no-import-module-exports
Reports the use of import declarations with CommonJS exports in any module
except for the [main module](https://docs.npmjs.com/files/package.json#main).
If you have multiple entry points or are using `js:next` this rule includes an
`exceptions` option which you can use to exclude those files from the rule.
## Options
#### `exceptions`
- An array of globs. The rule will be omitted from any file that matches a glob
in the options array. For example, the following setting will omit the rule
in the `some-file.js` file.
```json
"import/no-import-module-exports": ["error", {
"exceptions": ["**/*/some-file.js"]
}]
```
## Rule Details
### Fail
```js
import { stuff } from 'starwars'
module.exports = thing
import * as allThings from 'starwars'
exports.bar = thing
import thing from 'other-thing'
exports.foo = bar
import thing from 'starwars'
const baz = module.exports = thing
console.log(baz)
```
### Pass
Given the following package.json:
```json
{
"main": "lib/index.js",
}
```
```js
import thing from 'other-thing'
export default thing
const thing = require('thing')
module.exports = thing
const thing = require('thing')
exports.foo = bar
import thing from 'otherthing'
console.log(thing.module.exports)
// in lib/index.js
import foo from 'path';
module.exports = foo;
// in some-file.js
// eslint import/no-import-module-exports: ["error", {"exceptions": ["**/*/some-file.js"]}]
import foo from 'path';
module.exports = foo;
```
### Further Reading
- [webpack issue #4039](https://github.com/webpack/webpack/issues/4039)

View file

@ -4,7 +4,10 @@ Use this rule to prevent importing the submodules of other modules.
## Rule Details
This rule has one option, `allow` which is an array of [minimatch/glob patterns](https://github.com/isaacs/node-glob#glob-primer) patterns that whitelist paths and import statements that can be imported with reaching.
This rule has two mutally exclusive options that are arrays of [minimatch/glob patterns](https://github.com/isaacs/node-glob#glob-primer) patterns:
- `allow` that include paths and import statements that can be imported with reaching.
- `forbid` that exclude paths and import statements that can be imported with reaching.
### Examples
@ -33,7 +36,7 @@ And the .eslintrc file:
...
"rules": {
"import/no-internal-modules": [ "error", {
"allow": [ "**/actions/*", "source-map-support/*" ]
"allow": [ "**/actions/*", "source-map-support/*" ],
} ]
}
}
@ -68,3 +71,62 @@ import getUser from '../actions/getUser';
export * from 'source-map-support/register';
export { settings } from '../app';
```
Given the following folder structure:
```
my-project
├── actions
│ └── getUser.js
│ └── updateUser.js
├── reducer
│ └── index.js
│ └── user.js
├── redux
│ └── index.js
│ └── configureStore.js
└── app
│ └── index.js
│ └── settings.js
└── entry.js
```
And the .eslintrc file:
```
{
...
"rules": {
"import/no-internal-modules": [ "error", {
"forbid": [ "**/actions/*", "source-map-support/*" ],
} ]
}
}
```
The following patterns are considered problems:
```js
/**
* in my-project/entry.js
*/
import 'source-map-support/register';
import getUser from '../actions/getUser';
export * from 'source-map-support/register';
export getUser from '../actions/getUser';
```
The following patterns are NOT considered problems:
```js
/**
* in my-project/entry.js
*/
import 'source-map-support';
import { getUser } from '../actions';
export * from 'source-map-support';
export { getUser } from '../actions';
```

View file

@ -31,7 +31,7 @@ For post-ES2015 `export` extensions, this also prevents exporting the default fr
```js
// valid:
export foo from './foo.js'
export foo from './foo.js';
// message: Using exported name 'bar' as identifier for default export.
export bar from './foo.js';

View file

@ -4,6 +4,10 @@ Reports use of a default export as a locally named import.
Rationale: the syntax exists to import default exports expressively, let's use it.
Note that type imports, as used by [Flow], are always ignored.
[Flow]: https://flow.org/
## Rule Details
Given:

View file

@ -0,0 +1,66 @@
# import/no-relative-packages
Use this rule to prevent importing packages through relative paths.
It's useful in Yarn/Lerna workspaces, were it's possible to import a sibling
package using `../package` relative path, while direct `package` is the correct one.
### Examples
Given the following folder structure:
```
my-project
├── packages
│ ├── foo
│ │ ├── index.js
│ │ └── package.json
│ └── bar
│ ├── index.js
│ └── package.json
└── entry.js
```
And the .eslintrc file:
```
{
...
"rules": {
"import/no-relative-packages": "error"
}
}
```
The following patterns are considered problems:
```js
/**
* in my-project/packages/foo.js
*/
import bar from '../bar'; // Import sibling package using relative path
import entry from '../../entry.js'; // Import from parent package using relative path
/**
* in my-project/entry.js
*/
import bar from './packages/bar'; // Import child package using relative path
```
The following patterns are NOT considered problems:
```js
/**
* in my-project/packages/foo.js
*/
import bar from 'bar'; // Import sibling package using package name
/**
* in my-project/entry.js
*/
import bar from 'bar'; // Import sibling package using package name
```

View file

@ -12,7 +12,7 @@ Note: dynamic imports are currently not supported.
In order for this plugin to work, one of the options `missingExports` or `unusedExports` must be enabled (see "Options" section below). In the future, these options will be enabled by default (see https://github.com/benmosher/eslint-plugin-import/issues/1324)
Example:
Example:
```
"rules: {
...otherRules,
@ -27,13 +27,13 @@ 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)
- `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
#### The following will be reported
```js
const class MyClass { /*...*/ }
const class MyClass { /*...*/ }
function makeClass() { return new MyClass(...arguments) }
```
@ -41,10 +41,10 @@ function makeClass() { return new MyClass(...arguments) }
#### The following will not be reported
```js
export default function () { /*...*/ }
export default function () { /*...*/ }
```
```js
export const foo = function () { /*...*/ }
export const foo = function () { /*...*/ }
```
```js
export { foo, bar }
@ -61,7 +61,7 @@ import { f } from 'file-b'
import * as fileC from 'file-c'
export { default, i0 } from 'file-d' // both will be reported
export const j = 99 // will be reported
export const j = 99 // will be reported
```
and file-d:
```js

View file

@ -2,7 +2,8 @@
Enforce a convention in the order of `require()` / `import` statements.
+(fixable) The `--fix` option on the [command line] automatically fixes problems reported by this rule.
The order is as shown in the following example:
With the [`groups`](#groups-array) option set to `["builtin", "external", "internal", "parent", "sibling", "index", "object"]` the order is as shown in the following example:
```js
// 1. node "builtin" modules
@ -24,6 +25,8 @@ import baz from './bar/baz';
import main from './';
// 7. "object"-imports (only available in TypeScript)
import log = console.log;
// 8. "type" imports (only available in Flow and TypeScript)
import type { Foo } from 'foo';
```
Unassigned imports are ignored, as the order they are imported in may be important.
@ -80,7 +83,7 @@ This rule supports the following options:
### `groups: [array]`:
How groups are defined, and the order to respect. `groups` must be an array of `string` or [`string`]. The only allowed `string`s are:
`"builtin"`, `"external"`, `"internal"`, `"unknown"`, `"parent"`, `"sibling"`, `"index"`, `"object"`.
`"builtin"`, `"external"`, `"internal"`, `"unknown"`, `"parent"`, `"sibling"`, `"index"`, `"object"`, `"type"`.
The enforced order is the same as the order of each element in a group. Omitted types are implicitly grouped together as the last element. Example:
```js
[
@ -96,7 +99,7 @@ The default value is `["builtin", "external", "parent", "sibling", "index"]`.
You can set the options like this:
```js
"import/order": ["error", {"groups": ["index", "sibling", "parent", "internal", "external", "builtin", "object"]}]
"import/order": ["error", {"groups": ["index", "sibling", "parent", "internal", "external", "builtin", "object", "type"]}]
```
### `pathGroups: [array of objects]`:
@ -253,6 +256,33 @@ import React, { PureComponent } from 'react';
import { compose, apply } from 'xcompose';
```
### `warnOnUnassignedImports: true|false`:
* default: `false`
Warns when unassigned imports are out of order. These warning will not be fixed
with `--fix` because unassigned imports are used for side-effects and changing the
import of order of modules with side effects can not be done automatically in a
way that is safe.
This will fail the rule check:
```js
/* eslint import/order: ["error", {"warnOnUnassignedImports": true}] */
import fs from 'fs';
import './styles.css';
import path from 'path';
```
While this will pass:
```js
/* eslint import/order: ["error", {"warnOnUnassignedImports": true}] */
import fs from 'fs';
import path from 'path';
import './styles.css';
```
## Related
- [`import/external-module-folders`] setting