From 1a3a12869651bec54d567af8dc0e7cb2a801d41f Mon Sep 17 00:00:00 2001 From: TheCrueltySage Date: Wed, 19 Feb 2020 17:39:15 +0700 Subject: [PATCH] [Fix] `first`: Add a way to disable `absolute-first` explicitly --- CHANGELOG.md | 3 +++ src/rules/first.js | 2 +- tests/src/rules/first.js | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 381a23ff1..e5e0fab9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel - [`order`]: recognize ".." as a "parent" path ([#1658], thanks [@golopot]) - [`no-duplicates`]: fix fixer on cases with default import ([#1666], thanks [@golopot]) - [`no-unused-modules`]: Handle `export { default } from` syntax ([#1631], thanks [@richardxia]) +- [`first`]: Add a way to disable `absolute-first` explicitly ([#1664], thanks [@TheCrueltySage]) ## [2.20.1] - 2020-02-01 ### Fixed @@ -658,6 +659,7 @@ for info on changes for earlier releases. [`memo-parser`]: ./memo-parser/README.md [#1666]: https://github.com/benmosher/eslint-plugin-import/pull/1666 +[#1664]: https://github.com/benmosher/eslint-plugin-import/pull/1664 [#1658]: https://github.com/benmosher/eslint-plugin-import/pull/1658 [#1651]: https://github.com/benmosher/eslint-plugin-import/pull/1651 [#1635]: https://github.com/benmosher/eslint-plugin-import/issues/1635 @@ -1116,3 +1118,4 @@ for info on changes for earlier releases. [@wschurman]: https://github.com/wschurman [@fisker]: https://github.com/fisker [@richardxia]: https://github.com/richardxia +[@TheCrueltySage]: https://github.com/TheCrueltySage diff --git a/src/rules/first.js b/src/rules/first.js index 393cadb1f..c1422cdb0 100644 --- a/src/rules/first.js +++ b/src/rules/first.js @@ -10,7 +10,7 @@ module.exports = { schema: [ { type: 'string', - enum: ['absolute-first'], + enum: ['absolute-first', 'disable-absolute-first'], }, ], }, diff --git a/tests/src/rules/first.js b/tests/src/rules/first.js index 55367cf43..8c5d72a34 100644 --- a/tests/src/rules/first.js +++ b/tests/src/rules/first.js @@ -11,6 +11,9 @@ ruleTester.run('first', rule, { export { x, y }" }) , test({ code: "import { x } from 'foo'; import { y } from './bar'" }) , test({ code: "import { x } from './foo'; import { y } from 'bar'" }) + , test({ code: "import { x } from './foo'; import { y } from 'bar'" + , options: ['disable-absolute-first'], + }) , test({ code: "'use directive';\ import { x } from 'foo';" }) ,