Skip to content

Commit be53beb

Browse files
authored
Merge branch 'main' into dynamic-import-chunkname-handle-magic-comments
2 parents ee3b85f + d8633c3 commit be53beb

File tree

75 files changed

+1341
-545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1341
-545
lines changed

.eslintrc

+20
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,16 @@
102102
"es6": false,
103103
},
104104
},
105+
{
106+
"files": "resolvers/webpack/**",
107+
"rules": {
108+
"import/no-extraneous-dependencies": 1,
109+
"no-console": 1,
110+
},
111+
"env": {
112+
"es6": true,
113+
},
114+
},
105115
{
106116
"files": [
107117
"resolvers/*/test/**/*",
@@ -127,5 +137,15 @@
127137
"no-console": 1,
128138
},
129139
},
140+
{
141+
"files": "tests/**",
142+
"env": {
143+
"mocha": true,
144+
},
145+
"rules": {
146+
"max-len": 0,
147+
"import/default": 0,
148+
},
149+
},
130150
],
131151
}

.github/workflows/node-4+.yml

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ jobs:
3434
- 3
3535
- 2
3636
include:
37+
- node-version: 'lts/*'
38+
eslint: 7
39+
ts-parser: 4
40+
env:
41+
TS_PARSER: 4
3742
- node-version: 'lts/*'
3843
eslint: 7
3944
ts-parser: 3

CHANGELOG.md

+44-1
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,39 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
66

77
## [Unreleased]
88

