Skip to content

Commit

Permalink
Merge branch 'main' into dynamic-import-chunkname-handle-magic-comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MhMadHamster committed Apr 1, 2022
2 parents ee3b85f + d8633c3 commit be53beb
Show file tree
Hide file tree
Showing 75 changed files with 1,341 additions and 545 deletions.
20 changes: 20 additions & 0 deletions .eslintrc
Expand Up @@ -102,6 +102,16 @@
"es6": false,
},
},
{
"files": "resolvers/webpack/**",
"rules": {
"import/no-extraneous-dependencies": 1,
"no-console": 1,
},
"env": {
"es6": true,
},
},
{
"files": [
"resolvers/*/test/**/*",
Expand All @@ -127,5 +137,15 @@
"no-console": 1,
},
},
{
"files": "tests/**",
"env": {
"mocha": true,
},
"rules": {
"max-len": 0,
"import/default": 0,
},
},
],
}
5 changes: 5 additions & 0 deletions .github/workflows/node-4+.yml
Expand Up @@ -34,6 +34,11 @@ jobs:
- 3
- 2
include:
- node-version: 'lts/*'
eslint: 7
ts-parser: 4
env:
TS_PARSER: 4
- node-version: 'lts/*'
eslint: 7
ts-parser: 3
Expand Down
45 changes: 44 additions & 1 deletion CHANGELOG.md
Expand Up @@ -6,15 +6,39 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange

## [Unreleased]

