eslint 6.6.0 → 6.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/README.md +7 -8
  3. package/conf/config-schema.js +2 -0
  4. package/conf/default-cli-options.js +1 -1
  5. package/conf/eslint-recommended.js +0 -1
  6. package/lib/cli-engine/cascading-config-array-factory.js +38 -13
  7. package/lib/cli-engine/cli-engine.js +41 -14
  8. package/lib/cli-engine/config-array/config-array.js +13 -0
  9. package/lib/cli-engine/config-array/extracted-config.js +27 -0
  10. package/lib/cli-engine/config-array/ignore-pattern.js +231 -0
  11. package/lib/cli-engine/config-array/index.js +2 -0
  12. package/lib/cli-engine/config-array-factory.js +115 -1
  13. package/lib/cli-engine/file-enumerator.js +73 -40
  14. package/lib/cli-engine/lint-result-cache.js +2 -1
  15. package/lib/cli.js +2 -1
  16. package/lib/init/config-initializer.js +4 -3
  17. package/lib/linter/config-comment-parser.js +1 -1
  18. package/lib/linter/report-translator.js +73 -7
  19. package/lib/options.js +6 -0
  20. package/lib/rule-tester/rule-tester.js +42 -6
  21. package/lib/rules/array-bracket-spacing.js +8 -8
  22. package/lib/rules/camelcase.js +19 -6
  23. package/lib/rules/comma-dangle.js +5 -2
  24. package/lib/rules/computed-property-spacing.js +4 -4
  25. package/lib/rules/curly.js +9 -4
  26. package/lib/rules/function-call-argument-newline.js +3 -1
  27. package/lib/rules/grouped-accessor-pairs.js +224 -0
  28. package/lib/rules/indent.js +11 -0
  29. package/lib/rules/index.js +5 -0
  30. package/lib/rules/key-spacing.js +34 -15
  31. package/lib/rules/lines-between-class-members.js +42 -53
  32. package/lib/rules/multiline-comment-style.js +237 -106
  33. package/lib/rules/no-cond-assign.js +14 -4
  34. package/lib/rules/no-constructor-return.js +62 -0
  35. package/lib/rules/no-dupe-else-if.js +122 -0
  36. package/lib/rules/no-implicit-globals.js +90 -8
  37. package/lib/rules/no-inline-comments.js +25 -11
  38. package/lib/rules/no-invalid-this.js +16 -2
  39. package/lib/rules/no-multiple-empty-lines.js +1 -1
  40. package/lib/rules/no-octal-escape.js +1 -1
  41. package/lib/rules/no-restricted-imports.js +2 -2
  42. package/lib/rules/no-setter-return.js +227 -0
  43. package/lib/rules/no-underscore-dangle.js +23 -4
  44. package/lib/rules/no-unexpected-multiline.js +8 -0
  45. package/lib/rules/no-unsafe-negation.js +30 -5
  46. package/lib/rules/no-useless-computed-key.js +60 -33
  47. package/lib/rules/no-useless-escape.js +26 -3
  48. package/lib/rules/object-curly-spacing.js +8 -8
  49. package/lib/rules/operator-assignment.js +11 -2
  50. package/lib/rules/prefer-const.js +14 -7
  51. package/lib/rules/prefer-exponentiation-operator.js +189 -0
  52. package/lib/rules/prefer-numeric-literals.js +29 -28
  53. package/lib/rules/require-atomic-updates.js +1 -1
  54. package/lib/rules/require-await.js +8 -0
  55. package/lib/rules/semi.js +6 -3
  56. package/lib/rules/space-infix-ops.js +1 -1
  57. package/lib/rules/spaced-comment.js +5 -4
  58. package/lib/rules/utils/ast-utils.js +31 -4
  59. package/lib/shared/types.js +9 -0
  60. package/lib/source-code/source-code.js +87 -10
  61. package/package.json +4 -3
  62. package/lib/cli-engine/ignored-paths.js +0 -363