9+
### Added
10+
- [`no-named-default`, `no-default-export`, `prefer-default-export`, `no-named-export`, `export`, `named`, `namespace`, `no-unused-modules`]: support arbitrary module namespace names ([#2358], thanks [@sosukesuzuki])
11+
- [`no-dynamic-require`]: support dynamic import with espree ([#2371], thanks [@sosukesuzuki])
12+
- [`no-relative-packages`]: add fixer ([#2381], thanks [@forivall])
13+
14+
### Fixed
15+
- [`default`]: `typescript-eslint-parser`: avoid a crash on exporting as namespace (thanks [@ljharb])
16+
- [`export`]/TypeScript: false positive for typescript namespace merging ([#1964], thanks [@magarcia])
17+
- [`no-duplicates`]: ignore duplicate modules in different TypeScript module declarations ([#2378], thanks [@remcohaszing])
18+
- [`no-unused-modules`]: avoid a crash when processing re-exports ([#2388], thanks [@ljharb])
19+
20+
### Changed
21+
- [Tests] `no-nodejs-modules`: add tests for node protocol URL ([#2367], thanks [@sosukesuzuki])
22+
- [Tests] `default`, `no-anonymous-default-export`, `no-mutable-exports`, `no-named-as-default-member`, `no-named-as-default`: add tests for arbitrary module namespace names ([#2358], thanks [@sosukesuzuki])
23+
- [Docs] [`no-unresolved`]: Fix RegExp escaping in readme ([#2332], thanks [@stephtr])
24+
- [Refactor] `namespace`: try to improve performance ([#2340], thanks [@ljharb])
25+
- [Docs] make rule doc titles consistent ([#2393], thanks [@TheJaredWilcurt])
26+
- [Docs] `order`: TS code examples should use TS code blocks ([#2411], thanks [@MM25Zamanian])
27+
- [Docs] `no-unresolved`: fix link ([#2417], thanks [@kylemh])
28+
29+
## [2.25.4] - 2022-01-02
30+
931
### Fixed
1032
- `importType`: avoid crashing on a non-string' ([#2305], thanks [@ljharb])
1133
- [`first`]: prevent crash when parsing angular templates ([#2210], thanks [@ljharb])
1234
- `importType`: properly resolve `@/*`-aliased imports as internal ([#2334], thanks [@ombene])
35+
- [`named`]/`ExportMap`: handle named imports from CJS modules that use dynamic import ([#2341], thanks [@ludofischer])
1336
- [`dynamic-import-chunkname`]: prevent false report on a valid webpack magic comment ([#2330], thanks [@mhmadhamster])
1437

1538
### Changed
1639
- [`no-default-import`]: report on the token "default" instead of the entire node ([#2299], thanks [@pmcelhaney])
1740
- [Docs] [`order`]: Remove duplicate mention of default ([#2280], thanks [@johnthagen])
41+
- [Deps] update `eslint-module-utils`
1842

1943
## [2.25.3] - 2021-11-09
2044

@@ -953,6 +977,17 @@ for info on changes for earlier releases.
953977
[`memo-parser`]: ./memo-parser/README.md
954978

955979
[#2330]: https://github.com/import-js/eslint-plugin-import/pull/2330
980+
[#2417]: https://github.com/import-js/eslint-plugin-import/pull/2417
981+
[#2411]: https://github.com/import-js/eslint-plugin-import/pull/2411
982+
[#2393]: https://github.com/import-js/eslint-plugin-import/pull/2393
983+
[#2388]: https://github.com/import-js/eslint-plugin-import/pull/2388
984+
[#2381]: https://github.com/import-js/eslint-plugin-import/pull/2381
985+
[#2378]: https://github.com/import-js/eslint-plugin-import/pull/2378
986+
[#2371]: https://github.com/import-js/eslint-plugin-import/pull/2371
987+
[#2367]: https://github.com/import-js/eslint-plugin-import/pull/2367
988+
[#2332]: https://github.com/import-js/eslint-plugin-import/pull/2332
989+
[#2358]: https://github.com/import-js/eslint-plugin-import/pull/2358
990+
[#2341]: https://github.com/import-js/eslint-plugin-import/pull/2341
956991
[#2334]: https://github.com/import-js/eslint-plugin-import/pull/2334
957992
[#2305]: https://github.com/import-js/eslint-plugin-import/pull/2305
958993
[#2299]: https://github.com/import-js/eslint-plugin-import/pull/2299
@@ -1231,6 +1266,7 @@ for info on changes for earlier releases.
12311266
[#211]: https://github.com/import-js/eslint-plugin-import/pull/211
12321267
[#164]: https://github.com/import-js/eslint-plugin-import/pull/164
12331268
[#157]: https://github.com/import-js/eslint-plugin-import/pull/157
1269+
[#2340]: https://github.com/import-js/eslint-plugin-import/issues/2340
12341270
[#2255]: https://github.com/import-js/eslint-plugin-import/issues/2255
12351271
[#2210]: https://github.com/import-js/eslint-plugin-import/issues/2210
12361272
[#2201]: https://github.com/import-js/eslint-plugin-import/issues/2201
@@ -1344,7 +1380,8 @@ for info on changes for earlier releases.
13441380
[#119]: https://github.com/import-js/eslint-plugin-import/issues/119
13451381
[#89]: https://github.com/import-js/eslint-plugin-import/issues/89
13461382

1347-
[Unreleased]: https://github.com/import-js/eslint-plugin-import/compare/v2.25.3...HEAD
1383+
[Unreleased]: https://github.com/import-js/eslint-plugin-import/compare/v2.25.4...HEAD
1384+
[2.25.4]: https://github.com/import-js/eslint-plugin-import/compare/v2.25.3...v2.25.4
13481385
[2.25.3]: https://github.com/import-js/eslint-plugin-import/compare/v2.25.2...v2.25.3
13491386
[2.25.2]: https://github.com/import-js/eslint-plugin-import/compare/v2.25.1...v2.25.2
13501387
[2.25.1]: https://github.com/import-js/eslint-plugin-import/compare/v2.25.0...v2.25.1
@@ -1538,6 +1575,7 @@ for info on changes for earlier releases.
15381575
[@kmui2]: https://github.com/kmui2
15391576
[@knpwrs]: https://github.com/knpwrs
15401577
[@KostyaZgara]: https://github.com/KostyaZgara
1578+
[@kylemh]: https://github.com/kylemh
15411579
[@laysent]: https://github.com/laysent
15421580
[@le0nik]: https://github.com/le0nik
15431581
[@lemonmade]: https://github.com/lemonmade
@@ -1551,8 +1589,10 @@ for info on changes for earlier releases.
15511589
[@lo1tuma]: https://github.com/lo1tuma
15521590
[@loganfsmyth]: https://github.com/loganfsmyth
15531591
[@luczsoma]: https://github.com/luczsoma
1592+
[@ludofischer]: https://github.com/ludofischer
15541593
[@lukeapage]: https://github.com/lukeapage
15551594
[@lydell]: https://github.com/lydell
1595+
[@magarcia]: https://github.com/magarcia
15561596
[@Mairu]: https://github.com/Mairu
15571597
[@malykhinvi]: https://github.com/malykhinvi
15581598
[@manovotny]: https://github.com/manovotny
@@ -1614,9 +1654,11 @@ for info on changes for earlier releases.
16141654
[@skyrpex]: https://github.com/skyrpex
16151655
[@sompylasar]: https://github.com/sompylasar
16161656
[@soryy708]: https://github.com/soryy708
1657+
[@sosukesuzuki]: https://github.com/sosukesuzuki
16171658
[@spalger]: https://github.com/spalger
16181659
[@st-sloth]: https://github.com/st-sloth
16191660
[@stekycz]: https://github.com/stekycz
1661+
[@stephtr]: https://github.com/stephtr
16201662
[@straub]: https://github.com/straub
16211663
[@strawbrary]: https://github.com/strawbrary
16221664
[@stropho]: https://github.com/stropho
@@ -1629,6 +1671,7 @@ for info on changes for earlier releases.
16291671
[@Taranys]: https://github.com/Taranys
16301672
[@taye]: https://github.com/taye
16311673
[@TheCrueltySage]: https://github.com/TheCrueltySage
1674+
[@TheJaredWilcurt]: https://github.com/TheJaredWilcurt
16321675
[@tihonove]: https://github.com/tihonove
16331676
[@timkraut]: https://github.com/timkraut
16341677
[@tizmagik]: https://github.com/tizmagik

docs/rules/dynamic-import-chunkname.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# dynamic imports require a leading comment with a webpackChunkName (dynamic-import-chunkname)
1+
# import/dynamic-import-chunkname
22

33
This rule reports any dynamic imports without a webpackChunkName specified in a leading block comment in the proper format.
44

docs/rules/imports-first.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# imports-first
1+
# import/imports-first
22

33
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).

docs/rules/no-import-module-exports.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# no-import-module-exports
1+
# import/no-import-module-exports
22

33
Reports the use of import declarations with CommonJS exports in any module
44
except for the [main module](https://docs.npmjs.com/files/package.json#main).

docs/rules/no-relative-packages.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Use this rule to prevent importing packages through relative paths.
55
It's useful in Yarn/Lerna workspaces, were it's possible to import a sibling
66
package using `../package` relative path, while direct `package` is the correct one.
77

8+
+(fixable) The `--fix` option on the [command line] automatically fixes problems reported by this rule.
89

910
### Examples
1011

docs/rules/no-unresolved.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ This rule has its own ignore list, separate from [`import/ignore`]. This is beca
6060
To suppress errors from files that may not be properly resolved by your [resolver settings](../../README.md#resolver-plugins), you may add an `ignore` key with an array of `RegExp` pattern strings:
6161

6262
```js
63-
/*eslint import/no-unresolved: [2, { ignore: ['\.img$'] }]*/
63+
/*eslint import/no-unresolved: [2, { ignore: ['\\.img$'] }]*/
6464

6565
import { x } from './mod' // may be reported, if not resolved to a module
6666

@@ -98,7 +98,7 @@ If you're using a module bundler other than Node or Webpack, you may end up with
9898

9999
## Further Reading
100100

101-
- [Resolver plugins](../../README.md#resolver-plugins)
101+
- [Resolver plugins](../../README.md#resolvers)
102102
- [Node resolver](https://npmjs.com/package/eslint-import-resolver-node) (default)
103103
- [Webpack resolver](https://npmjs.com/package/eslint-import-resolver-webpack)
104104
- [`import/ignore`] global setting

docs/rules/order.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Enforce a convention in the order of `require()` / `import` statements.
55

66
With the [`groups`](#groups-array) option set to `["builtin", "external", "internal", "parent", "sibling", "index", "object", "type"]` the order is as shown in the following example:
77

8-
```js
8+
```ts
99
// 1. node "builtin" modules
1010
import fs from 'fs';
1111
import path from 'path';
@@ -36,7 +36,7 @@ Statements using the ES6 `import` syntax must appear before any `require()` stat
3636

3737
## Fail
3838

39-
```js
39+
```ts
4040
import _ from 'lodash';
4141
import path from 'path'; // `path` import should occur before import of `lodash`
4242

@@ -54,7 +54,7 @@ import foo from './foo'; // `import` statements must be before `require` stateme
5454

5555
## Pass
5656

57-
```js
57+
```ts
5858
import path from 'path';
5959
import _ from 'lodash';
6060

@@ -85,7 +85,7 @@ This rule supports the following options:
8585
How groups are defined, and the order to respect. `groups` must be an array of `string` or [`string`]. The only allowed `string`s are:
8686
`"builtin"`, `"external"`, `"internal"`, `"unknown"`, `"parent"`, `"sibling"`, `"index"`, `"object"`, `"type"`.
8787
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:
88-
```js
88+
```ts
8989
[
9090
'builtin', // Built-in types are first
9191
['sibling', 'parent'], // Then sibling and parent types. They can be mingled together
@@ -98,7 +98,7 @@ The default value is `["builtin", "external", "parent", "sibling", "index"]`.
9898

9999
You can set the options like this:
100100

101-
```js
101+
```ts
102102
"import/order": ["error", {"groups": ["index", "sibling", "parent", "internal", "external", "builtin", "object", "type"]}]
103103
```
104104

@@ -184,15 +184,15 @@ The default value is `"ignore"`.
184184

185185
With the default group setting, the following will be invalid:
186186

187-
```js
187+
```ts
188188
/* eslint import/order: ["error", {"newlines-between": "always"}] */
189189
import fs from 'fs';
190190
import path from 'path';
191191
import index from './';
192192
import sibling from './foo';
193193
```
194194

195-
```js
195+
```ts
196196
/* eslint import/order: ["error", {"newlines-between": "always-and-inside-groups"}] */
197197
import fs from 'fs';
198198

@@ -201,7 +201,7 @@ import index from './';
201201
import sibling from './foo';
202202
```
203203

204-
```js
204+
```ts
205205
/* eslint import/order: ["error", {"newlines-between": "never"}] */
206206
import fs from 'fs';
207207
import path from 'path';
@@ -213,7 +213,7 @@ import sibling from './foo';
213213

214214
while those will be valid:
215215

216-
```js
216+
```ts
217217
/* eslint import/order: ["error", {"newlines-between": "always"}] */
218218
import fs from 'fs';
219219
import path from 'path';
@@ -223,7 +223,7 @@ import index from './';
223223
import sibling from './foo';
224224
```
225225

226-
```js
226+
```ts
227227
/* eslint import/order: ["error", {"newlines-between": "always-and-inside-groups"}] */
228228
import fs from 'fs';
229229

@@ -234,7 +234,7 @@ import index from './';
234234
import sibling from './foo';
235235
```
236236

237-
```js
237+
```ts
238238
/* eslint import/order: ["error", {"newlines-between": "never"}] */
239239
import fs from 'fs';
240240
import path from 'path';
@@ -250,7 +250,7 @@ Sort the order within each group in alphabetical manner based on **import path**
250250
- `caseInsensitive`: use `true` to ignore case, and `false` to consider case (default: `false`).
251251

252252
Example setting:
253-
```js
253+
```ts
254254
alphabetize: {
255255
order: 'asc', /* sort in ascending order. Options: ['ignore', 'asc', 'desc'] */
256256
caseInsensitive: true /* ignore case. Options: [true, false] */
@@ -259,7 +259,7 @@ alphabetize: {
259259

260260
This will fail the rule check:
261261

262-
```js
262+
```ts
263263
/* eslint import/order: ["error", {"alphabetize": {"order": "asc", "caseInsensitive": true}}] */
264264
import React, { PureComponent } from 'react';
265265
import aTypes from 'prop-types';
@@ -270,7 +270,7 @@ import blist from 'BList';
270270

271271
While this will pass:
272272

273-
```js
273+
```ts
274274
/* eslint import/order: ["error", {"alphabetize": {"order": "asc", "caseInsensitive": true}}] */
275275
import blist from 'BList';
276276
import * as classnames from 'classnames';
@@ -290,7 +290,7 @@ way that is safe.
290290

291291
This will fail the rule check:
292292

293-
```js
293+
```ts
294294
/* eslint import/order: ["error", {"warnOnUnassignedImports": true}] */
295295
import fs from 'fs';
296296
import './styles.css';
@@ -299,7 +299,7 @@ import path from 'path';
299299

300300
While this will pass:
301301

302-
```js
302+
```ts
303303
/* eslint import/order: ["error", {"warnOnUnassignedImports": true}] */
304304
import fs from 'fs';
305305
import path from 'path';

memo-parser/.eslintrc.yml

-3
This file was deleted.

0 commit comments

Comments
 (0)