### Added
- [`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])
- [`no-dynamic-require`]: support dynamic import with espree ([#2371], thanks [@sosukesuzuki])
- [`no-relative-packages`]: add fixer ([#2381], thanks [@forivall])

### Fixed
- [`default`]: `typescript-eslint-parser`: avoid a crash on exporting as namespace (thanks [@ljharb])
- [`export`]/TypeScript: false positive for typescript namespace merging ([#1964], thanks [@magarcia])
- [`no-duplicates`]: ignore duplicate modules in different TypeScript module declarations ([#2378], thanks [@remcohaszing])
- [`no-unused-modules`]: avoid a crash when processing re-exports ([#2388], thanks [@ljharb])

### Changed
- [Tests] `no-nodejs-modules`: add tests for node protocol URL ([#2367], thanks [@sosukesuzuki])
- [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])
- [Docs] [`no-unresolved`]: Fix RegExp escaping in readme ([#2332], thanks [@stephtr])
- [Refactor] `namespace`: try to improve performance ([#2340], thanks [@ljharb])
- [Docs] make rule doc titles consistent ([#2393], thanks [@TheJaredWilcurt])
- [Docs] `order`: TS code examples should use TS code blocks ([#2411], thanks [@MM25Zamanian])
- [Docs] `no-unresolved`: fix link ([#2417], thanks [@kylemh])

## [2.25.4] - 2022-01-02

### Fixed
- `importType`: avoid crashing on a non-string' ([#2305], thanks [@ljharb])
- [`first`]: prevent crash when parsing angular templates ([#2210], thanks [@ljharb])
- `importType`: properly resolve `@/*`-aliased imports as internal ([#2334], thanks [@ombene])
- [`named`]/`ExportMap`: handle named imports from CJS modules that use dynamic import ([#2341], thanks [@ludofischer])
- [`dynamic-import-chunkname`]: prevent false report on a valid webpack magic comment ([#2330], thanks [@mhmadhamster])

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

## [2.25.3] - 2021-11-09

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

[#2330]: https://github.com/import-js/eslint-plugin-import/pull/2330
[#2417]: https://github.com/import-js/eslint-plugin-import/pull/2417
[#2411]: https://github.com/import-js/eslint-plugin-import/pull/2411
[#2393]: https://github.com/import-js/eslint-plugin-import/pull/2393
[#2388]: https://github.com/import-js/eslint-plugin-import/pull/2388
[#2381]: https://github.com/import-js/eslint-plugin-import/pull/2381
[#2378]: https://github.com/import-js/eslint-plugin-import/pull/2378
[#2371]: https://github.com/import-js/eslint-plugin-import/pull/2371
[#2367]: https://github.com/import-js/eslint-plugin-import/pull/2367
[#2332]: https://github.com/import-js/eslint-plugin-import/pull/2332
[#2358]: https://github.com/import-js/eslint-plugin-import/pull/2358
[#2341]: https://github.com/import-js/eslint-plugin-import/pull/2341
[#2334]: https://github.com/import-js/eslint-plugin-import/pull/2334
[#2305]: https://github.com/import-js/eslint-plugin-import/pull/2305
[#2299]: https://github.com/import-js/eslint-plugin-import/pull/2299
Expand Down Expand Up @@ -1231,6 +1266,7 @@ for info on changes for earlier releases.
[#211]: https://github.com/import-js/eslint-plugin-import/pull/211
[#164]: https://github.com/import-js/eslint-plugin-import/pull/164
[#157]: https://github.com/import-js/eslint-plugin-import/pull/157
[#2340]: https://github.com/import-js/eslint-plugin-import/issues/2340
[#2255]: https://github.com/import-js/eslint-plugin-import/issues/2255
[#2210]: https://github.com/import-js/eslint-plugin-import/issues/2210
[#2201]: https://github.com/import-js/eslint-plugin-import/issues/2201
Expand Down Expand Up @@ -1344,7 +1380,8 @@ for info on changes for earlier releases.
[#119]: https://github.com/import-js/eslint-plugin-import/issues/119
[#89]: https://github.com/import-js/eslint-plugin-import/issues/89

[Unreleased]: https://github.com/import-js/eslint-plugin-import/compare/v2.25.3...HEAD
[Unreleased]: https://github.com/import-js/eslint-plugin-import/compare/v2.25.4...HEAD
[2.25.4]: https://github.com/import-js/eslint-plugin-import/compare/v2.25.3...v2.25.4
[2.25.3]: https://github.com/import-js/eslint-plugin-import/compare/v2.25.2...v2.25.3
[2.25.2]: https://github.com/import-js/eslint-plugin-import/compare/v2.25.1...v2.25.2
[2.25.1]: https://github.com/import-js/eslint-plugin-import/compare/v2.25.0...v2.25.1
Expand Down Expand Up @@ -1538,6 +1575,7 @@ for info on changes for earlier releases.
[@kmui2]: https://github.com/kmui2
[@knpwrs]: https://github.com/knpwrs
[@KostyaZgara]: https://github.com/KostyaZgara
[@kylemh]: https://github.com/kylemh
[@laysent]: https://github.com/laysent
[@le0nik]: https://github.com/le0nik
[@lemonmade]: https://github.com/lemonmade
Expand All @@ -1551,8 +1589,10 @@ for info on changes for earlier releases.
[@lo1tuma]: https://github.com/lo1tuma
[@loganfsmyth]: https://github.com/loganfsmyth
[@luczsoma]: https://github.com/luczsoma
[@ludofischer]: https://github.com/ludofischer
[@lukeapage]: https://github.com/lukeapage
[@lydell]: https://github.com/lydell
[@magarcia]: https://github.com/magarcia
[@Mairu]: https://github.com/Mairu
[@malykhinvi]: https://github.com/malykhinvi
[@manovotny]: https://github.com/manovotny
Expand Down Expand Up @@ -1614,9 +1654,11 @@ for info on changes for earlier releases.
[@skyrpex]: https://github.com/skyrpex
[@sompylasar]: https://github.com/sompylasar
[@soryy708]: https://github.com/soryy708
[@sosukesuzuki]: https://github.com/sosukesuzuki
[@spalger]: https://github.com/spalger
[@st-sloth]: https://github.com/st-sloth
[@stekycz]: https://github.com/stekycz
[@stephtr]: https://github.com/stephtr
[@straub]: https://github.com/straub
[@strawbrary]: https://github.com/strawbrary
[@stropho]: https://github.com/stropho
Expand All @@ -1629,6 +1671,7 @@ for info on changes for earlier releases.
[@Taranys]: https://github.com/Taranys
[@taye]: https://github.com/taye
[@TheCrueltySage]: https://github.com/TheCrueltySage
[@TheJaredWilcurt]: https://github.com/TheJaredWilcurt
[@tihonove]: https://github.com/tihonove
[@timkraut]: https://github.com/timkraut
[@tizmagik]: https://github.com/tizmagik
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/dynamic-import-chunkname.md
@@ -1,4 +1,4 @@
# dynamic imports require a leading comment with a webpackChunkName (dynamic-import-chunkname)
# import/dynamic-import-chunkname

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

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/imports-first.md
@@ -1,3 +1,3 @@
# imports-first
# import/imports-first

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).
2 changes: 1 addition & 1 deletion docs/rules/no-import-module-exports.md
@@ -1,4 +1,4 @@
# no-import-module-exports
# import/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).
Expand Down
1 change: 1 addition & 0 deletions docs/rules/no-relative-packages.md
Expand Up @@ -5,6 +5,7 @@ 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.

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

### Examples

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-unresolved.md
Expand Up @@ -60,7 +60,7 @@ This rule has its own ignore list, separate from [`import/ignore`]. This is beca
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:

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

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

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

## Further Reading

- [Resolver plugins](../../README.md#resolver-plugins)
- [Resolver plugins](../../README.md#resolvers)
- [Node resolver](https://npmjs.com/package/eslint-import-resolver-node) (default)
- [Webpack resolver](https://npmjs.com/package/eslint-import-resolver-webpack)
- [`import/ignore`] global setting
Expand Down
32 changes: 16 additions & 16 deletions docs/rules/order.md
Expand Up @@ -5,7 +5,7 @@ Enforce a convention in the order of `require()` / `import` statements.

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:

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

## Fail

```js
```ts
import _ from 'lodash';
import path from 'path'; // `path` import should occur before import of `lodash`

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

## Pass

```js
```ts
import path from 'path';
import _ from 'lodash';

Expand Down Expand Up @@ -85,7 +85,7 @@ This rule supports the following options:
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"`, `"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
```ts
[
'builtin', // Built-in types are first
['sibling', 'parent'], // Then sibling and parent types. They can be mingled together
Expand All @@ -98,7 +98,7 @@ The default value is `["builtin", "external", "parent", "sibling", "index"]`.

You can set the options like this:

```js
```ts
"import/order": ["error", {"groups": ["index", "sibling", "parent", "internal", "external", "builtin", "object", "type"]}]
```

Expand Down Expand Up @@ -184,15 +184,15 @@ The default value is `"ignore"`.

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

```js
```ts
/* eslint import/order: ["error", {"newlines-between": "always"}] */
import fs from 'fs';
import path from 'path';
import index from './';
import sibling from './foo';
```

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

Expand All @@ -201,7 +201,7 @@ import index from './';
import sibling from './foo';
```

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

while those will be valid:

```js
```ts
/* eslint import/order: ["error", {"newlines-between": "always"}] */
import fs from 'fs';
import path from 'path';
Expand All @@ -223,7 +223,7 @@ import index from './';
import sibling from './foo';
```

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

Expand All @@ -234,7 +234,7 @@ import index from './';
import sibling from './foo';
```

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

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

This will fail the rule check:

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

While this will pass:

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

This will fail the rule check:

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

While this will pass:

```js
```ts
/* eslint import/order: ["error", {"warnOnUnassignedImports": true}] */
import fs from 'fs';
import path from 'path';
Expand Down
3 changes: 0 additions & 3 deletions memo-parser/.eslintrc.yml

This file was deleted.

0 comments on commit be53beb

Please sign in to comment.