Skip to content

Commit 513bb0b

Browse files
committedAug 13, 2021
[meta] fix some formatting
1 parent ec825d0 commit 513bb0b

File tree

2 files changed

+430
-190
lines changed

2 files changed

+430
-190
lines changed
 

‎CHANGELOG.md

+64-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
66

77
## [Unreleased]
88

9-
### Fixe
9+
### Fixed
1010
- `ExportMap`: Add default export when esModuleInterop is true and anything is exported ([#2184], thanks [@Maxim-Mazurok])
1111

1212
## [2.24.0] - 2021-08-08
@@ -97,6 +97,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
9797
- [Docs] Add import/recommended ruleset to README ([#2034], thanks [@edemaine])
9898

9999
## [2.22.1] - 2020-09-27
100+
100101
### Fixed
101102
- [`default`]/TypeScript: avoid crash on `export =` with a MemberExpression ([#1841], thanks [@ljharb])
102103
- [`extensions`]/importType: Fix @/abc being treated as scoped module ([#1854], thanks [@3nuc])
@@ -107,6 +108,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
107108
- [`export`]: add tests for a name collision with `export * from` ([#1704], thanks @tomprats)
108109

109110
## [2.22.0] - 2020-06-26
111+
110112
### Added
111113
- [`no-unused-modules`]: consider exported TypeScript interfaces, types and enums ([#1819], thanks [@nicolashenry])
112114
- [`no-cycle`]: allow `maxDepth` option to be `"∞"` (thanks [@ljharb])
@@ -127,16 +129,19 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
127129
- [docs] [`imports-first`]: deprecation info and link to `first` docs ([#1835], thanks [@beatrizrezener])
128130

129131
## [2.21.2] - 2020-06-09
132+
130133
### Fixed
131134
- [`order`]: avoid a crash on TypeScript’s `export import` syntax ([#1808], thanks [@ljharb])
132135
- [`newline-after-import`]: consider TypeScript `import =` syntax' ([#1811], thanks [@ljharb])
133136
- [`no-internal-modules`]: avoid a crash on a named export declaration ([#1814], thanks [@ljharb])
134137

135138
## [2.21.1] - 2020-06-07
139+
136140
### Fixed
137141
- TypeScript: [`import/named`]: avoid requiring `typescript` when not using TS ([#1805], thanks [@ljharb])
138142

139143
## [2.21.0] - 2020-06-07
144+
140145
### Added
141146
- [`import/default`]: support default export in TSExportAssignment ([#1528], thanks [@joaovieira])
142147
- [`no-cycle`]: add `ignoreExternal` option ([#1681], thanks [@sveyret])
@@ -167,6 +172,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
167172
- [eslint] bump minimum v7 version to v7.2.0
168173

169174
## [2.20.2] - 2020-03-28
175+
170176
### Fixed
171177
- [`order`]: fix `isExternalModule` detect on windows ([#1651], thanks [@fisker])
172178
- [`order`]: recognize ".." as a "parent" path ([#1658], thanks [@golopot])
@@ -176,6 +182,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
176182
- [Docs] `no-webpack-loader-syntax`: Updates webpack URLs ([#1751], thanks [@MikeyBeLike])
177183

178184
## [2.20.1] - 2020-02-01
185+
179186
### Fixed
180187
- [`export`]: Handle function overloading in `*.d.ts` ([#1619], thanks [@IvanGoncharov])
181188
- [`no-absolute-path`]: fix a crash with invalid import syntax ([#1616], thanks [@ljharb])
@@ -193,6 +200,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
193200
- [Tests] `order`: Add TS import type tests ([#1736], thanks [@kmui2])
194201

195202
## [2.20.0] - 2020-01-10
203+
196204
### Added
197205
- [`order`]: added `caseInsensitive` as an additional option to `alphabetize` ([#1586], thanks [@dbrewer5])
198206
- [`no-restricted-paths`]: New `except` option per `zone`, allowing exceptions to be defined for a restricted zone ([#1238], thanks [@rsolomon])
@@ -209,10 +217,12 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
209217
- [`extensions`]: improve `ignorePackages` docs ([#1248], thanks [@ivo-stefchev])
210218

211219
## [2.19.1] - 2019-12-08
220+
212221
### Fixed
213222
- [`no-extraneous-dependencies`]: ensure `node.source` exists
214223

215224
## [2.19.0] - 2019-12-08
225+
216226
### Added
217227
- [`internal-regex` setting]: regex pattern for marking packages "internal" ([#1491], thanks [@Librazy])
218228
- [`group-exports`]: make aggregate module exports valid ([#1472], thanks [@atikenny])
@@ -244,10 +254,12 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
244254
- [`no-unused-modules`]/`eslint-module-utils`: Avoid superfluous calls and code ([#1551], thanks [@brettz9])
245255

246256
## [2.18.2] - 2019-07-19
257+
247258
### Fixed
248259
- Skip warning on type interfaces ([#1425], thanks [@lencioni])
249260

250261
## [2.18.1] - 2019-07-18
262+
251263
### Fixed
252264
- Improve parse perf when using `@typescript-eslint/parser` ([#1409], thanks [@bradzacher])
253265
- [`prefer-default-export`]: don't warn on TypeAlias & TSTypeAliasDeclaration ([#1377], thanks [@sharmilajesupaul])
@@ -258,6 +270,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
258270
- [`no-extraneous-dependencies`], `importType`: remove lodash ([#1419], thanks [@ljharb])
259271

260272
## [2.18.0] - 2019-06-24
273+
261274
### Added
262275
- Support eslint v6 ([#1393], thanks [@sheepsteak])
263276
- [`order`]: Adds support for correctly sorting unknown types into a single group ([#1375], thanks [@swernerx])
@@ -272,6 +285,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
272285
- [`no-named-as-default-member`]: update broken link ([#1389], thanks [@fooloomanzoo])
273286

274287
## [2.17.3] - 2019-05-23
288+
275289
### Fixed
276290
- [`no-common-js`]: Also throw an error when assigning ([#1354], thanks [@charlessuh])
277291
- [`no-unused-modules`]: don't crash when lint file outside src-folder ([#1347], thanks [@rfermann])
@@ -287,15 +301,18 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
287301
- Document `env` option for `eslint-import-resolver-webpack` ([#1363], thanks [@kgregory])
288302

289303
## [2.17.2] - 2019-04-16
304+
290305
### Fixed
291306
- [`no-unused-modules`]: avoid crash when using `ignoreExports`-option ([#1331], [#1323], thanks [@rfermann])
292307
- [`no-unused-modules`]: make sure that rule with no options will not fail ([#1330], [#1334], thanks [@kiwka])
293308

294309
## [2.17.1] - 2019-04-13
310+
295311
### Fixed
296312
- require v2.4 of `eslint-module-utils` ([#1322])
297313

298314
## [2.17.0] - 2019-04-13
315+
299316
### Added
300317
- [`no-useless-path-segments`]: Add `noUselessIndex` option ([#1290], thanks [@timkraut])
301318
- [`no-duplicates`]: Add autofix ([#1312], thanks [@lydell])
@@ -321,13 +338,15 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
321338
- [`no-commonjs`]: add tests that show corner cases ([#1308], thanks [@TakeScoop])
322339

323340
## [2.16.0] - 2019-01-29
341+
324342
### Added
325343
- `typescript` config ([#1257], thanks [@kirill-konshin])
326344

327345
### Fixed
328346
- Memory leak of `SourceCode` objects for all parsed dependencies, resolved. (issue [#1266], thanks [@asapach] and [@sergei-startsev] for digging in)
329347

330348
## [2.15.0] - 2019-01-22
349+
331350
### Added
332351
- new rule: [`no-named-export`] ([#1157], thanks [@fsmaia])
333352

@@ -337,6 +356,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
337356
- [`named`]: fix destructuring assignment ([#1232], thanks [@ljqx])
338357

339358
## [2.14.0] - 2018-08-13
359+
340360
### Added
341361
- [`no-useless-path-segments`]: add commonJS (CJS) support ([#1128], thanks [@1pete])
342362
- [`namespace`]: add JSX check ([#1151], thanks [@jf248])
@@ -352,6 +372,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
352372
- add explicit support for RestElement alongside ExperimentalRestProperty (thanks [@ljharb])
353373

354374
## [2.13.0] - 2018-06-24
375+
355376
### Added
356377
- Add ESLint 5 support ([#1122], thanks [@ai] and [@ljharb])
357378
- Add [`no-relative-parent-imports`] rule: disallow relative imports from parent directories ([#1093], thanks [@chrislloyd])
@@ -360,12 +381,14 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
360381
- `namespace` rule: ensure it works in eslint 5/ecmaVersion 2018 (thanks [@ljharb])
361382

362383
## [2.12.0] - 2018-05-17
384+
363385
### Added
364386
- Ignore type imports for [`named`] rule ([#931], thanks [@mattijsbliek])
365387
- Add documentation for [`no-useless-path-segments`] rule ([#1068], thanks [@manovotny])
366388
- `packageDir` option for [`no-extraneous-dependencies`] can be array-valued ([#1085], thanks [@hulkish])
367389

368390
## [2.11.0] - 2018-04-09
391+
369392
### Added
370393
- Fixer for [`first`] ([#1046], thanks [@fengkfengk])
371394
- `allow-require` option for [`no-commonjs`] rule ([#880], thanks [@futpib])
@@ -374,11 +397,13 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
374397
- memory/CPU regression where ASTs were held in memory ([#1058], thanks [@klimashkin]/[@lukeapage])
375398

376399
## [2.10.0] - 2018-03-29
400+
377401
### Added
378402
- Autofixer for [`order`] rule ([#908], thanks [@tihonove])
379403
- Add [`no-cycle`] rule: reports import cycles.
380404

381405
## [2.9.0] - 2018-02-21
406+
382407
### Added
383408
- Add [`group-exports`] rule: style-guide rule to report use of multiple named exports ([#721], thanks [@robertrossmann])
384409
- Add [`no-self-import`] rule: forbids a module from importing itself. ([#727], [#449], [#447], thanks [@giodamelio]).
@@ -399,14 +424,17 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
399424
- TypeError for missing AST fields from TypeScript ([#842] / [#944], thanks [@alexgorbatchev])
400425

401426
## [2.7.0] - 2017-07-06
427+
402428
### Changed
403429
- [`no-absolute-path`] picks up speed boost, optional AMD support ([#843], thanks [@jseminck])
404430

405431
## [2.6.1] - 2017-06-29
432+
406433
### Fixed
407434
- update bundled node resolver dependency to latest version
408435

409436
## [2.6.0] - 2017-06-23
437+
410438
### Changed
411439
- update tests / peerDeps for ESLint 4.0 compatibility ([#871], thanks [@mastilver])
412440
- [`memo-parser`] updated to require `filePath` on parser options as it melts
@@ -429,6 +457,7 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
429457
- Add `allow` option to [`no-unassigned-import`] to allow for files that match the globs ([#671], [#737], thanks [@kevin940726]).
430458

431459
## [2.3.0] - 2017-05-18
460+
432461
### Added
433462
- [`no-anonymous-default-export`] rule: report anonymous default exports ([#712], thanks [@duncanbeevers]).
434463
- Add new value to [`order`]'s `newlines-between` option to allow newlines inside import groups ([#627], [#628], thanks [@giodamelio])
@@ -443,8 +472,8 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
443472
- "default is a reserved keyword" in no-maned-default tests by locking down babylon to 6.15.0 (#756, thanks @gmathieu)
444473
- support scoped modules containing non word characters
445474

446-
447475
## [2.2.0] - 2016-11-07
476+
448477
### Fixed
449478
- Corrected a few gaffs in the auto-ignore logic to fix major performance issues
450479
with projects that did not explicitly ignore `node_modules`. ([#654])
@@ -453,6 +482,7 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
453482
- [`prefer-default-export`]: fixed crash on export extensions ([#653])
454483

455484
## [2.1.0] - 2016-11-02
485+
456486
### Added
457487
- Add [`no-named-default`] rule: style-guide rule to report use of unnecessarily named default imports ([#596], thanks [@ntdb])
458488
- [`no-extraneous-dependencies`]: check globs against CWD + absolute path ([#602] + [#630], thanks [@ljharb])
@@ -465,10 +495,12 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
465495
- Fixed documentation for the default values for the [`order`] rule ([#601])
466496

467497
## [2.0.1] - 2016-10-06
498+
468499
### Fixed
469500
- Fixed code that relied on removed dependencies. ([#604])
470501

471502
## [2.0.0]! - 2016-09-30
503+
472504
### Added
473505
- [`unambiguous`] rule: report modules that are not unambiguously ES modules.
474506
- `recommended` shared config. Roughly `errors` and `warnings` mixed together,
@@ -494,6 +526,7 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
494526
- [`no-internal-modules`]: support `@`-scoped packages ([#577]+[#578], thanks [@spalger])
495527

496528
## [1.16.0] - 2016-09-22
529+
497530
### Added
498531
- Added [`no-dynamic-require`] rule: forbid `require()` calls with expressions. ([#567], [#568])
499532
- Added [`no-internal-modules`] rule: restrict deep package imports to specific folders. ([#485], thanks [@spalger]!)
@@ -504,6 +537,7 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
504537
- [`default`]: allow re-export of values from ignored files as default ([#545], thanks [@skyrpex])
505538

506539
## [1.15.0] - 2016-09-12
540+
507541
### Added
508542
- Added an `allow` option to [`no-nodejs-modules`] to allow exceptions ([#452], [#509]).
509543
- Added [`no-absolute-path`] rule ([#530], [#538])
@@ -514,13 +548,15 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
514548
- [`no-named-as-default-member`] Allow default import to have a property named "default" ([#507], [#508], thanks [@jquense] for both!)
515549

516550
## [1.14.0] - 2016-08-22
551+
517552
### Added
518553
- [`import/parsers` setting]: parse some dependencies (i.e. TypeScript!) with a different parser than the ESLint-configured parser. ([#503])
519554

520555
### Fixed
521556
- [`namespace`] exception for get property from `namespace` import, which are re-export from commonjs module ([#499] fixes [#416], thanks [@wKich])
522557

523558
## [1.13.0] - 2016-08-11
559+
524560
### Added
525561
- `allowComputed` option for [`namespace`] rule. If set to `true`, won't report
526562
computed member references to namespaces. (see [#456])
@@ -533,15 +569,18 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
533569
in an imported file. (fixes [#478], thanks [@rhys-vdw])
534570

535571
## [1.12.0] - 2016-07-26
572+
536573
### Added
537574
- [`import/external-module-folders` setting]: a possibility to configure folders for "external" modules ([#444], thanks [@zloirock])
538575

539576
## [1.11.1] - 2016-07-20
577+
540578
### Fixed
541579
- [`newline-after-import`] exception for `switch` branches with `require`s iff parsed as `sourceType:'module'`.
542580
(still [#441], thanks again [@ljharb])
543581

544582
## [1.11.0] - 2016-07-17
583+
545584
### Added
546585
- Added an `peerDependencies` option to [`no-extraneous-dependencies`] to allow/forbid peer dependencies ([#423], [#428], thanks [@jfmengels]!).
547586

@@ -550,20 +589,24 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
550589
function expression (e.g. `() => require('a') || require('b')`). ([#441], thanks [@ljharb])
551590

552591
## [1.10.3] - 2016-07-08
592+
553593
### Fixed
554594
- removing `Symbol` dependencies (i.e. `for-of` loops) due to Node 0.10 polyfill
555595
issue (see [#415]). Should not make any discernible semantic difference.
556596

557597
## [1.10.2] - 2016-07-04
598+
558599
### Fixed
559600
- Something horrible happened during `npm prepublish` of 1.10.1.
560601
Several `rm -rf node_modules && npm i` and `gulp clean && npm prepublish`s later, it is rebuilt and republished as 1.10.2. Thanks [@rhettlivingston] for noticing and reporting!
561602

562603
## [1.10.1] - 2016-07-02 [YANKED]
604+
563605
### Added
564606
- Officially support ESLint 3.x. (peerDependencies updated to `2.x - 3.x`)
565607

566608
## [1.10.0] - 2016-06-30
609+
567610
### Added
568611
- Added new rule [`no-restricted-paths`]. ([#155]/[#371], thanks [@lo1tuma])
569612
- [`import/core-modules` setting]: allow configuration of additional module names,
@@ -574,14 +617,17 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
574617
- Fixed crash with `newline-after-import` related to the use of switch cases. (fixes [#386], thanks [@ljharb] for reporting) ([#395])
575618

576619
## [1.9.2] - 2016-06-21
620+
577621
### Fixed
578622
- Issues with ignored/CJS files in [`export`] and [`no-deprecated`] rules. ([#348], [#370])
579623

580624
## [1.9.1] - 2016-06-16
625+
581626
### Fixed
582627
- Reordered precedence for loading resolvers. ([#373])
583628

584629
## [1.9.0] - 2016-06-10
630+
585631
### Added
586632
- Added support TomDoc comments to [`no-deprecated`]. ([#321], thanks [@josh])
587633
- Added support for loading custom resolvers ([#314], thanks [@le0nik])
@@ -590,6 +636,7 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
590636
- [`prefer-default-export`] handles `export function` and `export const` in same file ([#359], thanks [@scottnonnenberg])
591637

592638
## [1.8.1] - 2016-05-23
639+
593640
### Fixed
594641
- `export * from 'foo'` now properly ignores a `default` export from `foo`, if any. ([#328]/[#332], thanks [@jkimbo])
595642
This impacts all static analysis of imported names. ([`default`], [`named`], [`namespace`], [`export`])
@@ -599,6 +646,7 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
599646
- [`prefer-default-export`] properly handles deep destructuring, `export * from ...`, and files with no exports. ([#342]+[#343], thanks [@scottnonnenberg])
600647

601648
## [1.8.0] - 2016-05-11
649+
602650
### Added
603651
- [`prefer-default-export`], new rule. ([#308], thanks [@gavriguy])
604652

@@ -607,6 +655,7 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
607655
- Make [`no-extraneous-dependencies`] handle scoped packages ([#316], thanks [@jfmengels])
608656

609657
## [1.7.0] - 2016-05-06
658+
610659
### Added
611660
- [`newline-after-import`], new rule. ([#245], thanks [@singles])
612661
- Added an `optionalDependencies` option to [`no-extraneous-dependencies`] to allow/forbid optional dependencies ([#266], thanks [@jfmengels]).
@@ -621,13 +670,15 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
621670
module is not resolved. Also, never report for builtins (i.e. `path`). ([#296])
622671

623672
## [1.6.1] - 2016-04-28
673+
624674
### Fixed
625675
- [`no-named-as-default-member`]: don't crash on rest props. ([#281], thanks [@SimenB])
626676
- support for Node 6: don't pass `null` to `path` functions.
627677
Thanks to [@strawbrary] for bringing this up ([#272]) and adding OSX support to the Travis
628678
config ([#288]).
629679

630680
## [1.6.0] - 2016-04-25
681+
631682
### Added
632683
- add [`no-named-as-default-member`] to `warnings` canned config
633684
- add [`no-extraneous-dependencies`] rule ([#241], thanks [@jfmengels])
@@ -646,6 +697,7 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
646697
- [`no-named-as-default-member`] had a crash on destructuring in loops (thanks for heads up from [@lemonmade])
647698

648699
## [1.5.0] - 2016-04-18
700+
649701
### Added
650702
- report resolver errors at the top of the linted file
651703
- add [`no-namespace`] rule ([#239], thanks [@singles])
@@ -658,6 +710,7 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
658710
- support for Node 0.10, via `es6-*` ponyfills. Using native Map/Set/Symbol.
659711

660712
## [1.4.0] - 2016-03-25
713+
661714
### Added
662715
- Resolver plugin interface v2: more explicit response format that more clearly covers the found-but-core-module case, where there is no path.
663716
Still backwards-compatible with the original version of the resolver spec.
@@ -668,6 +721,7 @@ Yanked due to critical issue in eslint-module-utils with cache key resulting fro
668721
- using `es6-*` ponyfills instead of `babel-runtime`
669722

670723
## [1.3.0] - 2016-03-20
724+
671725
Major perf improvements. Between parsing only once and ignoring gigantic, non-module `node_modules`,
672726
there is very little added time.
673727

@@ -683,6 +737,7 @@ memoizing parser, and takes only 27s with naked `babel-eslint` (thus, reparsing
683737
something that looks like an `export` is detected in the module content.
684738

685739
## [1.2.0] - 2016-03-19
740+
686741
Thanks [@lencioni] for identifying a huge amount of rework in resolve and kicking
687742
off a bunch of memoization.
688743

@@ -693,6 +748,7 @@ I'm seeing 62% improvement over my normal test codebase when executing only
693748
- added caching to core/resolve via [#214], configured via [`import/cache` setting]
694749

695750
## [1.1.0] - 2016-03-15
751+
696752
### Added
697753
- Added an [`ignore`](./docs/rules/no-unresolved.md#ignore) option to [`no-unresolved`] for those pesky files that no resolver can find. (still prefer enhancing the Webpack and Node resolvers to using it, though). See [#89] for details.
698754

@@ -744,6 +800,7 @@ I'm seeing 62% improvement over my normal test codebase when executing only
744800
- `babylon` as default import parser (see Breaking)
745801

746802
## [0.13.0] - 2016-02-08
803+
747804
### Added
748805
- [`no-commonjs`] rule
749806
- [`no-amd`] rule
@@ -752,17 +809,21 @@ I'm seeing 62% improvement over my normal test codebase when executing only
752809
- Removed vestigial `no-require` rule. [`no-commonjs`] is more complete.
753810

754811
## [0.12.2] - 2016-02-06 [YANKED]
812+
755813
Unpublished from npm and re-released as 0.13.0. See [#170].
756814

757815
## [0.12.1] - 2015-12-17
816+
758817
### Changed
759818
- Broke docs for rules out into individual files.
760819

761820
## [0.12.0] - 2015-12-14
821+
762822
### Changed
763823
- Ignore [`import/ignore` setting] if exports are actually found in the parsed module. Does this to support use of `jsnext:main` in `node_modules` without the pain of managing an allow list or a nuanced deny list.
764824

765825
## [0.11.0] - 2015-11-27
826+
766827
### Added
767828
- Resolver plugins. Now the linter can read Webpack config, properly follow aliases and ignore externals, dismisses inline loaders, etc. etc.!
768829

@@ -1366,8 +1427,8 @@ for info on changes for earlier releases.
13661427
[@kiwka]: https://github.com/kiwka
13671428
[@klimashkin]: https://github.com/klimashkin
13681429
[@kmui2]: https://github.com/kmui2
1369-
[@KostyaZgara]: https://github.com/KostyaZgara
13701430
[@knpwrs]: https://github.com/knpwrs
1431+
[@KostyaZgara]: https://github.com/KostyaZgara
13711432
[@laysent]: https://github.com/laysent
13721433
[@le0nik]: https://github.com/le0nik
13731434
[@lemonmade]: https://github.com/lemonmade

‎tests/src/rules/no-unused-modules.js

+366-187
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import typescriptConfig from '../../../config/typescript';
44

55
import { RuleTester } from 'eslint';
66
import fs from 'fs';
7-
import semver from 'semver';
87
import eslintPkg from 'eslint/package.json';
8+
import semver from 'semver';
99

1010
// TODO: figure out why these tests fail in eslint 4
1111
const isESLint4TODO = semver.satisfies(eslintPkg.version, '^4');
@@ -108,34 +108,50 @@ ruleTester.run('no-unused-modules', rule, {
108108
// tests for exports
109109
ruleTester.run('no-unused-modules', rule, {
110110
valid: [
111-
112-
test({ options: unusedExportsOptions,
111+
test({
112+
options: unusedExportsOptions,
113113
code: 'import { o2 } from "./file-o";export default () => 12',
114-
filename: testFilePath('./no-unused-modules/file-a.js') }),
115-
test({ options: unusedExportsOptions,
114+
filename: testFilePath('./no-unused-modules/file-a.js'),
115+
}),
116+
test({
117+
options: unusedExportsOptions,
116118
code: 'export const b = 2',
117-
filename: testFilePath('./no-unused-modules/file-b.js') }),
118-
test({ options: unusedExportsOptions,
119+
filename: testFilePath('./no-unused-modules/file-b.js'),
120+
}),
121+
test({
122+
options: unusedExportsOptions,
119123
code: 'const c1 = 3; function c2() { return 3 }; export { c1, c2 }',
120-
filename: testFilePath('./no-unused-modules/file-c.js') }),
121-
test({ options: unusedExportsOptions,
124+
filename: testFilePath('./no-unused-modules/file-c.js'),
125+
}),
126+
test({
127+
options: unusedExportsOptions,
122128
code: 'export function d() { return 4 }',
123-
filename: testFilePath('./no-unused-modules/file-d.js') }),
124-
test({ options: unusedExportsOptions,
129+
filename: testFilePath('./no-unused-modules/file-d.js'),
130+
}),
131+
test({
132+
options: unusedExportsOptions,
125133
code: 'export class q { q0() {} }',
126-
filename: testFilePath('./no-unused-modules/file-q.js') }),
127-
test({ options: unusedExportsOptions,
134+
filename: testFilePath('./no-unused-modules/file-q.js'),
135+
}),
136+
test({
137+
options: unusedExportsOptions,
128138
code: 'const e0 = 5; export { e0 as e }',
129-
filename: testFilePath('./no-unused-modules/file-e.js') }),
130-
test({ options: unusedExportsOptions,
139+
filename: testFilePath('./no-unused-modules/file-e.js'),
140+
}),
141+
test({
142+
options: unusedExportsOptions,
131143
code: 'const l0 = 5; const l = 10; export { l0 as l1, l }; export default () => {}',
132-
filename: testFilePath('./no-unused-modules/file-l.js') }),
133-
test({ options: unusedExportsOptions,
144+
filename: testFilePath('./no-unused-modules/file-l.js'),
145+
}),
146+
test({
147+
options: unusedExportsOptions,
134148
code: 'const o0 = 0; const o1 = 1; export { o0, o1 as o2 }; export default () => {}',
135-
filename: testFilePath('./no-unused-modules/file-o.js') }),
149+
filename: testFilePath('./no-unused-modules/file-o.js'),
150+
}),
136151
],
137152
invalid: [
138-
test({ options: unusedExportsOptions,
153+
test({
154+
options: unusedExportsOptions,
139155
code: `import eslint from 'eslint'
140156
import fileA from './file-a'
141157
import { b } from './file-b'
@@ -155,319 +171,413 @@ ruleTester.run('no-unused-modules', rule, {
155171
error(`exported declaration 'o0' not used within other modules`),
156172
error(`exported declaration 'o3' not used within other modules`),
157173
error(`exported declaration 'p' not used within other modules`),
158-
] }),
159-
test({ options: unusedExportsOptions,
174+
],
175+
}),
176+
test({
177+
options: unusedExportsOptions,
160178
code: `const n0 = 'n0'; const n1 = 42; export { n0, n1 }; export default () => {}`,
161179
filename: testFilePath('./no-unused-modules/file-n.js'),
162-
errors: [error(`exported declaration 'default' not used within other modules`)] }),
180+
errors: [error(`exported declaration 'default' not used within other modules`)],
181+
}),
163182
],
164183
});
165184

166185
// test for unused exports
167186
ruleTester.run('no-unused-modules', rule, {
168187
valid: [],
169188
invalid: [
170-
test({ options: unusedExportsOptions,
189+
test({
190+
options: unusedExportsOptions,
171191
code: 'export default () => 13',
172192
filename: testFilePath('./no-unused-modules/file-f.js'),
173-
errors: [error(`exported declaration 'default' not used within other modules`)] }),
174-
test({ options: unusedExportsOptions,
193+
errors: [error(`exported declaration 'default' not used within other modules`)],
194+
}),
195+
test({
196+
options: unusedExportsOptions,
175197
code: 'export const g = 2',
176198
filename: testFilePath('./no-unused-modules/file-g.js'),
177-
errors: [error(`exported declaration 'g' not used within other modules`)] }),
178-
test({ options: unusedExportsOptions,
199+
errors: [error(`exported declaration 'g' not used within other modules`)],
200+
}),
201+
test({
202+
options: unusedExportsOptions,
179203
code: 'const h1 = 3; function h2() { return 3 }; const h3 = true; export { h1, h2, h3 }',
180204
filename: testFilePath('./no-unused-modules/file-h.js'),
181-
errors: [error(`exported declaration 'h1' not used within other modules`)] }),
182-
test({ options: unusedExportsOptions,
205+
errors: [error(`exported declaration 'h1' not used within other modules`)],
206+
}),
207+
test({
208+
options: unusedExportsOptions,
183209
code: 'const i1 = 3; function i2() { return 3 }; export { i1, i2 }',
184210
filename: testFilePath('./no-unused-modules/file-i.js'),
185211
errors: [
186212
error(`exported declaration 'i1' not used within other modules`),
187213
error(`exported declaration 'i2' not used within other modules`),
188-
] }),
189-
test({ options: unusedExportsOptions,
214+
],
215+
}),
216+
test({
217+
options: unusedExportsOptions,
190218
code: 'export function j() { return 4 }',
191219
filename: testFilePath('./no-unused-modules/file-j.js'),
192-
errors: [error(`exported declaration 'j' not used within other modules`)] }),
193-
test({ options: unusedExportsOptions,
220+
errors: [error(`exported declaration 'j' not used within other modules`)],
221+
}),
222+
test({
223+
options: unusedExportsOptions,
194224
code: 'export class q { q0() {} }',
195225
filename: testFilePath('./no-unused-modules/file-q.js'),
196-
errors: [error(`exported declaration 'q' not used within other modules`)] }),
197-
test({ options: unusedExportsOptions,
226+
errors: [error(`exported declaration 'q' not used within other modules`)],
227+
}),
228+
test({
229+
options: unusedExportsOptions,
198230
code: 'const k0 = 5; export { k0 as k }',
199231
filename: testFilePath('./no-unused-modules/file-k.js'),
200-
errors: [error(`exported declaration 'k' not used within other modules`)] }),
232+
errors: [error(`exported declaration 'k' not used within other modules`)],
233+
}),
201234
],
202235
});
203236

204-
// // test for export from
237+
// test for export from
205238
ruleTester.run('no-unused-modules', rule, {
206239
valid: [
207-
test({ options: unusedExportsOptions,
240+
test({
241+
options: unusedExportsOptions,
208242
code: `export { default } from './file-o'`,
209-
filename: testFilePath('./no-unused-modules/file-s.js') }),
243+
filename: testFilePath('./no-unused-modules/file-s.js'),
244+
}),
210245
],
211246
invalid: [
212-
test({ options: unusedExportsOptions,
247+
test({
248+
options: unusedExportsOptions,
213249
code: `export { k } from '${testFilePath('./no-unused-modules/file-k.js')}'`,
214250
filename: testFilePath('./no-unused-modules/file-j.js'),
215-
errors: [error(`exported declaration 'k' not used within other modules`)] }),
251+
errors: [error(`exported declaration 'k' not used within other modules`)],
252+
}),
216253
],
217254
});
218255

219256
ruleTester.run('no-unused-modules', rule, {
220257
valid: [
221-
test({ options: unusedExportsOptions,
258+
test({
259+
options: unusedExportsOptions,
222260
code: 'const k0 = 5; export { k0 as k }',
223-
filename: testFilePath('./no-unused-modules/file-k.js') }),
261+
filename: testFilePath('./no-unused-modules/file-k.js'),
262+
}),
224263
],
225264
invalid: [],
226265
});
227266

228267
// test for ignored files
229268
ruleTester.run('no-unused-modules', rule, {
230269
valid: [
231-
test({ options: unusedExportsOptions,
270+
test({
271+
options: unusedExportsOptions,
232272
code: 'export default () => 14',
233-
filename: testFilePath('./no-unused-modules/file-ignored-a.js') }),
234-
test({ options: unusedExportsOptions,
273+
filename: testFilePath('./no-unused-modules/file-ignored-a.js'),
274+
}),
275+
test({
276+
options: unusedExportsOptions,
235277
code: 'export const b = 2',
236-
filename: testFilePath('./no-unused-modules/file-ignored-b.js') }),
237-
test({ options: unusedExportsOptions,
278+
filename: testFilePath('./no-unused-modules/file-ignored-b.js'),
279+
}),
280+
test({
281+
options: unusedExportsOptions,
238282
code: 'const c1 = 3; function c2() { return 3 }; export { c1, c2 }',
239-
filename: testFilePath('./no-unused-modules/file-ignored-c.js') }),
240-
test({ options: unusedExportsOptions,
283+
filename: testFilePath('./no-unused-modules/file-ignored-c.js'),
284+
}),
285+
test({
286+
options: unusedExportsOptions,
241287
code: 'export function d() { return 4 }',
242-
filename: testFilePath('./no-unused-modules/file-ignored-d.js') }),
243-
test({ options: unusedExportsOptions,
288+
filename: testFilePath('./no-unused-modules/file-ignored-d.js'),
289+
}),
290+
test({
291+
options: unusedExportsOptions,
244292
code: 'const f = 5; export { f as e }',
245-
filename: testFilePath('./no-unused-modules/file-ignored-e.js') }),
246-
test({ options: unusedExportsOptions,
293+
filename: testFilePath('./no-unused-modules/file-ignored-e.js'),
294+
}),
295+
test({
296+
options: unusedExportsOptions,
247297
code: 'const l0 = 5; const l = 10; export { l0 as l1, l }; export default () => {}',
248-
filename: testFilePath('./no-unused-modules/file-ignored-l.js') }),
298+
filename: testFilePath('./no-unused-modules/file-ignored-l.js'),
299+
}),
249300
],
250301
invalid: [],
251302
});
252303

253304
// add named import for file with default export
254305
ruleTester.run('no-unused-modules', rule, {
255306
valid: [
256-
test({ options: unusedExportsOptions,
307+
test({
308+
options: unusedExportsOptions,
257309
code: `import { f } from '${testFilePath('./no-unused-modules/file-f.js')}'`,
258-
filename: testFilePath('./no-unused-modules/file-0.js') }),
310+
filename: testFilePath('./no-unused-modules/file-0.js'),
311+
}),
259312
],
260313
invalid: [
261-
test({ options: unusedExportsOptions,
314+
test({
315+
options: unusedExportsOptions,
262316
code: 'export default () => 15',
263317
filename: testFilePath('./no-unused-modules/file-f.js'),
264-
errors: [error(`exported declaration 'default' not used within other modules`)] }),
318+
errors: [error(`exported declaration 'default' not used within other modules`)],
319+
}),
265320
],
266321
});
267322

268323
// add default import for file with default export
269324
ruleTester.run('no-unused-modules', rule, {
270325
valid: [
271-
test({ options: unusedExportsOptions,
326+
test({
327+
options: unusedExportsOptions,
272328
code: `import f from '${testFilePath('./no-unused-modules/file-f.js')}'`,
273-
filename: testFilePath('./no-unused-modules/file-0.js') }),
274-
test({ options: unusedExportsOptions,
329+
filename: testFilePath('./no-unused-modules/file-0.js'),
330+
}),
331+
test({
332+
options: unusedExportsOptions,
275333
code: 'export default () => 16',
276-
filename: testFilePath('./no-unused-modules/file-f.js') }),
334+
filename: testFilePath('./no-unused-modules/file-f.js'),
335+
}),
277336
],
278337
invalid: [],
279338
});
280339

281340
// add default import for file with named export
282341
ruleTester.run('no-unused-modules', rule, {
283342
valid: [
284-
test({ options: unusedExportsOptions,
343+
test({
344+
options: unusedExportsOptions,
285345
code: `import g from '${testFilePath('./no-unused-modules/file-g.js')}';import {h} from '${testFilePath('./no-unused-modules/file-gg.js')}'`,
286-
filename: testFilePath('./no-unused-modules/file-0.js') }),
346+
filename: testFilePath('./no-unused-modules/file-0.js'),
347+
}),
287348
],
288349
invalid: [
289-
test({ options: unusedExportsOptions,
350+
test({
351+
options: unusedExportsOptions,
290352
code: 'export const g = 2',
291353
filename: testFilePath('./no-unused-modules/file-g.js'),
292-
errors: [error(`exported declaration 'g' not used within other modules`)] })],
354+
errors: [error(`exported declaration 'g' not used within other modules`)],
355+
})],
293356
});
294357

295358
// add named import for file with named export
296359
ruleTester.run('no-unused-modules', rule, {
297360
valid: [
298-
test({ options: unusedExportsOptions,
361+
test({
362+
options: unusedExportsOptions,
299363
code: `import { g } from '${testFilePath('./no-unused-modules/file-g.js')}'; import eslint from 'eslint'`,
300-
filename: testFilePath('./no-unused-modules/file-0.js') }),
301-
test({ options: unusedExportsOptions,
364+
filename: testFilePath('./no-unused-modules/file-0.js'),
365+
}),
366+
test({
367+
options: unusedExportsOptions,
302368
code: 'export const g = 2',
303-
filename: testFilePath('./no-unused-modules/file-g.js') }),
369+
filename: testFilePath('./no-unused-modules/file-g.js'),
370+
}),
304371
],
305372
invalid: [],
306373
});
307374

308375
// add different named import for file with named export
309376
ruleTester.run('no-unused-modules', rule, {
310377
valid: [
311-
test({ options: unusedExportsOptions,
378+
test({
379+
options: unusedExportsOptions,
312380
code: `import { c } from '${testFilePath('./no-unused-modules/file-b.js')}'`,
313-
filename: testFilePath('./no-unused-modules/file-0.js') }),
381+
filename: testFilePath('./no-unused-modules/file-0.js'),
382+
}),
314383
],
315384
invalid: [
316-
test({ options: unusedExportsOptions,
385+
test({
386+
options: unusedExportsOptions,
317387
code: 'export const b = 2',
318388
filename: testFilePath('./no-unused-modules/file-b.js'),
319-
errors: [error(`exported declaration 'b' not used within other modules`)] }),
389+
errors: [error(`exported declaration 'b' not used within other modules`)],
390+
}),
320391
],
321392
});
322393

323394
// add renamed named import for file with named export
324395
ruleTester.run('no-unused-modules', rule, {
325396
valid: [
326-
test({ options: unusedExportsOptions,
397+
test({
398+
options: unusedExportsOptions,
327399
code: `import { g as g1 } from '${testFilePath('./no-unused-modules/file-g.js')}'; import eslint from 'eslint'`,
328-
filename: testFilePath('./no-unused-modules/file-0.js') }),
329-
test({ options: unusedExportsOptions,
400+
filename: testFilePath('./no-unused-modules/file-0.js'),
401+
}),
402+
test({
403+
options: unusedExportsOptions,
330404
code: 'export const g = 2',
331-
filename: testFilePath('./no-unused-modules/file-g.js') }),
405+
filename: testFilePath('./no-unused-modules/file-g.js'),
406+
}),
332407
],
333408
invalid: [],
334409
});
335410

336411
// add different renamed named import for file with named export
337412
ruleTester.run('no-unused-modules', rule, {
338413
valid: [
339-
test({ options: unusedExportsOptions,
414+
test({
415+
options: unusedExportsOptions,
340416
code: `import { g1 as g } from '${testFilePath('./no-unused-modules/file-g.js')}'`,
341-
filename: testFilePath('./no-unused-modules/file-0.js') }),
417+
filename: testFilePath('./no-unused-modules/file-0.js'),
418+
}),
342419
],
343420
invalid: [
344-
test({ options: unusedExportsOptions,
421+
test({
422+
options: unusedExportsOptions,
345423
code: 'export const g = 2',
346424
filename: testFilePath('./no-unused-modules/file-g.js'),
347-
errors: [error(`exported declaration 'g' not used within other modules`)] }),
425+
errors: [error(`exported declaration 'g' not used within other modules`)],
426+
}),
348427
],
349428
});
350429

351430
// remove default import for file with default export
352431
ruleTester.run('no-unused-modules', rule, {
353432
valid: [
354-
test({ options: unusedExportsOptions,
433+
test({
434+
options: unusedExportsOptions,
355435
code: `import { a1, a2 } from '${testFilePath('./no-unused-modules/file-a.js')}'`,
356-
filename: testFilePath('./no-unused-modules/file-0.js') }),
436+
filename: testFilePath('./no-unused-modules/file-0.js'),
437+
}),
357438
],
358439
invalid: [
359-
test({ options: unusedExportsOptions,
440+
test({
441+
options: unusedExportsOptions,
360442
code: 'export default () => 17',
361443
filename: testFilePath('./no-unused-modules/file-a.js'),
362-
errors: [error(`exported declaration 'default' not used within other modules`)] }),
444+
errors: [error(`exported declaration 'default' not used within other modules`)],
445+
}),
363446
],
364447
});
365448

366449
// add namespace import for file with unused exports
367450
ruleTester.run('no-unused-modules', rule, {
368451
valid: [],
369452
invalid: [
370-
test({ options: unusedExportsOptions,
453+
test({
454+
options: unusedExportsOptions,
371455
code: 'const m0 = 5; const m = 10; export { m0 as m1, m }; export default () => {}',
372456
filename: testFilePath('./no-unused-modules/file-m.js'),
373457
errors: [
374458
error(`exported declaration 'm1' not used within other modules`),
375459
error(`exported declaration 'm' not used within other modules`),
376460
error(`exported declaration 'default' not used within other modules`),
377-
] }),
461+
],
462+
}),
378463
],
379464
});
380465
ruleTester.run('no-unused-modules', rule, {
381466
valid: [
382-
test({ options: unusedExportsOptions,
467+
test({
468+
options: unusedExportsOptions,
383469
code: `import * as m from '${testFilePath('./no-unused-modules/file-m.js')}'; import unknown from 'unknown-module'`,
384-
filename: testFilePath('./no-unused-modules/file-0.js') }),
385-
test({ options: unusedExportsOptions,
470+
filename: testFilePath('./no-unused-modules/file-0.js'),
471+
}),
472+
test({
473+
options: unusedExportsOptions,
386474
code: 'const m0 = 5; const m = 10; export { m0 as m1, m }; export default () => {}',
387-
filename: testFilePath('./no-unused-modules/file-m.js') }),
475+
filename: testFilePath('./no-unused-modules/file-m.js'),
476+
}),
388477
],
389478
invalid: [],
390479
});
391480

392481
// remove all exports
393482
ruleTester.run('no-unused-modules', rule, {
394483
valid: [
395-
test({ options: unusedExportsOptions,
484+
test({
485+
options: unusedExportsOptions,
396486
code: `/* import * as m from '${testFilePath('./no-unused-modules/file-m.js')}' */`,
397-
filename: testFilePath('./no-unused-modules/file-0.js') }),
487+
filename: testFilePath('./no-unused-modules/file-0.js'),
488+
}),
398489
],
399490
invalid: [
400-
test({ options: unusedExportsOptions,
491+
test({
492+
options: unusedExportsOptions,
401493
code: 'const m0 = 5; const m = 10; export { m0 as m1, m }; export default () => {}',
402494
filename: testFilePath('./no-unused-modules/file-m.js'),
403495
errors: [
404496
error(`exported declaration 'm1' not used within other modules`),
405497
error(`exported declaration 'm' not used within other modules`),
406498
error(`exported declaration 'default' not used within other modules`),
407-
] }),
499+
],
500+
}),
408501
],
409502
});
410503

411504
ruleTester.run('no-unused-modules', rule, {
412505
valid: [
413-
test({ options: unusedExportsOptions,
506+
test({
507+
options: unusedExportsOptions,
414508
code: `export * from '${testFilePath('./no-unused-modules/file-m.js')}';`,
415-
filename: testFilePath('./no-unused-modules/file-0.js') }),
509+
filename: testFilePath('./no-unused-modules/file-0.js'),
510+
}),
416511
],
417512
invalid: [],
418513
});
419514
ruleTester.run('no-unused-modules', rule, {
420515
valid: [],
421516
invalid: [
422-
test({ options: unusedExportsOptions,
517+
test({
518+
options: unusedExportsOptions,
423519
code: 'const m0 = 5; const m = 10; export { m0 as m1, m }; export default () => {}',
424520
filename: testFilePath('./no-unused-modules/file-m.js'),
425-
errors: [error(`exported declaration 'default' not used within other modules`)] }),
521+
errors: [error(`exported declaration 'default' not used within other modules`)],
522+
}),
426523
],
427524
});
428525

429526
ruleTester.run('no-unused-modules', rule, {
430527
valid: [],
431528
invalid: [
432-
test({ options: unusedExportsOptions,
529+
test({
530+
options: unusedExportsOptions,
433531
code: `export { m1, m} from '${testFilePath('./no-unused-modules/file-m.js')}';`,
434532
filename: testFilePath('./no-unused-modules/file-0.js'),
435533
errors: [
436534
error(`exported declaration 'm1' not used within other modules`),
437535
error(`exported declaration 'm' not used within other modules`),
438-
] }),
439-
test({ options: unusedExportsOptions,
536+
],
537+
}),
538+
test({
539+
options: unusedExportsOptions,
440540
code: 'const m0 = 5; const m = 10; export { m0 as m1, m }; export default () => {}',
441541
filename: testFilePath('./no-unused-modules/file-m.js'),
442-
errors: [error(`exported declaration 'default' not used within other modules`)] }),
542+
errors: [error(`exported declaration 'default' not used within other modules`)],
543+
}),
443544
],
444545
});
445546

446547
ruleTester.run('no-unused-modules', rule, {
447548
valid: [
448-
// test({ options: unusedExportsOptions,
449-
// code: `export { default, m1 } from '${testFilePath('./no-unused-modules/file-m.js')}';`,
450-
// filename: testFilePath('./no-unused-modules/file-0.js')}),
549+
/* TODO:
550+
test({
551+
options: unusedExportsOptions,
552+
code: `export { default, m1 } from '${testFilePath('./no-unused-modules/file-m.js')}';`,
553+
filename: testFilePath('./no-unused-modules/file-0.js')
554+
}),
555+
*/
451556
],
452557
invalid: [
453-
test({ options: unusedExportsOptions,
558+
test({
559+
options: unusedExportsOptions,
454560
code: `export { default, m1 } from '${testFilePath('./no-unused-modules/file-m.js')}';`,
455561
filename: testFilePath('./no-unused-modules/file-0.js'),
456562
errors: [
457563
error(`exported declaration 'default' not used within other modules`),
458564
error(`exported declaration 'm1' not used within other modules`),
459-
] }),
460-
test({ options: unusedExportsOptions,
565+
],
566+
}),
567+
test({
568+
options: unusedExportsOptions,
461569
code: 'const m0 = 5; const m = 10; export { m0 as m1, m }; export default () => {}',
462570
filename: testFilePath('./no-unused-modules/file-m.js'),
463-
errors: [error(`exported declaration 'm' not used within other modules`)] }),
571+
errors: [error(`exported declaration 'm' not used within other modules`)],
572+
}),
464573
],
465574
});
466575

467576
// Test that import and export in the same file both counts as usage
468577
ruleTester.run('no-unused-modules', rule, {
469578
valid: [
470-
test({ options: unusedExportsOptions,
579+
test({
580+
options: unusedExportsOptions,
471581
code: `export const a = 5;export const b = 't1'`,
472582
filename: testFilePath('./no-unused-modules/import-export-1.js'),
473583
}),
@@ -478,23 +588,31 @@ ruleTester.run('no-unused-modules', rule, {
478588
describe('renameDefault', () => {
479589
ruleTester.run('no-unused-modules', rule, {
480590
valid: [
481-
test({ options: unusedExportsOptions,
591+
test({
592+
options: unusedExportsOptions,
482593
code: 'export { default as Component } from "./Component"',
483-
filename: testFilePath('./no-unused-modules/renameDefault/components.js') }),
484-
test({ options: unusedExportsOptions,
594+
filename: testFilePath('./no-unused-modules/renameDefault/components.js'),
595+
}),
596+
test({
597+
options: unusedExportsOptions,
485598
code: 'export default function Component() {}',
486-
filename: testFilePath('./no-unused-modules/renameDefault/Component.js') }),
599+
filename: testFilePath('./no-unused-modules/renameDefault/Component.js'),
600+
}),
487601
],
488602
invalid: [],
489603
});
490604
ruleTester.run('no-unused-modules', rule, {
491605
valid: [
492-
test({ options: unusedExportsOptions,
606+
test({
607+
options: unusedExportsOptions,
493608
code: 'export { default as ComponentA } from "./ComponentA";export { default as ComponentB } from "./ComponentB";',
494-
filename: testFilePath('./no-unused-modules/renameDefault-2/components.js') }),
495-
test({ options: unusedExportsOptions,
609+
filename: testFilePath('./no-unused-modules/renameDefault-2/components.js'),
610+
}),
611+
test({
612+
options: unusedExportsOptions,
496613
code: 'export default function ComponentA() {};',
497-
filename: testFilePath('./no-unused-modules/renameDefault-2/ComponentA.js') }),
614+
filename: testFilePath('./no-unused-modules/renameDefault-2/ComponentA.js'),
615+
}),
498616
],
499617
invalid: [],
500618
});
@@ -508,12 +626,16 @@ describe('test behavior for new file', () => {
508626
// add import in newly created file
509627
ruleTester.run('no-unused-modules', rule, {
510628
valid: [
511-
test({ options: unusedExportsOptions,
629+
test({
630+
options: unusedExportsOptions,
512631
code: `import * as m from '${testFilePath('./no-unused-modules/file-m.js')}'`,
513-
filename: testFilePath('./no-unused-modules/file-added-0.js') }),
514-
test({ options: unusedExportsOptions,
632+
filename: testFilePath('./no-unused-modules/file-added-0.js'),
633+
}),
634+
test({
635+
options: unusedExportsOptions,
515636
code: 'const m0 = 5; const m = 10; export { m0 as m1, m }; export default () => {}',
516-
filename: testFilePath('./no-unused-modules/file-m.js') }),
637+
filename: testFilePath('./no-unused-modules/file-m.js'),
638+
}),
517639
],
518640
invalid: [],
519641
});
@@ -522,49 +644,62 @@ describe('test behavior for new file', () => {
522644
ruleTester.run('no-unused-modules', rule, {
523645
valid: [],
524646
invalid: [
525-
test({ options: unusedExportsOptions,
647+
test({
648+
options: unusedExportsOptions,
526649
code: `export default () => {2}`,
527650
filename: testFilePath('./no-unused-modules/file-added-0.js'),
528-
errors: [error(`exported declaration 'default' not used within other modules`)] }),
651+
errors: [error(`exported declaration 'default' not used within other modules`)],
652+
}),
529653
],
530654
});
531655

532656
ruleTester.run('no-unused-modules', rule, {
533657
valid: [
534-
test({ options: unusedExportsOptions,
658+
test({
659+
options: unusedExportsOptions,
535660
code: `import def from '${testFilePath('./no-unused-modules/file-added-0.js')}'`,
536-
filename: testFilePath('./no-unused-modules/file-0.js') }),
537-
test({ options: unusedExportsOptions,
661+
filename: testFilePath('./no-unused-modules/file-0.js'),
662+
}),
663+
test({
664+
options: unusedExportsOptions,
538665
code: `export default () => {}`,
539-
filename: testFilePath('./no-unused-modules/file-added-0.js') }),
666+
filename: testFilePath('./no-unused-modules/file-added-0.js'),
667+
}),
540668
],
541669
invalid: [],
542670
});
543671

544672
// export * only considers named imports. default imports still need to be reported
545673
ruleTester.run('no-unused-modules', rule, {
546674
valid: [
547-
test({ options: unusedExportsOptions,
675+
test({
676+
options: unusedExportsOptions,
548677
code: `export * from '${testFilePath('./no-unused-modules/file-added-0.js')}'`,
549-
filename: testFilePath('./no-unused-modules/file-0.js') }),
678+
filename: testFilePath('./no-unused-modules/file-0.js'),
679+
}),
550680
// Test export * from 'external-compiled-library'
551-
test({ options: unusedExportsOptions,
681+
test({
682+
options: unusedExportsOptions,
552683
code: `export * from 'external-compiled-library'`,
553684
filename: testFilePath('./no-unused-modules/file-r.js'),
554685
}),
555686
],
556687
invalid: [
557-
test({ options: unusedExportsOptions,
688+
test({
689+
options: unusedExportsOptions,
558690
code: `export const z = 'z';export default () => {}`,
559691
filename: testFilePath('./no-unused-modules/file-added-0.js'),
560-
errors: [error(`exported declaration 'default' not used within other modules`)] }),
692+
errors: [error(`exported declaration 'default' not used within other modules`)],
693+
}),
561694
],
562695
});
563696
ruleTester.run('no-unused-modules', rule, {
564697
valid: [
565-
test({ options: unusedExportsOptions,
698+
test({
699+
options: unusedExportsOptions,
566700
code: `export const a = 2`,
567-
filename: testFilePath('./no-unused-modules/file-added-0.js') }),
701+
filename: testFilePath('./no-unused-modules/file-added-0.js'),
702+
}),
568703
],
569704
invalid: [],
570705
});
@@ -573,17 +708,21 @@ describe('test behavior for new file', () => {
573708
ruleTester.run('no-unused-modules', rule, {
574709
valid: [],
575710
invalid: [
576-
test({ options: unusedExportsOptions,
711+
test({
712+
options: unusedExportsOptions,
577713
code: `export { a } from '${testFilePath('./no-unused-modules/file-added-0.js')}'`,
578714
filename: testFilePath('./no-unused-modules/file-0.js'),
579-
errors: [error(`exported declaration 'a' not used within other modules`)] }),
580-
test({ options: unusedExportsOptions,
715+
errors: [error(`exported declaration 'a' not used within other modules`)],
716+
}),
717+
test({
718+
options: unusedExportsOptions,
581719
code: `export const z = 'z';export default () => {}`,
582720
filename: testFilePath('./no-unused-modules/file-added-0.js'),
583721
errors: [
584722
error(`exported declaration 'z' not used within other modules`),
585723
error(`exported declaration 'default' not used within other modules`),
586-
] }),
724+
],
725+
}),
587726
],
588727
});
589728

@@ -594,15 +733,19 @@ describe('test behavior for new file', () => {
594733
});
595734
ruleTester.run('no-unused-modules', rule, {
596735
valid: [
597-
test({ options: unusedExportsOptions,
736+
test({
737+
options: unusedExportsOptions,
598738
code: `export * from '${testFilePath('./no-unused-modules/file-added-1.js')}'`,
599-
filename: testFilePath('./no-unused-modules/file-0.js') }),
739+
filename: testFilePath('./no-unused-modules/file-0.js'),
740+
}),
600741
],
601742
invalid: [
602-
test({ options: unusedExportsOptions,
743+
test({
744+
options: unusedExportsOptions,
603745
code: `export const z = 'z';export default () => {}`,
604746
filename: testFilePath('./no-unused-modules/file-added-1.js'),
605-
errors: [error(`exported declaration 'default' not used within other modules`)] }),
747+
errors: [error(`exported declaration 'default' not used within other modules`)],
748+
}),
606749
],
607750
});
608751
after(() => {
@@ -625,12 +768,16 @@ describe('test behavior for new file', () => {
625768
});
626769
ruleTester.run('no-unused-modules', rule, {
627770
valid: [
628-
test({ options: unusedExportsOptions,
771+
test({
772+
options: unusedExportsOptions,
629773
code: `import added from '${testFilePath('./no-unused-modules/file-added-2.js')}'`,
630-
filename: testFilePath('./no-unused-modules/file-added-1.js') }),
631-
test({ options: unusedExportsOptions,
774+
filename: testFilePath('./no-unused-modules/file-added-1.js'),
775+
}),
776+
test({
777+
options: unusedExportsOptions,
632778
code: `export default () => {}`,
633-
filename: testFilePath('./no-unused-modules/file-added-2.js') }),
779+
filename: testFilePath('./no-unused-modules/file-added-2.js'),
780+
}),
634781
],
635782
invalid: [],
636783
});
@@ -647,12 +794,16 @@ describe('test behavior for new file', () => {
647794
});
648795
ruleTester.run('no-unused-modules', rule, {
649796
valid: [
650-
test({ options: unusedExportsOptions,
797+
test({
798+
options: unusedExportsOptions,
651799
code: `import { added } from '${testFilePath('./no-unused-modules/file-added-3.js')}'`,
652-
filename: testFilePath('./no-unused-modules/file-added-1.js') }),
653-
test({ options: unusedExportsOptions,
800+
filename: testFilePath('./no-unused-modules/file-added-1.js'),
801+
}),
802+
test({
803+
options: unusedExportsOptions,
654804
code: `export const added = () => {}`,
655-
filename: testFilePath('./no-unused-modules/file-added-3.js') }),
805+
filename: testFilePath('./no-unused-modules/file-added-3.js'),
806+
}),
656807
],
657808
invalid: [],
658809
});
@@ -666,18 +817,24 @@ describe('test behavior for new file', () => {
666817
describe('test behavior for destructured exports', () => {
667818
ruleTester.run('no-unused-modules', rule, {
668819
valid: [
669-
test({ options: unusedExportsOptions,
820+
test({
821+
options: unusedExportsOptions,
670822
code: `import { destructured } from '${testFilePath('./no-unused-modules/file-destructured-1.js')}'`,
671-
filename: testFilePath('./no-unused-modules/file-destructured-2.js') }),
672-
test({ options: unusedExportsOptions,
823+
filename: testFilePath('./no-unused-modules/file-destructured-2.js'),
824+
}),
825+
test({
826+
options: unusedExportsOptions,
673827
code: `export const { destructured } = {};`,
674-
filename: testFilePath('./no-unused-modules/file-destructured-1.js') }),
828+
filename: testFilePath('./no-unused-modules/file-destructured-1.js'),
829+
}),
675830
],
676831
invalid: [
677-
test({ options: unusedExportsOptions,
832+
test({
833+
options: unusedExportsOptions,
678834
code: `export const { destructured2 } = {};`,
679835
filename: testFilePath('./no-unused-modules/file-destructured-1.js'),
680-
errors: [`exported declaration 'destructured2' not used within other modules`] }),
836+
errors: [`exported declaration 'destructured2' not used within other modules`],
837+
}),
681838
],
682839
});
683840
});
@@ -688,12 +845,16 @@ describe('test behavior for new file', () => {
688845
});
689846
ruleTester.run('no-unused-modules', rule, {
690847
valid: [
691-
test({ options: unusedExportsOptions,
848+
test({
849+
options: unusedExportsOptions,
692850
code: `import * as added from '${testFilePath('./no-unused-modules/file-added-4.js.js')}'`,
693-
filename: testFilePath('./no-unused-modules/file-added-1.js') }),
694-
test({ options: unusedExportsOptions,
851+
filename: testFilePath('./no-unused-modules/file-added-1.js'),
852+
}),
853+
test({
854+
options: unusedExportsOptions,
695855
code: `export const added = () => {}; export default () => {}`,
696-
filename: testFilePath('./no-unused-modules/file-added-4.js.js') }),
856+
filename: testFilePath('./no-unused-modules/file-added-4.js.js'),
857+
}),
697858
],
698859
invalid: [],
699860
});
@@ -707,13 +868,15 @@ describe('test behavior for new file', () => {
707868
describe('do not report missing export for ignored file', () => {
708869
ruleTester.run('no-unused-modules', rule, {
709870
valid: [
710-
test({ options: [{
711-
src: [testFilePath('./no-unused-modules/**/*.js')],
712-
ignoreExports: [testFilePath('./no-unused-modules/*ignored*.js')],
713-
missingExports: true,
714-
}],
715-
code: 'export const test = true',
716-
filename: testFilePath('./no-unused-modules/file-ignored-a.js') }),
871+
test({
872+
options: [{
873+
src: [testFilePath('./no-unused-modules/**/*.js')],
874+
ignoreExports: [testFilePath('./no-unused-modules/*ignored*.js')],
875+
missingExports: true,
876+
}],
877+
code: 'export const test = true',
878+
filename: testFilePath('./no-unused-modules/file-ignored-a.js'),
879+
}),
717880
],
718881
invalid: [],
719882
});
@@ -722,47 +885,63 @@ describe('do not report missing export for ignored file', () => {
722885
// lint file not available in `src`
723886
ruleTester.run('no-unused-modules', rule, {
724887
valid: [
725-
test({ options: unusedExportsOptions,
888+
test({
889+
options: unusedExportsOptions,
726890
code: `export const jsxFoo = 'foo'; export const jsxBar = 'bar'`,
727-
filename: testFilePath('../jsx/named.jsx') }),
891+
filename: testFilePath('../jsx/named.jsx'),
892+
}),
728893
],
729894
invalid: [],
730895
});
731896

732897
describe('do not report unused export for files mentioned in package.json', () => {
733898
ruleTester.run('no-unused-modules', rule, {
734899
valid: [
735-
test({ options: unusedExportsOptions,
900+
test({
901+
options: unusedExportsOptions,
736902
code: 'export const bin = "bin"',
737-
filename: testFilePath('./no-unused-modules/bin.js') }),
738-
test({ options: unusedExportsOptions,
903+
filename: testFilePath('./no-unused-modules/bin.js'),
904+
}),
905+
test({
906+
options: unusedExportsOptions,
739907
code: 'export const binObject = "binObject"',
740-
filename: testFilePath('./no-unused-modules/binObject/index.js') }),
741-
test({ options: unusedExportsOptions,
908+
filename: testFilePath('./no-unused-modules/binObject/index.js'),
909+
}),
910+
test({
911+
options: unusedExportsOptions,
742912
code: 'export const browser = "browser"',
743-
filename: testFilePath('./no-unused-modules/browser.js') }),
744-
test({ options: unusedExportsOptions,
913+
filename: testFilePath('./no-unused-modules/browser.js'),
914+
}),
915+
test({
916+
options: unusedExportsOptions,
745917
code: 'export const browserObject = "browserObject"',
746-
filename: testFilePath('./no-unused-modules/browserObject/index.js') }),
747-
test({ options: unusedExportsOptions,
918+
filename: testFilePath('./no-unused-modules/browserObject/index.js'),
919+
}),
920+
test({
921+
options: unusedExportsOptions,
748922
code: 'export const main = "main"',
749-
filename: testFilePath('./no-unused-modules/main/index.js') }),
923+
filename: testFilePath('./no-unused-modules/main/index.js'),
924+
}),
750925
],
751926
invalid: [
752-
test({ options: unusedExportsOptions,
927+
test({
928+
options: unusedExportsOptions,
753929
code: 'export const privatePkg = "privatePkg"',
754930
filename: testFilePath('./no-unused-modules/privatePkg/index.js'),
755-
errors: [error(`exported declaration 'privatePkg' not used within other modules`)] }),
931+
errors: [error(`exported declaration 'privatePkg' not used within other modules`)],
932+
}),
756933
],
757934
});
758935
});
759936

760937
describe('Avoid errors if re-export all from umd compiled library', () => {
761938
ruleTester.run('no-unused-modules', rule, {
762939
valid: [
763-
test({ options: unusedExportsOptions,
940+
test({
941+
options: unusedExportsOptions,
764942
code: `export * from '${testFilePath('./no-unused-modules/bin.js')}'`,
765-
filename: testFilePath('./no-unused-modules/main/index.js') }),
943+
filename: testFilePath('./no-unused-modules/main/index.js'),
944+
}),
766945
],
767946
invalid: [],
768947
});

0 commit comments

Comments
 (0)
Please sign in to comment.