package/CHANGELOG.md CHANGED
@@ -1,3 +1,97 @@
1
+ v6.8.0 - December 20, 2019
2
+
3
+ * [`c5c7086`](https://github.com/eslint/eslint/commit/c5c708666b450fb69522a55aa375626f9297dc6f) Fix: ignore aligning single line in key-spacing (fixes #11414) (#12652) (YeonJuan)
4
+ * [`9986d9e`](https://github.com/eslint/eslint/commit/9986d9e0baed0d3586bbee472fe2fae2ed625f5d) Chore: add object option test cases in yield-star-spacing (#12679) (YeonJuan)
5
+ * [`1713d07`](https://github.com/eslint/eslint/commit/1713d0758b083f3840d724505f997a7cb20ff384) New: Add no-error-on-unmatched-pattern flag (fixes #10587) (#12377) (ncraley)
6
+ * [`5c25a26`](https://github.com/eslint/eslint/commit/5c25a26608fbd9a1d0127c9a3653609aa4b63e86) Update: autofix bug in lines-between-class-members (fixes #12391) (#12632) (YeonJuan)
7
+ * [`4b3cc5c`](https://github.com/eslint/eslint/commit/4b3cc5cd2459f04eae149faea0651785d7f9db0b) Chore: enable prefer-regex-literals in eslint codebase (#12268) (薛定谔的猫)
8
+ * [`05faebb`](https://github.com/eslint/eslint/commit/05faebb943456ad2b20117f3c8b3eccbe2e2fb03) Update: improve suggestion testing experience (#12602) (Brad Zacher)
9
+ * [`05f7dd5`](https://github.com/eslint/eslint/commit/05f7dd53ed91a6e3be9eb40825fb6d2207f82209) Update: Add suggestions for no-unsafe-negation (fixes #12591) (#12609) (Milos Djermanovic)
10
+ * [`d3e43f1`](https://github.com/eslint/eslint/commit/d3e43f1c10c5e19f40e7b3d3944b87f1b0c9c075) Docs: Update no-multi-assign explanation (#12615) (Yuping Zuo)
11
+ * [`272e4db`](https://github.com/eslint/eslint/commit/272e4db6074283bc01cc6ec72c9e396bb3c110e6) Fix: no-multiple-empty-lines: Adjust reported `loc` (#12594) (Tobias Bieniek)
12
+ * [`a258039`](https://github.com/eslint/eslint/commit/a258039e556075d7d1f955a79d094ea103ec165a) Fix: no-restricted-imports schema allows multiple paths/patterns objects (#12639) (Milos Djermanovic)
13
+ * [`51f9620`](https://github.com/eslint/eslint/commit/51f9620cc55cc091fe38dbe68e4633de06297b8c) Fix: improve report location for array-bracket-spacing (#12653) (Milos Djermanovic)
14
+ * [`45364af`](https://github.com/eslint/eslint/commit/45364afc9c7f0251348cd1a7a13656c3816435d7) Fix: prefer-numeric-literals doesn't check types of literal arguments (#12655) (Milos Djermanovic)
15
+ * [`e3c570e`](https://github.com/eslint/eslint/commit/e3c570eaf3d1d44fb57bf42f1870887856e4c5a0) Docs: Add example for expression option (#12694) (Arnaud Barré)
16
+ * [`6b774ef`](https://github.com/eslint/eslint/commit/6b774ef0d849ccf5c1127b25e1fe7c3e438d586b) Docs: Add spacing in comments for no-console rule (#12696) (Nikki Nikkhoui)
17
+ * [`7171fca`](https://github.com/eslint/eslint/commit/7171fca6ef4e0e8f267658fc7d8f603f00eddd84) Chore: refactor regex in config comment parser (#12662) (Milos Djermanovic)
18
+ * [`1600648`](https://github.com/eslint/eslint/commit/1600648d2880ffb1e9e414b31ff0f66ead7167f9) Update: Allow $schema in config (#12612) (Yordis Prieto)
19
+ * [`acc0e47`](https://github.com/eslint/eslint/commit/acc0e47572a9390292b4e313b4a4bf360d236358) Update: support .eslintrc.cjs (refs eslint/rfcs#43) (#12321) (Evan Plaice)
20
+ * [`49c1658`](https://github.com/eslint/eslint/commit/49c1658544ace24b9aaaa301af0fc07a2ef3bf30) Chore: remove bundling of ESLint during release (#12676) (Kai Cataldo)
21
+ * [`257f3d6`](https://github.com/eslint/eslint/commit/257f3d67905a52bf8602a5a5707c893cc90d7ca7) Chore: complete to move to GitHub Actions (#12625) (Toru Nagashima)
22
+ * [`ab912f0`](https://github.com/eslint/eslint/commit/ab912f0ef709a916ab9a27ea09d9d7adf046fb2d) Docs: 1tbs with allowSingleLine edge cases (refs #12284) (#12314) (Ari Kardasis)
23
+ * [`dd1c30e`](https://github.com/eslint/eslint/commit/dd1c30e35f05ed332e2abbd3d4d53635efde74b8) Sponsors: Sync README with website (ESLint Jenkins)
24
+ * [`a230f84`](https://github.com/eslint/eslint/commit/a230f8404e4f2423dd79378b065d24c12776775b) Update: include node version in cache (#12582) (Eric Wang)
25
+ * [`8b65f17`](https://github.com/eslint/eslint/commit/8b65f175dfb4fac11ed7184537be400ed14996fb) Chore: remove references to parser demo (#12644) (Kai Cataldo)
26
+ * [`e9cef99`](https://github.com/eslint/eslint/commit/e9cef99e6ebec1faefdb576ca597e81ae4f04afd) Docs: wrap {{}} in raw liquid tags to prevent interpolation (#12643) (Kai Cataldo)
27
+ * [`e707453`](https://github.com/eslint/eslint/commit/e70745325ff9e085acc6843dd8bfae5550645d4f) Docs: Fix configuration example in no-restricted-imports (fixes #11717) (#12638) (Milos Djermanovic)
28
+ * [`19194ce`](https://github.com/eslint/eslint/commit/19194cec724e016df02376bbeae31171be6f0bdf) Chore: Add tests to cover default object options in comma-dangle (#12627) (YeonJuan)
29
+ * [`6e36d12`](https://github.com/eslint/eslint/commit/6e36d12d95e76022172fd0ec8a5e85c22fde6a8a) Update: do not recommend require-atomic-updates (refs #11899) (#12599) (Kai Cataldo)
30
+
31
+ v6.7.2 - November 30, 2019
32
+
33
+ * [`bc435a9`](https://github.com/eslint/eslint/commit/bc435a93afd6ba4def1b53993ef7cf8220f3f070) Fix: isSpaceBetweenTokens() recognizes spaces in JSXText (fixes #12614) (#12616) (Toru Nagashima)
34
+ * [`4928d51`](https://github.com/eslint/eslint/commit/4928d513b4fe716c7ed958c294a10ef8517be25e) Fix: don't ignore the entry directory (fixes #12604) (#12607) (Toru Nagashima)
35
+ * [`b41677a`](https://github.com/eslint/eslint/commit/b41677ae2a143790b19b0e70391a46ec6c8f5de1) Docs: Clarify suggestion's data in Working with Rules (refs #12606) (#12617) (Milos Djermanovic)
36
+ * [`ea16de4`](https://github.com/eslint/eslint/commit/ea16de4e7c6f661398b0b7843f95e5f307c89551) Fix: Support tagged template literal generics in no-unexpected-multiline (#11698) (Brad Zacher)
37
+ * [`fa6415d`](https://github.com/eslint/eslint/commit/fa6415d5b877370374a6a530a5190ab5a411b4dc) Sponsors: Sync README with website (ESLint Jenkins)
38
+ * [`e1e158b`](https://github.com/eslint/eslint/commit/e1e158b4d7bd61e812723b378d2c391295da43a5) Sponsors: Sync README with website (ESLint Jenkins)
39
+
40
+ v6.7.1 - November 24, 2019
41
+
42
+ * [`dd1e9f4`](https://github.com/eslint/eslint/commit/dd1e9f4df2103c43509a54b0ad5f9106557997f9) Fix: revert changes to key-spacing due to regression (#12598) (Kai Cataldo)
43
+ * [`c644b54`](https://github.com/eslint/eslint/commit/c644b5429e5bc8a050afd70c99ec82035eb611fa) Docs: Update README team and sponsors (ESLint Jenkins)
44
+
45
+ v6.7.0 - November 22, 2019
46
+
47
+ * [`312a88f`](https://github.com/eslint/eslint/commit/312a88f2230082d898b7d8d82f8af63cb352e55a) New: Add grouped-accessor-pairs rule (fixes #12277) (#12331) (Milos Djermanovic)
48
+ * [`5c68f5f`](https://github.com/eslint/eslint/commit/5c68f5feeb4a6c0cb53ff76b2fd255b5bfa69c93) Update: Add 'lexicalBindings' to no-implicit-globals and change messages (#11996) (Milos Djermanovic)
49
+ * [`6eaad96`](https://github.com/eslint/eslint/commit/6eaad964ff159d0a38de96c1104782ffe6858c78) New: Add suggestions API (#12384) (Will Douglas)
50
+ * [`b336fbe`](https://github.com/eslint/eslint/commit/b336fbedecd85731611fdc2dfd8edb635a8b1c39) Fix: indent rule with JSX spread props (#12581) (Nathan Woltman)
51
+ * [`97c745d`](https://github.com/eslint/eslint/commit/97c745dc277febbea82552a4d9186e3df847f860) Update: Report assignment expression location in no-cond-assign (#12465) (Milos Djermanovic)
52
+ * [`0f01f3d`](https://github.com/eslint/eslint/commit/0f01f3d0807c580631c2fdcff29192a64a870637) Update: Check member expressions with `this` in operator-assignment (#12495) (Milos Djermanovic)
53
+ * [`62c7038`](https://github.com/eslint/eslint/commit/62c7038a493d89e4a7b14ac673a063d09d04057b) Fix: invalid token checking in computed-property-spacing (fixes #12198) (#12533) (YeonJuan)
54
+ * [`4f8a1ee`](https://github.com/eslint/eslint/commit/4f8a1ee1c26ccb5882e5e83ea7eab2f406c7476b) Update: Add enforceForClassMembers option to no-useless-computed-key (#12110) (ark120202)
55
+ * [`1a2eb99`](https://github.com/eslint/eslint/commit/1a2eb99f11c65813bba11d6576a06cff2b823cc9) New: new rule no-constructor-return (fixes #12481) (#12529) (Pig Fang)
56
+ * [`ca3b2a6`](https://github.com/eslint/eslint/commit/ca3b2a62c9e829dc4534bca3643d6bc729b46df0) New: ignorePatterns in config files (refs eslint/rfcs#22) (#12274) (Toru Nagashima)
57
+ * [`60204a3`](https://github.com/eslint/eslint/commit/60204a3620e33a078c1c35fa2e5d839a16c627ff) Docs: Added another Textmate 2 bundle. (#12580) (Ryan Fitzer)
58
+ * [`62623f9`](https://github.com/eslint/eslint/commit/62623f9f611a3adb79696304760a2fd14be8afbc) Fix: preserve whitespace in multiline-comment-style (fixes #12312) (#12316) (Kai Cataldo)
59
+ * [`17a8849`](https://github.com/eslint/eslint/commit/17a8849491a983f6cb8e98da8c0c9d52ff5f2aa6) New: Add no-dupe-else-if rule (fixes #12469) (#12504) (Milos Djermanovic)
60
+ * [`41a78fd`](https://github.com/eslint/eslint/commit/41a78fd7ce245cad8ff6a96c42f5840688849427) Update: improve location for semi and comma-dangle (#12380) (Chiawen Chen)
61
+ * [`0a480f8`](https://github.com/eslint/eslint/commit/0a480f8307a0e438032f484254941e6426748143) Docs: Change "Code Conventions" link in pull-requests.md (#12401) (Denis Sikuler)
62
+ * [`fed20bb`](https://github.com/eslint/eslint/commit/fed20bb039cf9f53adfcf93e467f418c5e958f45) Fix: require-await crash on global await (#12571) (Brad Zacher)
63
+ * [`b8030fc`](https://github.com/eslint/eslint/commit/b8030fc23e88f57a04d955b3befd1ab0fc2c5d10) Update: deprecate personal config (fixes #11914, refs eslint/rfcs#32) (#12426) (Toru Nagashima)
64
+ * [`40c8c32`](https://github.com/eslint/eslint/commit/40c8c3264c7c383d98c9faf9c4cb4f8b75aee40f) Fix: improve report location for object-curly-spacing (#12563) (Milos Djermanovic)
65
+ * [`1110045`](https://github.com/eslint/eslint/commit/1110045e0d28a461e75d2f57d5f01533d59ef239) Fix: ignore marker-only comments in spaced-comment (fixes #12036) (#12558) (Milos Djermanovic)
66
+ * [`6503cb8`](https://github.com/eslint/eslint/commit/6503cb8d99e549fece53b80b110e890a7978b9fd) Update: Fix uglified object align in key-spacing (fixes #11414) (#12472) (YeonJuan)
67
+ * [`40791af`](https://github.com/eslint/eslint/commit/40791af69efde1701690637603ad37d41e15a727) Docs: clarify ignoreDestructuring option in the camelcase rule (#12553) (Milos Djermanovic)
68
+ * [`07d398d`](https://github.com/eslint/eslint/commit/07d398d91d5b6d0247e58b1f8ea64bb5acd570a8) Chore: Add GitHub organization to Sponsor button (#12562) (Brandon Mills)
69
+ * [`a477707`](https://github.com/eslint/eslint/commit/a47770706ac59633dcd73e886d1a7282b324ee06) Chore: Format style guide links so they can be clicked (#12189) (Ivan V)
70
+ * [`0f7edef`](https://github.com/eslint/eslint/commit/0f7edefdc1576d5e3e7ef89083002b0a4a31f039) Update: add react plugin config for eslint init (#12446) (Ibrahim Rouis)
71
+ * [`448ff1e`](https://github.com/eslint/eslint/commit/448ff1e53734c503fb9e7e6802c1c7e441d4c019) Update: Report '\08' and '\09' in no-octal-escape (fixes #12080) (#12526) (Milos Djermanovic)
72
+ * [`45aa6a3`](https://github.com/eslint/eslint/commit/45aa6a3ba3486f1b116c5daab6432d144e5ea574) New: Add no-setter-return rule (fixes #12285) (#12346) (Milos Djermanovic)
73
+ * [`0afb518`](https://github.com/eslint/eslint/commit/0afb518d1f139376245613dddd8eaef32b52d619) Fix: invalid autofix in function-call-argument-newline (fixes #12454) (#12539) (YeonJuan)
74
+ * [`90305e0`](https://github.com/eslint/eslint/commit/90305e017c2c5fba0b4b62f41b180910b4baeedb) Update: Depcrecate isSpaceBetweenTokens() (#12519) (Kai Cataldo)
75
+ * [`41b1e43`](https://github.com/eslint/eslint/commit/41b1e4308c1cb01c8b00cc8adc36440e77854117) New: add option for camelcase (fixes #12527) (#12528) (Pig Fang)
76
+ * [`f49f1e0`](https://github.com/eslint/eslint/commit/f49f1e0a69afa49f6548af7b2c0e6347e1ea022d) Upgrade: upgrade optionator to avoid license issue (fixes #11536) (#12537) (Pig Fang)
77
+ * [`0286b57`](https://github.com/eslint/eslint/commit/0286b5730501b391c74e069db46849f0de0885d2) Docs: Clean up Getting Started Guide (#12544) (Nicholas C. Zakas)
78
+ * [`575a98d`](https://github.com/eslint/eslint/commit/575a98d724b2688f1e9c83744c5dc9ffe9a7bfb4) Chore: Add funding field to package.json (#12543) (Nicholas C. Zakas)
79
+ * [`9e29e18`](https://github.com/eslint/eslint/commit/9e29e189752f06362fd1956659e07834efb746a5) Fix: sourceCode#isSpaceBetweenTokens() checks non-adjacent tokens (#12491) (Kai Cataldo)
80
+ * [`5868550`](https://github.com/eslint/eslint/commit/586855060afb3201f4752be8820dc85703b523a6) Docs: add notice about `function` keyword in keyword-spacing (#12524) (Pig Fang)
81
+ * [`bb556d5`](https://github.com/eslint/eslint/commit/bb556d5fd735ad2dcea322082edcc07a58105ce9) Fix: curly `multi` reports single lexical declarations (fixes #11908) (#12513) (Milos Djermanovic)
82
+ * [`ac60621`](https://github.com/eslint/eslint/commit/ac606217d4beebc35b865d14a7f9723fd21faa48) Fix: unexpected autofix in prefer-const (fixes #12514) (#12521) (YeonJuan)
83
+ * [`990065e`](https://github.com/eslint/eslint/commit/990065e5f58b6cc6922ab6cee5b97bfc56a6237a) Update: curly multi-or-nest flagging semis on next line (fixes #12370) (#12378) (cherryblossom000)
84
+ * [`084a8a6`](https://github.com/eslint/eslint/commit/084a8a63a749232681fefe9bdac6802efdcdc8a8) Fix: no-cond-assign with `always` option reports switch case clauses (#12470) (Milos Djermanovic)
85
+ * [`7e41355`](https://github.com/eslint/eslint/commit/7e41355b19a8ef347620dd7c0dde491c3460937b) Update: improve report location for space-infix-ops (#12324) (Chiawen Chen)
86
+ * [`94ff921`](https://github.com/eslint/eslint/commit/94ff921689115f856578159564ee1968b4b914be) Update: Add capIsConstructor option to no-invalid-this (fixes #12271) (#12308) (Milos Djermanovic)
87
+ * [`de65de6`](https://github.com/eslint/eslint/commit/de65de6e488112a602949e6a5d27dd4c754b003c) New: Add prefer-exponentiation-operator rule (fixes #10482) (#12360) (Milos Djermanovic)
88
+ * [`c78f4a7`](https://github.com/eslint/eslint/commit/c78f4a73de68f81cd41132b46d4840b91599d599) Update: Allow JSX exception in no-inline-comments (fixes #11270) (#12388) (Milos Djermanovic)
89
+ * [`e17fb90`](https://github.com/eslint/eslint/commit/e17fb90f5817d16081e690eb06b7720afcb9fa2a) New: allowAfterThisConstructor for no-underscore-dangle (fixes #11488) (#11489) (sripberger)
90
+ * [`287ca56`](https://github.com/eslint/eslint/commit/287ca562811d037bde09a47af7f5b9c7b741e022) Build: update CI for Node.js 13 (#12496) (Toru Nagashima)
91
+ * [`98e1d50`](https://github.com/eslint/eslint/commit/98e1d50273f31c2a7b59772298280ed7305274c8) Upgrade: globals to v12.1.0 (#12296) (Tony Brix)
92
+ * [`8ac71a3`](https://github.com/eslint/eslint/commit/8ac71a3c89a9db13706a44b23d1b509b65185113) Sponsors: Sync README with website (ESLint Jenkins)
93
+ * [`4e142ea`](https://github.com/eslint/eslint/commit/4e142ea411dfb692b6e2a69cd5f1204ade4dd58a) Docs: Update README team and sponsors (ESLint Jenkins)
94
+
1
95
  v6.6.0 - October 25, 2019
2
96
 
3
97
  * [`39dfe08`](https://github.com/eslint/eslint/commit/39dfe0880fa934e287e8ea1f7b56d5cba8d43765) Update: false positives in function-call-argument-newline (fixes #12123) (#12280) (Scott O'Hara)
package/README.md CHANGED
@@ -1,5 +1,4 @@
1
1
  [![NPM version][npm-image]][npm-url]
2
- [![Build Status](https://dev.azure.com/eslint/eslint/_apis/build/status/eslint.eslint?branchName=master)](https://dev.azure.com/eslint/eslint/_build/latest?definitionId=1&branchName=master)
3
2
  [![Build Status](https://github.com/eslint/eslint/workflows/CI/badge.svg)](https://github.com/eslint/eslint/actions)
4
3
  [![Downloads][downloads-image]][downloads-url]
5
4
  [![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=282608)](https://www.bountysource.com/trackers/282608-eslint?utm_source=282608&utm_medium=shield&utm_campaign=TRACKER_BADGE)
@@ -206,9 +205,9 @@ Brandon Mills
206
205
  Toru Nagashima
207
206
  </a>
208
207
  </td><td align="center" valign="top" width="11%">
209
- <a href="https://github.com/gyandeeps">
210
- <img src="https://github.com/gyandeeps.png?s=75" width="75" height="75"><br />
211
- Gyandeep Singh
208
+ <a href="https://github.com/kaicataldo">
209
+ <img src="https://github.com/kaicataldo.png?s=75" width="75" height="75"><br />
210
+ Kai Cataldo
212
211
  </a>
213
212
  </td><td align="center" valign="top" width="11%">
214
213
  <a href="https://github.com/not-an-aardvark">
@@ -237,9 +236,9 @@ The people who review and implement new features.
237
236
  The people who review and fix bugs and help triage issues.
238
237
 
239
238
  <table><tbody><tr><td align="center" valign="top" width="11%">
240
- <a href="https://github.com/kaicataldo">
241
- <img src="https://github.com/kaicataldo.png?s=75" width="75" height="75"><br />
242
- Kai Cataldo
239
+ <a href="https://github.com/gyandeeps">
240
+ <img src="https://github.com/gyandeeps.png?s=75" width="75" height="75"><br />
241
+ Gyandeep Singh
243
242
  </a>
244
243
  </td><td align="center" valign="top" width="11%">
245
244
  <a href="https://github.com/g-plane">
@@ -265,7 +264,7 @@ The following companies, organizations, and individuals support ESLint's ongoing
265
264
  <h3>Gold Sponsors</h3>
266
265
  <p><a href="https://www.shopify.com"><img src="https://images.opencollective.com/shopify/eeb91aa/logo.png" alt="Shopify" height="96"></a> <a href="http://engineering.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://badoo.com/team?utm_source=eslint"><img src="https://images.opencollective.com/badoo/2826a3b/logo.png" alt="Badoo" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a> <a href="https://opensource.facebook.com"><img src="https://images.opencollective.com/fbopensource/fbb8a5b/logo.png" alt="Facebook Open Source" height="96"></a></p><h3>Silver Sponsors</h3>
267
266
  <p><a href="https://www.ampproject.org/"><img src="https://images.opencollective.com/amp/c8a3b25/logo.png" alt="AMP Project" height="64"></a></p><h3>Bronze Sponsors</h3>
268
- <p><a href="https://uxplanet.org/top-ui-ux-design-agencies-user-experience-firms-8c54697e290"><img src="https://images.opencollective.com/ui-ux-design-agencies/cae5dfe/logo.png" alt="UI UX Design Agencies" height="32"></a> <a href="https://www.bugsnag.com/platforms?utm_source=Open Collective&utm_medium=Website&utm_content=open-source&utm_campaign=2019-community&utm_term="><img src="https://images.opencollective.com/bugsnag-stability-monitoring/c2cef36/logo.png" alt="Bugsnag Stability Monitoring" height="32"></a> <a href="https://www.minitool.com"><img src="https://images.opencollective.com/minitool-software-ltd/6d68e16/logo.png" alt="MiniTool Software Ltd" height="32"></a> <a href="https://www.codacy.com/?utm_source=eslint&utm_medium=cpm&utm_campaign=eslint-sponsorship"><img src="https://images.opencollective.com/codacy/ed22716/logo.png" alt="Codacy" height="32"></a> <a href="https://mixpanel.com"><img src="https://images.opencollective.com/mixpanel/cd682f7/logo.png" alt="Mixpanel" height="32"></a> <a href="https://www.vpsserver.com"><img src="https://images.opencollective.com/vpsservercom/logo.png" alt="VPS Server" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/0b37d14/logo.png" alt="Free Icons by Icons8" height="32"></a> <a href="https://www.crosswordsolver.com"><img src="https://images.opencollective.com/crosswordsolver/d4481d6/logo.png" alt="Crosswordsolver" height="32"></a> <a href="https://clay.global"><img src="https://images.opencollective.com/clayglobal/2468f34/logo.png" alt="clay" height="32"></a> <a href="https://discordapp.com"><img src="https://images.opencollective.com/discordapp/7e3d9a9/logo.png" alt="Discord" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://tekhattan.com"><img src="https://images.opencollective.com/tekhattan/bc73c28/logo.png" alt="TekHattan" height="32"></a> <a href="https://www.marfeel.com/"><img src="https://images.opencollective.com/marfeel/4b88e30/logo.png" alt="Marfeel" height="32"></a> <a href="http://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/b8fbe2c/logo.png" alt="Fire Stick Tricks" height="32"></a> <a href="https://jsheroes.io/"><img src="https://images.opencollective.com/jsheroes1/9fedf0b/logo.png" alt="JSHeroes " height="32"></a></p>
267
+ <p><a href="https://uxplanet.org/top-ui-ux-design-agencies-user-experience-firms-8c54697e290"><img src="https://images.opencollective.com/ui-ux-design-agencies/cae5dfe/logo.png" alt="UI UX Design Agencies" height="32"></a> <a href="https://medium.com/@niksundin/best-web-design-companies-1872e445775f"><img src="https://images.opencollective.com/top-web-design-agencies/d92d747/logo.png" alt="Top Web Design Agencies" height="32"></a> <a href="https://www.bugsnag.com/platforms?utm_source=Open Collective&utm_medium=Website&utm_content=open-source&utm_campaign=2019-community&utm_term="><img src="https://images.opencollective.com/bugsnag-stability-monitoring/c2cef36/logo.png" alt="Bugsnag Stability Monitoring" height="32"></a> <a href="https://www.crosswordsolver.com"><img src="https://images.opencollective.com/crosswordsolver/d4481d6/logo.png" alt="Crosswordsolver" height="32"></a> <a href="https://www.codacy.com/?utm_source=eslint&utm_medium=cpm&utm_campaign=eslint-sponsorship"><img src="https://images.opencollective.com/codacy/ed22716/logo.png" alt="Codacy" height="32"></a> <a href="https://mixpanel.com"><img src="https://images.opencollective.com/mixpanel/cd682f7/logo.png" alt="Mixpanel" height="32"></a> <a href="https://www.vpsserver.com"><img src="https://images.opencollective.com/vpsservercom/logo.png" alt="VPS Server" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/0b37d14/logo.png" alt="Free Icons by Icons8" height="32"></a> <a href="https://edubirdie.com/"><img src="https://images.opencollective.com/edubirdie2/b1d51ab/logo.png" alt="EduBirdie" height="32"></a> <a href="https://clay.global"><img src="https://images.opencollective.com/clayglobal/2468f34/logo.png" alt="clay" height="32"></a> <a href="https://discordapp.com"><img src="https://images.opencollective.com/discordapp/7e3d9a9/logo.png" alt="Discord" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://tekhattan.com"><img src="https://images.opencollective.com/tekhattan/bc73c28/logo.png" alt="TekHattan" height="32"></a> <a href="https://www.marfeel.com/"><img src="https://images.opencollective.com/marfeel/4b88e30/logo.png" alt="Marfeel" height="32"></a> <a href="http://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/b8fbe2c/logo.png" alt="Fire Stick Tricks" height="32"></a> <a href="https://jsheroes.io/"><img src="https://images.opencollective.com/jsheroes1/9fedf0b/logo.png" alt="JSHeroes " height="32"></a></p>
269
268
  <!--sponsorsend-->
270
269
 
271
270
  ## <a name="technology-sponsors"></a>Technology Sponsors
@@ -6,6 +6,7 @@
6
6
  "use strict";
7
7
 
8
8
  const baseConfigProperties = {
9
+ $schema: { type: "string" },
9
10
  env: { type: "object" },
10
11
  extends: { $ref: "#/definitions/stringOrStrings" },
11
12
  globals: { type: "object" },
@@ -55,6 +56,7 @@ const configSchema = {
55
56
  type: "object",
56
57
  properties: {
57
58
  root: { type: "boolean" },
59
+ ignorePatterns: { $ref: "#/definitions/stringOrStrings" },
58
60
  ...baseConfigProperties
59
61
  },
60
62
  additionalProperties: false
@@ -14,7 +14,7 @@ module.exports = {
14
14
  globals: [],
15
15
  extensions: [".js"],
16
16
  ignore: true,
17
- ignorePath: null,
17
+ ignorePath: void 0,
18
18
  cache: false,
19
19
 
20
20
  /*
@@ -62,7 +62,6 @@ module.exports = {
62
62
  "no-useless-catch": "error",
63
63
  "no-useless-escape": "error",
64
64
  "no-with": "error",
65
- "require-atomic-updates": "error",
66
65
  "require-yield": "error",
67
66
  "use-isnan": "error",
68
67
  "valid-typeof": "error"
@@ -27,7 +27,7 @@ const os = require("os");
27
27
  const path = require("path");
28
28
  const { validateConfigArray } = require("../shared/config-validator");
29
29
  const { ConfigArrayFactory } = require("./config-array-factory");
30
- const { ConfigArray, ConfigDependency } = require("./config-array");
30
+ const { ConfigArray, ConfigDependency, IgnorePattern } = require("./config-array");
31
31
  const loadRules = require("./load-rules");
32
32
  const debug = require("debug")("eslint:cascading-config-array-factory");
33
33
 
@@ -45,8 +45,9 @@ const debug = require("debug")("eslint:cascading-config-array-factory");
45
45
  * @typedef {Object} CascadingConfigArrayFactoryOptions
46
46
  * @property {Map<string,Plugin>} [additionalPluginPool] The map for additional plugins.
47
47
  * @property {ConfigData} [baseConfig] The config by `baseConfig` option.
48
- * @property {ConfigData} [cliConfig] The config by CLI options (`--env`, `--global`, `--parser`, `--parser-options`, `--plugin`, and `--rule`). CLI options overwrite the setting in config files.
48
+ * @property {ConfigData} [cliConfig] The config by CLI options (`--env`, `--global`, `--ignore-pattern`, `--parser`, `--parser-options`, `--plugin`, and `--rule`). CLI options overwrite the setting in config files.
49
49
  * @property {string} [cwd] The base directory to start lookup.
50
+ * @property {string} [ignorePath] The path to the alternative file of `.eslintignore`.
50
51
  * @property {string[]} [rulePaths] The value of `--rulesdir` option.
51
52
  * @property {string} [specificConfigPath] The value of `--config` option.
52
53
  * @property {boolean} [useEslintrc] if `false` then it doesn't load config files.
@@ -62,6 +63,7 @@ const debug = require("debug")("eslint:cascading-config-array-factory");
62
63
  * @property {Map<string, ConfigArray>} configCache The cache from directory paths to config arrays.
63
64
  * @property {string} cwd The base directory to start lookup.
64
65
  * @property {WeakMap<ConfigArray, ConfigArray>} finalizeCache The cache from config arrays to finalized config arrays.
66
+ * @property {string} [ignorePath] The path to the alternative file of `.eslintignore`.
65
67
  * @property {string[]|null} rulePaths The value of `--rulesdir` option. This is used to reset `baseConfigArray`.
66
68
  * @property {string|null} specificConfigPath The value of `--config` option. This is used to reset `cliConfigArray`.
67
69
  * @property {boolean} useEslintrc if `false` then it doesn't load config files.
@@ -86,14 +88,22 @@ function createBaseConfigArray({
86
88
  { name: "BaseConfig" }
87
89
  );
88
90
 
91
+ /*
92
+ * Create the config array element for the default ignore patterns.
93
+ * This element has `ignorePattern` property that ignores the default
94
+ * patterns in the current working directory.
95
+ */
96
+ baseConfigArray.unshift(configArrayFactory.create(
97
+ { ignorePatterns: IgnorePattern.DefaultPatterns },
98
+ { name: "DefaultIgnorePattern" }
99
+ )[0]);
100
+
101
+ /*
102
+ * Load rules `--rulesdir` option as a pseudo plugin.
103
+ * Use a pseudo plugin to define rules of `--rulesdir`, so we can validate
104
+ * the rule's options with only information in the config array.
105
+ */
89
106
  if (rulePaths && rulePaths.length > 0) {
90
-
91
- /*
92
- * Load rules `--rulesdir` option as a pseudo plugin.
93
- * Use a pseudo plugin to define rules of `--rulesdir`, so we can
94
- * validate the rule's options with only information in the config
95
- * array.
96
- */
97
107
  baseConfigArray.push({
98
108
  name: "--rulesdir",
99
109
  filePath: "",
@@ -128,6 +138,7 @@ function createBaseConfigArray({
128
138
  function createCLIConfigArray({
129
139
  cliConfigData,
130
140
  configArrayFactory,
141
+ ignorePath,
131
142
  specificConfigPath
132
143
  }) {
133
144
  const cliConfigArray = configArrayFactory.create(
@@ -135,6 +146,12 @@ function createCLIConfigArray({
135
146
  { name: "CLIOptions" }
136
147
  );
137
148
 
149
+ cliConfigArray.unshift(
150
+ ...(ignorePath
151
+ ? configArrayFactory.loadESLintIgnore(ignorePath)
152
+ : configArrayFactory.loadDefaultESLintIgnore())
153
+ );
154
+
138
155
  if (specificConfigPath) {
139
156
  cliConfigArray.unshift(
140
157
  ...configArrayFactory.loadFile(
@@ -178,6 +195,7 @@ class CascadingConfigArrayFactory {
178
195
  baseConfig: baseConfigData = null,
179
196
  cliConfig: cliConfigData = null,
180
197
  cwd = process.cwd(),
198
+ ignorePath,
181
199
  resolvePluginsRelativeTo = cwd,
182
200
  rulePaths = [],
183
201
  specificConfigPath = null,
@@ -200,6 +218,7 @@ class CascadingConfigArrayFactory {
200
218
  cliConfigArray: createCLIConfigArray({
201
219
  cliConfigData,
202
220
  configArrayFactory,
221
+ ignorePath,
203
222
  specificConfigPath
204
223
  }),
205
224
  cliConfigData,
@@ -207,6 +226,7 @@ class CascadingConfigArrayFactory {
207
226
  configCache: new Map(),
208
227
  cwd,
209
228
  finalizeCache: new WeakMap(),
229
+ ignorePath,
210
230
  rulePaths,
211
231
  specificConfigPath,
212
232
  useEslintrc
@@ -229,9 +249,11 @@ class CascadingConfigArrayFactory {
229
249
  * If `filePath` was not given, it returns the config which contains only
230
250
  * `baseConfigData` and `cliConfigData`.
231
251
  * @param {string} [filePath] The file path to a file.
252
+ * @param {Object} [options] The options.
253
+ * @param {boolean} [options.ignoreNotFoundError] If `true` then it doesn't throw `ConfigurationNotFoundError`.
232
254
  * @returns {ConfigArray} The config array of the file.
233
255
  */
234
- getConfigArrayForFile(filePath) {
256
+ getConfigArrayForFile(filePath, { ignoreNotFoundError = false } = {}) {
235
257
  const {
236
258
  baseConfigArray,
237
259
  cliConfigArray,
@@ -248,7 +270,8 @@ class CascadingConfigArrayFactory {
248
270
 
249
271
  return this._finalizeConfigArray(
250
272
  this._loadConfigInAncestors(directoryPath),
251
- directoryPath
273
+ directoryPath,
274
+ ignoreNotFoundError
252
275
  );
253
276
  }
254
277
 
@@ -354,10 +377,11 @@ class CascadingConfigArrayFactory {
354
377
  * Concatenate `--config` and other CLI options.
355
378
  * @param {ConfigArray} configArray The parent config array.
356
379
  * @param {string} directoryPath The path to the leaf directory to find config files.
380
+ * @param {boolean} ignoreNotFoundError If `true` then it doesn't throw `ConfigurationNotFoundError`.
357
381
  * @returns {ConfigArray} The loaded config.
358
382
  * @private
359
383
  */
360
- _finalizeConfigArray(configArray, directoryPath) {
384
+ _finalizeConfigArray(configArray, directoryPath, ignoreNotFoundError) {
361
385
  const {
362
386
  cliConfigArray,
363
387
  configArrayFactory,
@@ -403,7 +427,8 @@ class CascadingConfigArrayFactory {
403
427
  );
404
428
  }
405
429
 
406
- if (useEslintrc && finalConfigArray.length === 0) {
430
+ // At least one element (the default ignore patterns) exists.
431
+ if (!ignoreNotFoundError && useEslintrc && finalConfigArray.length <= 1) {
407
432
  throw new ConfigurationNotFoundError(directoryPath);
408
433
  }
409
434
 
@@ -25,10 +25,9 @@ const ModuleResolver = require("../shared/relative-module-resolver");
25
25
  const { Linter } = require("../linter");
26
26
  const builtInRules = require("../rules");
27
27
  const { CascadingConfigArrayFactory } = require("./cascading-config-array-factory");
28
- const { getUsedExtractedConfigs } = require("./config-array");
28
+ const { IgnorePattern, getUsedExtractedConfigs } = require("./config-array");
29
29
  const { FileEnumerator } = require("./file-enumerator");
30
30
  const hash = require("./hash");
31
- const { IgnoredPaths } = require("./ignored-paths");
32
31
  const LintResultCache = require("./lint-result-cache");
33
32
 
34
33
  const debug = require("debug")("eslint:cli-engine");
@@ -64,7 +63,7 @@ const validFixTypes = new Set(["problem", "suggestion", "layout"]);
64
63
  * @property {string[]} globals An array of global variables to declare.
65
64
  * @property {boolean} ignore False disables use of .eslintignore.
66
65
  * @property {string} ignorePath The ignore file to use instead of .eslintignore.
67
- * @property {string} ignorePattern A glob pattern of files to ignore.
66
+ * @property {string|string[]} ignorePattern One or more glob patterns to ignore.
68
67
  * @property {boolean} useEslintrc False disables looking for .eslintrc
69
68
  * @property {string} parser The name of the parser to use.
70
69
  * @property {ParserOptions} parserOptions An object of parserOption settings to use.
@@ -113,8 +112,8 @@ const validFixTypes = new Set(["problem", "suggestion", "layout"]);
113
112
  * @property {Map<string, Plugin>} additionalPluginPool The map for additional plugins.
114
113
  * @property {string} cacheFilePath The path to the cache of lint results.
115
114
  * @property {CascadingConfigArrayFactory} configArrayFactory The factory of configs.
115
+ * @property {(filePath: string) => boolean} defaultIgnores The default predicate function to check if a file ignored or not.
116
116
  * @property {FileEnumerator} fileEnumerator The file enumerator.
117
- * @property {IgnoredPaths} ignoredPaths The ignored paths.
118
117
  * @property {ConfigArray[]} lastConfigArrays The list of config arrays that the last `executeOnFiles` or `executeOnText` used.
119
118
  * @property {LintResultCache|null} lintResultCache The cache of lint results.
120
119
  * @property {Linter} linter The linter instance which has loaded rules.
@@ -486,13 +485,20 @@ function toBooleanMap(keys, defaultValue, displayName) {
486
485
  * @returns {ConfigData|null} The created config data.
487
486
  */
488
487
  function createConfigDataFromOptions(options) {
489
- const { parser, parserOptions, plugins, rules } = options;
488
+ const {
489
+ ignorePattern,
490
+ parser,
491
+ parserOptions,
492
+ plugins,
493
+ rules
494
+ } = options;
490
495
  const env = toBooleanMap(options.envs, true, "envs");
491
496
  const globals = toBooleanMap(options.globals, false, "globals");
492
497
 
493
498
  if (
494
499
  env === void 0 &&
495
500
  globals === void 0 &&
501
+ (ignorePattern === void 0 || ignorePattern.length === 0) &&
496
502
  parser === void 0 &&
497
503
  parserOptions === void 0 &&
498
504
  plugins === void 0 &&
@@ -500,7 +506,15 @@ function createConfigDataFromOptions(options) {
500
506
  ) {
501
507
  return null;
502
508
  }
503
- return { env, globals, parser, parserOptions, plugins, rules };
509
+ return {
510
+ env,
511
+ globals,
512
+ ignorePatterns: ignorePattern,
513
+ parser,
514
+ parserOptions,
515
+ plugins,
516
+ rules
517
+ };
504
518
  }
505
519
 
506
520
  /**
@@ -551,19 +565,19 @@ class CLIEngine {
551
565
  baseConfig: options.baseConfig || null,
552
566
  cliConfig: createConfigDataFromOptions(options),
553
567
  cwd: options.cwd,
568
+ ignorePath: options.ignorePath,
554
569
  resolvePluginsRelativeTo: options.resolvePluginsRelativeTo,
555
570
  rulePaths: options.rulePaths,
556
571
  specificConfigPath: options.configFile,
557
572
  useEslintrc: options.useEslintrc
558
573
  });
559
- const ignoredPaths = new IgnoredPaths(options);
560
574
  const fileEnumerator = new FileEnumerator({
561
575
  configArrayFactory,
562
576
  cwd: options.cwd,
563
577
  extensions: options.extensions,
564
578
  globInputPaths: options.globInputPaths,
565
- ignore: options.ignore,
566
- ignoredPaths
579
+ errorOnUnmatchedPattern: options.errorOnUnmatchedPattern,
580
+ ignore: options.ignore
567
581
  });
568
582
  const lintResultCache =
569
583
  options.cache ? new LintResultCache(cacheFilePath) : null;
@@ -577,8 +591,8 @@ class CLIEngine {
577
591
  additionalPluginPool,
578
592
  cacheFilePath,
579
593
  configArrayFactory,
594
+ defaultIgnores: IgnorePattern.createDefaultIgnore(options.cwd),
580
595
  fileEnumerator,
581
- ignoredPaths,
582
596
  lastConfigArrays,
583
597
  lintResultCache,
584
598
  linter,
@@ -835,7 +849,6 @@ class CLIEngine {
835
849
  const {
836
850
  configArrayFactory,
837
851
  fileEnumerator,
838
- ignoredPaths,
839
852
  lastConfigArrays,
840
853
  linter,
841
854
  options: {
@@ -852,7 +865,7 @@ class CLIEngine {
852
865
  // Clear the last used config arrays.
853
866
  lastConfigArrays.length = 0;
854
867
 
855
- if (resolvedFilename && ignoredPaths.contains(resolvedFilename)) {
868
+ if (resolvedFilename && this.isPathIgnored(resolvedFilename)) {
856
869
  if (warnIgnored) {
857
870
  results.push(createIgnoreResult(resolvedFilename, cwd));
858
871
  }
@@ -926,9 +939,23 @@ class CLIEngine {
926
939
  * @returns {boolean} Whether or not the given path is ignored.
927
940
  */
928
941
  isPathIgnored(filePath) {
929
- const { ignoredPaths } = internalSlotsMap.get(this);
942
+ const {
943
+ configArrayFactory,
944
+ defaultIgnores,
945
+ options: { cwd, ignore }
946
+ } = internalSlotsMap.get(this);
947
+ const absolutePath = path.resolve(cwd, filePath);
948
+
949
+ if (ignore) {
950
+ const config = configArrayFactory
951
+ .getConfigArrayForFile(absolutePath)
952
+ .extractConfig(absolutePath);
953
+ const ignores = config.ignores || defaultIgnores;
954
+
955
+ return ignores(absolutePath);
956
+ }
930
957
 
931
- return ignoredPaths.contains(filePath);
958
+ return defaultIgnores(absolutePath);
932
959
  }
933
960
 
934
961
  /**
@@ -31,6 +31,7 @@
31
31
  //------------------------------------------------------------------------------
32
32
 
33
33
  const { ExtractedConfig } = require("./extracted-config");
34
+ const { IgnorePattern } = require("./ignore-pattern");
34
35
 
35
36
  //------------------------------------------------------------------------------
36
37
  // Helpers
@@ -54,6 +55,7 @@ const { ExtractedConfig } = require("./extracted-config");
54
55
  * @property {InstanceType<OverrideTester>|null} criteria The tester for the `files` and `excludedFiles` of this config element.
55
56
  * @property {Record<string, boolean>|undefined} env The environment settings.
56
57
  * @property {Record<string, GlobalConf>|undefined} globals The global variable settings.
58
+ * @property {IgnorePattern|undefined} ignorePattern The ignore patterns.
57
59
  * @property {boolean|undefined} noInlineConfig The flag that disables directive comments.
58
60
  * @property {DependentParser|undefined} parser The parser loader.
59
61
  * @property {Object|undefined} parserOptions The parser options.
@@ -231,6 +233,7 @@ function mergeRuleConfigs(target, source) {
231
233
  */
232
234
  function createConfig(instance, indices) {
233
235
  const config = new ExtractedConfig();
236
+ const ignorePatterns = [];
234
237
 
235
238
  // Merge elements.
236
239
  for (const index of indices) {
@@ -260,6 +263,11 @@ function createConfig(instance, indices) {
260
263
  config.reportUnusedDisableDirectives = element.reportUnusedDisableDirectives;
261
264
  }
262
265
 
266
+ // Collect ignorePatterns
267
+ if (element.ignorePattern) {
268
+ ignorePatterns.push(element.ignorePattern);
269
+ }
270
+
263
271
  // Merge others.
264
272
  mergeWithoutOverwrite(config.env, element.env);
265
273
  mergeWithoutOverwrite(config.globals, element.globals);
@@ -269,6 +277,11 @@ function createConfig(instance, indices) {
269
277
  mergeRuleConfigs(config.rules, element.rules);
270
278
  }
271
279
 
280
+ // Create the predicate function for ignore patterns.
281
+ if (ignorePatterns.length > 0) {
282
+ config.ignores = IgnorePattern.createIgnore(ignorePatterns.reverse());
283
+ }
284
+
272
285
  return config;
273
286
  }
274
287
 
@@ -16,6 +16,8 @@
16
16
  */
17
17
  "use strict";
18
18
 
19
+ const { IgnorePattern } = require("./ignore-pattern");
20
+
19
21
  // For VSCode intellisense
20
22
  /** @typedef {import("../../shared/types").ConfigData} ConfigData */
21
23
  /** @typedef {import("../../shared/types").GlobalConf} GlobalConf */
@@ -23,6 +25,17 @@
23
25
  /** @typedef {import("./config-dependency").DependentParser} DependentParser */
24
26
  /** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */
25
27
 
28
+ /**
29
+ * Check if `xs` starts with `ys`.
30
+ * @template T
31
+ * @param {T[]} xs The array to check.
32
+ * @param {T[]} ys The array that may be the first part of `xs`.
33
+ * @returns {boolean} `true` if `xs` starts with `ys`.
34
+ */
35
+ function startsWith(xs, ys) {
36
+ return xs.length >= ys.length && ys.every((y, i) => y === xs[i]);
37
+ }
38
+
26
39
  /**
27
40
  * The class for extracted config data.
28
41
  */
@@ -47,6 +60,12 @@ class ExtractedConfig {
47
60
  */
48
61
  this.globals = {};
49
62
 
63
+ /**
64
+ * The glob patterns that ignore to lint.
65
+ * @type {(((filePath:string, dot?:boolean) => boolean) & { basePath:string; patterns:string[] }) | undefined}
66
+ */
67
+ this.ignores = void 0;
68
+
50
69
  /**
51
70
  * The flag that disables directive comments.
52
71
  * @type {boolean|undefined}
@@ -106,11 +125,19 @@ class ExtractedConfig {
106
125
  configNameOfNoInlineConfig: _ignore1,
107
126
  processor: _ignore2,
108
127
  /* eslint-enable no-unused-vars */
128
+ ignores,
109
129
  ...config
110
130
  } = this;
111
131
 
112
132
  config.parser = config.parser && config.parser.filePath;
113
133
  config.plugins = Object.keys(config.plugins).filter(Boolean).reverse();
134
+ config.ignorePatterns = ignores ? ignores.patterns : [];
135
+
136
+ // Strip the default patterns from `ignorePatterns`.
137
+ if (startsWith(config.ignorePatterns, IgnorePattern.DefaultPatterns)) {
138
+ config.ignorePatterns =
139
+ config.ignorePatterns.slice(IgnorePattern.DefaultPatterns.length);
140
+ }
114
141
 
115
142
  return config;
116
143
  }