Skip to content

Release 2.25.3 #2298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 37 additions & 10 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,31 @@
"ecmaVersion": 2020,
},
"rules": {
"comma-dangle": [2, "always-multiline"],
"comma-dangle": ["error", {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "always-multiline",
}],
"comma-style": [2, "last"],
"curly": [2, "multi-line"],
"eol-last": [2, "always"],
"eqeqeq": [2, "allow-null"],
"func-call-spacing": 2,
"indent": [2, 2],
"keyword-spacing": ["error", {
before: true,
after: true,
overrides: {
return: { after: true },
throw: { after: true },
case: { after: true }
"before": true,
"after": true,
"overrides": {
"return": { "after": true },
"throw": { "after": true },
"case": { "after": true }
}
}],
"max-len": [1, 99, 2],
"max-len": 0,
"no-cond-assign": [2, "always"],
"no-return-assign": [2, "always"],
"no-shadow": 1,
"no-var": 2,
"object-curly-spacing": [2, "always"],
"object-shorthand": ["error", "always", {
Expand Down Expand Up @@ -91,6 +96,12 @@
"no-console": "off",
},
},
{
"files": "resolvers/**",
"env": {
"es6": false,
},
},
{
"files": [
"resolvers/*/test/**/*",
Expand All @@ -99,6 +110,22 @@
"mocha": true,
"es6": false
},
}
},
{
"files": "utils/**",
"parserOptions": {
"ecmaVersion": 6,
},
"rules": {
"comma-dangle": ["error", {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "never"
}],
"no-console": 1,
},
},
],
}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ lib-cov
# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Compiled binary addons (http://nodejs.org/api/addons.html)
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Copied from ./LICENSE for the npm module releases
Expand Down
31 changes: 28 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
# Change Log

All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
This change log adheres to standards from [Keep a CHANGELOG](http://keepachangelog.com).
This project adheres to [Semantic Versioning](https://semver.org/).
This change log adheres to standards from [Keep a CHANGELOG](https://keepachangelog.com).

## [Unreleased]

## [2.25.3] - 2021-11-09

### Fixed
- [`extensions`]: ignore unresolveable type-only imports ([#2270], [#2271], [@jablko])
- `importType`: fix `isExternalModule` calculation ([#2282], [@mx-bernhard])
- [`no-import-module-exports`]: avoid false positives with a shadowed `module` or `exports` ([#2297], [@ljharb])

### Changed
- [Docs] [`order`]: add type to the default groups ([#2272], [@charpeni])
- [readme] Add note to TypeScript docs to install appropriate resolver ([#2279], [@johnthagen])
- [Refactor] `importType`: combine redundant `isScoped` and `isScopedModule` ([@ljharb])
- [Docs] HTTP => HTTPS ([#2287], [@Schweinepriester])

## [2.25.2] - 2021-10-12

### Fixed
Expand Down Expand Up @@ -929,6 +942,13 @@ for info on changes for earlier releases.

[`memo-parser`]: ./memo-parser/README.md

[#2297]: https://github.com/import-js/eslint-plugin-import/pull/2297
[#2287]: https://github.com/import-js/eslint-plugin-import/pull/2287
[#2282]: https://github.com/import-js/eslint-plugin-import/pull/2282
[#2279]: https://github.com/import-js/eslint-plugin-import/pull/2279
[#2272]: https://github.com/import-js/eslint-plugin-import/pull/2272
[#2271]: https://github.com/import-js/eslint-plugin-import/pull/2271
[#2270]: https://github.com/import-js/eslint-plugin-import/pull/2270
[#2240]: https://github.com/import-js/eslint-plugin-import/pull/2240
[#2233]: https://github.com/import-js/eslint-plugin-import/pull/2233
[#2226]: https://github.com/import-js/eslint-plugin-import/pull/2226
Expand Down Expand Up @@ -1308,7 +1328,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.2...HEAD
[Unreleased]: https://github.com/import-js/eslint-plugin-import/compare/v2.25.3...HEAD
[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
[2.25.0]: https://github.com/import-js/eslint-plugin-import/compare/v2.24.2...v2.25.0
Expand Down Expand Up @@ -1425,6 +1446,7 @@ for info on changes for earlier releases.
[@brendo]: https://github.com/brendo
[@brettz9]: https://github.com/brettz9
[@charlessuh]: https://github.com/charlessuh
[@charpeni]: https://github.com/charpeni
[@cherryblossom000]: https://github.com/cherryblossom000
[@chrislloyd]: https://github.com/chrislloyd
[@christianvuerings]: https://github.com/christianvuerings
Expand Down Expand Up @@ -1482,6 +1504,7 @@ for info on changes for earlier releases.
[@jkimbo]: https://github.com/jkimbo
[@joaovieira]: https://github.com/joaovieira
[@johndevedu]: https://github.com/johndevedu
[@johnthagen]: https://github.com/johnthagen
[@jonboiser]: https://github.com/jonboiser
[@josh]: https://github.com/josh
[@JounQin]: https://github.com/JounQin
Expand Down Expand Up @@ -1530,6 +1553,7 @@ for info on changes for earlier releases.
[@MikeyBeLike]: https://github.com/MikeyBeLike
[@mplewis]: https://github.com/mplewis
[@mrmckeb]: https://github.com/mrmckeb
[@mx-bernhard]: https://github.com/mx-bernhard
[@nickofthyme]: https://github.com/nickofthyme
[@nicolashenry]: https://github.com/nicolashenry
[@noelebrun]: https://github.com/noelebrun
Expand Down Expand Up @@ -1559,6 +1583,7 @@ for info on changes for earlier releases.
[@saschanaz]: https://github.com/saschanaz
[@schmidsi]: https://github.com/schmidsi
[@schmod]: https://github.com/schmod
[@Schweinepriester]: https://github.com/Schweinepriester
[@scottnonnenberg]: https://github.com/scottnonnenberg
[@sergei-startsev]: https://github.com/sergei-startsev
[@sharmilajesupaul]: https://github.com/sharmilajesupaul
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ If we can all get together behind the common goal of embracing empathy, everythi

#### Attribution

Thanks for help from http://mozillascience.github.io/working-open-workshop/contributing/
Thanks for help from https://mozillascience.github.io/working-open-workshop/contributing/
for inspiration before I wrote this. --ben

[README.md]: ./README.md
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![coverage][codecov-image]][codecov-url]
[![win32 build status](https://ci.appveyor.com/api/projects/status/3mw2fifalmjlqf56/branch/main?svg=true)](https://ci.appveyor.com/project/import-js/eslint-plugin-import/branch/main)
[![npm](https://img.shields.io/npm/v/eslint-plugin-import.svg)](https://www.npmjs.com/package/eslint-plugin-import)
[![npm downloads](https://img.shields.io/npm/dt/eslint-plugin-import.svg?maxAge=2592000)](http://www.npmtrends.com/eslint-plugin-import)
[![npm downloads](https://img.shields.io/npm/dt/eslint-plugin-import.svg?maxAge=2592000)](https://www.npmtrends.com/eslint-plugin-import)

This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import names. All the goodness that the ES2015+ static module syntax intends to provide, marked up in your editor.

Expand Down Expand Up @@ -174,6 +174,9 @@ extends:

[`@typescript-eslint/parser`]: https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser

You will also need to install and configure the TypeScript resolver:
[`eslint-import-resolver-typescript`](https://github.com/alexgorbatchev/eslint-import-resolver-typescript).

# Resolvers

With the advent of module bundlers and the current state of modules and module
Expand Down Expand Up @@ -253,7 +256,7 @@ the process's current working directory if no `package.json` is found.
If you are interesting in writing a resolver, see the [spec](./resolvers/README.md) for more details.

[`resolve`]: https://www.npmjs.com/package/resolve
[`externals`]: http://webpack.github.io/docs/library-and-externals.html
[`externals`]: https://webpack.github.io/docs/library-and-externals.html

[Node]: https://www.npmjs.com/package/eslint-import-resolver-node
[webpack]: https://www.npmjs.com/package/eslint-import-resolver-webpack
Expand Down Expand Up @@ -480,7 +483,7 @@ The purpose of the `chdir` setting, in this case, is to set the working director
from which ESLint is executed to be the same as the directory on which SublimeLinter-eslint
bases the relative path it provides.

See the SublimeLinter docs on [`chdir`](http://www.sublimelinter.com/en/latest/linter_settings.html#chdir)
See the SublimeLinter docs on [`chdir`](https://www.sublimelinter.com/en/latest/linter_settings.html#chdir)
for more information, in case this does not work with your project.

If you are not using `.eslintignore`, or don't have a Sublime project file, you can also
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/first.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ A directive in this case is assumed to be a single statement that contains only
a literal string-valued expression.

`'use strict'` would be a good example, except that [modules are always in strict
mode](http://www.ecma-international.org/ecma-262/6.0/#sec-strict-mode-code) so it would be surprising to see a `'use strict'` sharing a file with `import`s and
mode](https://262.ecma-international.org/6.0/#sec-strict-mode-code) so it would be surprising to see a `'use strict'` sharing a file with `import`s and
`export`s.

Given that, see [#255] for the reasoning.
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-duplicates.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Reports if a resolved path is imported more than once.
+(fixable) The `--fix` option on the [command line] automatically fixes some problems reported by this rule.

ESLint core has a similar rule ([`no-duplicate-imports`](http://eslint.org/docs/rules/no-duplicate-imports)), but this version
ESLint core has a similar rule ([`no-duplicate-imports`](https://eslint.org/docs/rules/no-duplicate-imports)), but this version
is different in two key ways:

1. the paths in the source code don't have to exactly match, they just have to point to the same module on the filesystem. (i.e. `./foo` and `./foo.js`)
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-mutable-exports.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ want to enable the following core ESLint rules:
- [no-func-assign]
- [no-class-assign]

[no-func-assign]: http://eslint.org/docs/rules/no-func-assign
[no-class-assign]: http://eslint.org/docs/rules/no-class-assign
[no-func-assign]: https://eslint.org/docs/rules/no-func-assign
[no-class-assign]: https://eslint.org/docs/rules/no-class-assign

## When Not To Use It

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/order.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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.

With the [`groups`](#groups-array) option set to `["builtin", "external", "internal", "parent", "sibling", "index", "object"]` the order is as shown in the following example:
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
// 1. node "builtin" modules
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/unambiguous.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ a `module`.
- [`parserOptions.sourceType`]
- [node-eps#13](https://github.com/nodejs/node-eps/issues/13)

[`parserOptions.sourceType`]: http://eslint.org/docs/user-guide/configuring#specifying-parser-options
[`parserOptions.sourceType`]: https://eslint.org/docs/user-guide/configuring#specifying-parser-options
[Unambiguous JavaScript Grammar]: https://github.com/nodejs/node-eps/blob/HEAD/002-es-modules.md#32-determining-if-source-is-an-es-module
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-import",
"version": "2.25.2",
"version": "2.25.3",
"description": "Import with sanity.",
"engines": {
"node": ">=4"
Expand Down Expand Up @@ -103,9 +103,9 @@
"debug": "^2.6.9",
"doctrine": "^2.1.0",
"eslint-import-resolver-node": "^0.3.6",
"eslint-module-utils": "^2.7.0",
"eslint-module-utils": "^2.7.1",
"has": "^1.0.3",
"is-core-module": "^2.7.0",
"is-core-module": "^2.8.0",
"is-glob": "^4.0.3",
"minimatch": "^3.0.4",
"object.values": "^1.1.5",
Expand Down
3 changes: 0 additions & 3 deletions resolvers/.eslintrc.yml

This file was deleted.

4 changes: 2 additions & 2 deletions resolvers/node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Change Log
All notable changes to this resolver will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
This change log adheres to standards from [Keep a CHANGELOG](http://keepachangelog.com).
This project adheres to [Semantic Versioning](https://semver.org/).
This change log adheres to standards from [Keep a CHANGELOG](https://keepachangelog.com).

## Unreleased

Expand Down
4 changes: 2 additions & 2 deletions resolvers/webpack/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Change Log
All notable changes to this resolver will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
This change log adheres to standards from [Keep a CHANGELOG](http://keepachangelog.com).
This project adheres to [Semantic Versioning](https://semver.org/).
This change log adheres to standards from [Keep a CHANGELOG](https://keepachangelog.com).

## Unreleased

Expand Down
2 changes: 1 addition & 1 deletion resolvers/webpack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function createWebpack2ResolveSync(webpackRequire, resolveConfig) {
}

/**
* webpack 1 defaults: http://webpack.github.io/docs/configuration.html#resolve-packagemains
* webpack 1 defaults: https://webpack.github.io/docs/configuration.html#resolve-packagemains
* @type {Array}
*/
const webpack1DefaultMains = [
Expand Down
4 changes: 2 additions & 2 deletions resolvers/webpack/test/alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('resolve.alias', function () {

// todo: reimplement with resolver function / config
// describe.skip('webpack alias spec', function () {
// // from table: http://webpack.github.io/docs/configuration.html#resolve-alias
// // from table: https://webpack.github.io/docs/configuration.html#resolve-alias
// function tableLine(alias, xyz, xyzFile) {
// describe(JSON.stringify(alias), function () {
// it('xyz: ' + xyz, function () {
Expand Down Expand Up @@ -82,7 +82,7 @@ describe('resolve.alias', function () {
// });

// describe.skip('nested module names', function () {
// // from table: http://webpack.github.io/docs/configuration.html#resolve-alias
// // from table: https://webpack.github.io/docs/configuration.html#resolve-alias
// function nestedName(alias, xyz, xyzFile) {
// describe(JSON.stringify(alias), function () {
// it('top/xyz: ' + xyz, function () {
Expand Down
3 changes: 0 additions & 3 deletions src/.eslintrc.yml

This file was deleted.

6 changes: 1 addition & 5 deletions src/core/importType.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function isExternalModule(name, settings, path, context) {
if (arguments.length < 4) {
throw new TypeError('isExternalModule: name, settings, path, and context are all required');
}
return isModule(name) && isExternalPath(name, settings, path, getContextPackagePath(context));
return (isModule(name) || isScoped(name)) && isExternalPath(name, settings, path, getContextPackagePath(context));
}

export function isExternalModuleMain(name, settings, path, context) {
Expand Down Expand Up @@ -101,10 +101,6 @@ function typeTest(name, context, path) {
return 'unknown';
}

export function isScopedModule(name) {
return name.indexOf('@') === 0 && !name.startsWith('@/');
}

export default function resolveImportType(name, context) {
return typeTest(name, context, resolve(name, context));
}
2 changes: 1 addition & 1 deletion src/rules/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
function checkDefault(specifierType, node) {

const defaultSpecifier = node.specifiers.find(
specifier => specifier.type === specifierType
specifier => specifier.type === specifierType,
);

if (!defaultSpecifier) return;
Expand Down
6 changes: 3 additions & 3 deletions src/rules/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ module.exports = {
'ExportSpecifier': (node) => addNamed(
node.exported.name,
node.exported,
getParent(node.parent)
getParent(node.parent),
),

'ExportNamedDeclaration': function (node) {
Expand Down Expand Up @@ -146,7 +146,7 @@ module.exports = {
if (!any) {
context.report(
node.source,
`No named exports found in module '${node.source.value}'.`
`No named exports found in module '${node.source.value}'.`,
);
}
},
Expand All @@ -164,7 +164,7 @@ module.exports = {
} else {
context.report(
node,
`Multiple exports of name '${name.replace(tsTypePrefix, '')}'.`
`Multiple exports of name '${name.replace(tsTypePrefix, '')}'.`,
);
}
}
Expand Down
Loading