immosquare-cleaner 0.1.23 → 0.1.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/lib/immosquare-cleaner/version.rb +1 -1
  3. data/linters/rubocop-3.2.2.yml +1 -0
  4. data/linters/rubocop.yml +2 -0
  5. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/LICENSE +19 -0
  6. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/README.md +71 -0
  7. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/conf/config-schema.js +79 -0
  8. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/conf/environments.js +215 -0
  9. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +1104 -0
  10. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +1 -0
  11. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +4333 -0
  12. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +1 -0
  13. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js +532 -0
  14. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array/config-array.js +523 -0
  15. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js +115 -0
  16. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js +145 -0
  17. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js +238 -0
  18. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array/index.js +19 -0
  19. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js +225 -0
  20. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js +1149 -0
  21. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/flat-compat.js +318 -0
  22. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/index-universal.js +29 -0
  23. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/index.js +56 -0
  24. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/shared/ajv.js +191 -0
  25. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/shared/config-ops.js +135 -0
  26. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/shared/config-validator.js +325 -0
  27. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js +63 -0
  28. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/shared/naming.js +96 -0
  29. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js +42 -0
  30. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/lib/shared/types.js +149 -0
  31. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/strip-json-comments/index.d.ts +36 -0
  32. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/strip-json-comments/index.js +77 -0
  33. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/strip-json-comments/license +9 -0
  34. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/strip-json-comments/package.json +47 -0
  35. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/node_modules/strip-json-comments/readme.md +78 -0
  36. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/package.json +82 -0
  37. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/eslintrc/universal.js +9 -0
  38. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/js/LICENSE +19 -0
  39. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/js/README.md +57 -0
  40. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/js/package.json +31 -0
  41. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/js/src/configs/eslint-all.js +278 -0
  42. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/js/src/configs/eslint-recommended.js +76 -0
  43. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@eslint/js/src/index.js +17 -0
  44. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/LICENSE +201 -0
  45. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/README.md +342 -0
  46. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/api.js +1061 -0
  47. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/@humanwhocodes/object-schema/CHANGELOG.md +8 -0
  48. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/@humanwhocodes/object-schema/LICENSE +29 -0
  49. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/@humanwhocodes/object-schema/README.md +234 -0
  50. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/@humanwhocodes/object-schema/package.json +33 -0
  51. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/@humanwhocodes/object-schema/src/index.js +7 -0
  52. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/@humanwhocodes/object-schema/src/merge-strategy.js +53 -0
  53. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/@humanwhocodes/object-schema/src/object-schema.js +235 -0
  54. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/@humanwhocodes/object-schema/src/validation-strategy.js +102 -0
  55. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/@humanwhocodes/object-schema/tests/merge-strategy.js +66 -0
  56. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/@humanwhocodes/object-schema/tests/object-schema.js +611 -0
  57. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/@humanwhocodes/object-schema/tests/validation-strategy.js +186 -0
  58. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/minimatch/LICENSE +15 -0
  59. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/minimatch/README.md +224 -0
  60. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/minimatch/minimatch.js +947 -0
  61. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/minimatch/node_modules/brace-expansion/LICENSE +21 -0
  62. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/minimatch/node_modules/brace-expansion/README.md +129 -0
  63. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/minimatch/node_modules/brace-expansion/index.js +201 -0
  64. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/minimatch/node_modules/brace-expansion/package.json +47 -0
  65. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/node_modules/minimatch/package.json +33 -0
  66. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/@humanwhocodes/config-array/package.json +61 -0
  67. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/chalk/index.d.ts +415 -0
  68. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/chalk/license +9 -0
  69. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/chalk/package.json +68 -0
  70. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/chalk/readme.md +341 -0
  71. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/chalk/source/index.js +229 -0
  72. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/chalk/source/templates.js +134 -0
  73. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/chalk/source/util.js +39 -0
  74. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/minimatch/LICENSE +15 -0
  75. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/minimatch/README.md +230 -0
  76. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/minimatch/minimatch.js +947 -0
  77. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/LICENSE +21 -0
  78. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/README.md +129 -0
  79. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/index.js +201 -0
  80. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/minimatch/node_modules/brace-expansion/package.json +47 -0
  81. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/minimatch/package.json +33 -0
  82. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/strip-ansi/index.d.ts +17 -0
  83. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/strip-ansi/index.js +4 -0
  84. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/strip-ansi/license +9 -0
  85. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/index.d.ts +37 -0
  86. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/index.js +10 -0
  87. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/license +9 -0
  88. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/package.json +55 -0
  89. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/readme.md +78 -0
  90. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/strip-ansi/package.json +54 -0
  91. data/node_modules/@eslint-community/eslint-utils/node_modules/eslint/node_modules/strip-ansi/readme.md +46 -0
  92. data/node_modules/eslint-plugin-import/node_modules/debug/node_modules/ms/index.js +162 -0
  93. data/node_modules/eslint-plugin-import/node_modules/debug/node_modules/ms/license.md +21 -0
  94. data/node_modules/eslint-plugin-import/node_modules/debug/node_modules/ms/package.json +38 -0
  95. data/node_modules/eslint-plugin-import/node_modules/debug/node_modules/ms/readme.md +59 -0
  96. data/node_modules/npm-check-updates/build/package.json +2 -3
  97. data/node_modules/npm-check-updates/build/src/lib/runGlobal.js +18 -11
  98. data/node_modules/npm-check-updates/build/src/lib/runGlobal.js.map +1 -1
  99. data/node_modules/npm-check-updates/build/src/package-managers/bun.js +2 -3
  100. data/node_modules/npm-check-updates/build/src/package-managers/bun.js.map +1 -1
  101. data/node_modules/npm-check-updates/build/src/package-managers/npm.js +12 -8
  102. data/node_modules/npm-check-updates/build/src/package-managers/npm.js.map +1 -1
  103. data/node_modules/npm-check-updates/build/src/package-managers/pnpm.js +37 -14
  104. data/node_modules/npm-check-updates/build/src/package-managers/pnpm.js.map +1 -1
  105. data/node_modules/npm-check-updates/build/src/package-managers/yarn.js +36 -11
  106. data/node_modules/npm-check-updates/build/src/package-managers/yarn.js.map +1 -1
  107. data/node_modules/npm-check-updates/package.json +2 -3
  108. data/node_modules/prettier/LICENSE +3 -3
  109. data/node_modules/prettier/index.cjs +1 -1
  110. data/node_modules/prettier/index.mjs +14 -22
  111. data/node_modules/prettier/package.json +1 -1
  112. data/node_modules/prettier/plugins/acorn.js +10 -10
  113. data/node_modules/prettier/plugins/acorn.mjs +10 -10
  114. data/node_modules/prettier/plugins/angular.js +1 -1
  115. data/node_modules/prettier/plugins/angular.mjs +1 -1
  116. data/node_modules/prettier/plugins/babel.js +8 -8
  117. data/node_modules/prettier/plugins/babel.mjs +8 -8
  118. data/node_modules/prettier/plugins/estree.js +24 -24
  119. data/node_modules/prettier/plugins/estree.mjs +24 -24
  120. data/node_modules/prettier/plugins/flow.js +17 -17
  121. data/node_modules/prettier/plugins/flow.mjs +17 -17
  122. data/node_modules/prettier/plugins/graphql.js +6 -6
  123. data/node_modules/prettier/plugins/graphql.mjs +6 -6
  124. data/node_modules/prettier/plugins/html.js +1 -1
  125. data/node_modules/prettier/plugins/html.mjs +1 -1
  126. data/node_modules/prettier/plugins/markdown.js +1 -1
  127. data/node_modules/prettier/plugins/markdown.mjs +1 -1
  128. data/node_modules/prettier/plugins/meriyah.js +4 -4
  129. data/node_modules/prettier/plugins/meriyah.mjs +4 -4
  130. data/node_modules/prettier/plugins/typescript.js +19 -19
  131. data/node_modules/prettier/plugins/typescript.mjs +19 -19
  132. data/node_modules/prettier/standalone.js +10 -10
  133. data/node_modules/prettier/standalone.mjs +9 -9
  134. data/package.json +2 -2
  135. metadata +95 -4
@@ -0,0 +1,342 @@
1
+ # Config Array
2
+
3
+ by [Nicholas C. Zakas](https://humanwhocodes.com)
4
+
5
+ If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate).
6
+
7
+ ## Description
8
+
9
+ A config array is a way of managing configurations that are based on glob pattern matching of filenames. Each config array contains the information needed to determine the correct configuration for any file based on the filename.
10
+
11
+ ## Background
12
+
13
+ In 2019, I submitted an [ESLint RFC](https://github.com/eslint/rfcs/pull/9) proposing a new way of configuring ESLint. The goal was to streamline what had become an increasingly complicated configuration process. Over several iterations, this proposal was eventually born.
14
+
15
+ The basic idea is that all configuration, including overrides, can be represented by a single array where each item in the array is a config object. Config objects appearing later in the array override config objects appearing earlier in the array. You can calculate a config for a given file by traversing all config objects in the array to find the ones that match the filename. Matching is done by specifying glob patterns in `files` and `ignores` properties on each config object. Here's an example:
16
+
17
+ ```js
18
+ export default [
19
+
20
+ // match all JSON files
21
+ {
22
+ name: "JSON Handler",
23
+ files: ["**/*.json"],
24
+ handler: jsonHandler
25
+ },
26
+
27
+ // match only package.json
28
+ {
29
+ name: "package.json Handler",
30
+ files: ["package.json"],
31
+ handler: packageJsonHandler
32
+ }
33
+ ];
34
+ ```
35
+
36
+ In this example, there are two config objects: the first matches all JSON files in all directories and the second matches just `package.json` in the base path directory (all the globs are evaluated as relative to a base path that can be specified). When you retrieve a configuration for `foo.json`, only the first config object matches so `handler` is equal to `jsonHandler`; when you retrieve a configuration for `package.json`, `handler` is equal to `packageJsonHandler` (because both config objects match, the second one wins).
37
+
38
+ ## Installation
39
+
40
+ You can install the package using npm or Yarn:
41
+
42
+ ```bash
43
+ npm install @humanwhocodes/config-array --save
44
+
45
+ # or
46
+
47
+ yarn add @humanwhocodes/config-array
48
+ ```
49
+
50
+ ## Usage
51
+
52
+ First, import the `ConfigArray` constructor:
53
+
54
+ ```js
55
+ import { ConfigArray } from "@humanwhocodes/config-array";
56
+
57
+ // or using CommonJS
58
+
59
+ const { ConfigArray } = require("@humanwhocodes/config-array");
60
+ ```
61
+
62
+ When you create a new instance of `ConfigArray`, you must pass in two arguments: an array of configs and an options object. The array of configs is most likely read in from a configuration file, so here's a typical example:
63
+
64
+ ```js
65
+ const configFilename = path.resolve(process.cwd(), "my.config.js");
66
+ const { default: rawConfigs } = await import(configFilename);
67
+ const configs = new ConfigArray(rawConfigs, {
68
+
69
+ // the path to match filenames from
70
+ basePath: process.cwd(),
71
+
72
+ // additional items in each config
73
+ schema: mySchema
74
+ });
75
+ ```
76
+
77
+ This example reads in an object or array from `my.config.js` and passes it into the `ConfigArray` constructor as the first argument. The second argument is an object specifying the `basePath` (the directory in which `my.config.js` is found) and a `schema` to define the additional properties of a config object beyond `files`, `ignores`, and `name`.
78
+
79
+ ### Specifying a Schema
80
+
81
+ The `schema` option is required for you to use additional properties in config objects. The schema is an object that follows the format of an [`ObjectSchema`](https://npmjs.com/package/@humanwhocodes/object-schema). The schema specifies both validation and merge rules that the `ConfigArray` instance needs to combine configs when there are multiple matches. Here's an example:
82
+
83
+ ```js
84
+ const configFilename = path.resolve(process.cwd(), "my.config.js");
85
+ const { default: rawConfigs } = await import(configFilename);
86
+
87
+ const mySchema = {
88
+
89
+ // define the handler key in configs
90
+ handler: {
91
+ required: true,
92
+ merge(a, b) {
93
+ if (!b) return a;
94
+ if (!a) return b;
95
+ },
96
+ validate(value) {
97
+ if (typeof value !== "function") {
98
+ throw new TypeError("Function expected.");
99
+ }
100
+ }
101
+ }
102
+ };
103
+
104
+ const configs = new ConfigArray(rawConfigs, {
105
+
106
+ // the path to match filenames from
107
+ basePath: process.cwd(),
108
+
109
+ // additional item schemas in each config
110
+ schema: mySchema,
111
+
112
+ // additional config types supported (default: [])
113
+ extraConfigTypes: ["array", "function"];
114
+ });
115
+ ```
116
+
117
+ ### Config Arrays
118
+
119
+ Config arrays can be multidimensional, so it's possible for a config array to contain another config array when `extraConfigTypes` contains `"array"`, such as:
120
+
121
+ ```js
122
+ export default [
123
+
124
+ // JS config
125
+ {
126
+ files: ["**/*.js"],
127
+ handler: jsHandler
128
+ },
129
+
130
+ // JSON configs
131
+ [
132
+
133
+ // match all JSON files
134
+ {
135
+ name: "JSON Handler",
136
+ files: ["**/*.json"],
137
+ handler: jsonHandler
138
+ },
139
+
140
+ // match only package.json
141
+ {
142
+ name: "package.json Handler",
143
+ files: ["package.json"],
144
+ handler: packageJsonHandler
145
+ }
146
+ ],
147
+
148
+ // filename must match function
149
+ {
150
+ files: [ filePath => filePath.endsWith(".md") ],
151
+ handler: markdownHandler
152
+ },
153
+
154
+ // filename must match all patterns in subarray
155
+ {
156
+ files: [ ["*.test.*", "*.js"] ],
157
+ handler: jsTestHandler
158
+ },
159
+
160
+ // filename must not match patterns beginning with !
161
+ {
162
+ name: "Non-JS files",
163
+ files: ["!*.js"],
164
+ settings: {
165
+ js: false
166
+ }
167
+ }
168
+ ];
169
+ ```
170
+
171
+ In this example, the array contains both config objects and a config array. When a config array is normalized (see details below), it is flattened so only config objects remain. However, the order of evaluation remains the same.
172
+
173
+ If the `files` array contains a function, then that function is called with the absolute path of the file and is expected to return `true` if there is a match and `false` if not. (The `ignores` array can also contain functions.)
174
+
175
+ If the `files` array contains an item that is an array of strings and functions, then all patterns must match in order for the config to match. In the preceding examples, both `*.test.*` and `*.js` must match in order for the config object to be used.
176
+
177
+ If a pattern in the files array begins with `!` then it excludes that pattern. In the preceding example, any filename that doesn't end with `.js` will automatically get a `settings.js` property set to `false`.
178
+
179
+ You can also specify an `ignores` key that will force files matching those patterns to not be included. If the `ignores` key is in a config object without any other keys, then those ignores will always be applied; otherwise those ignores act as exclusions. Here's an example:
180
+
181
+ ```js
182
+ export default [
183
+
184
+ // Always ignored
185
+ {
186
+ ignores: ["**/.git/**", "**/node_modules/**"]
187
+ },
188
+
189
+ // .eslintrc.js file is ignored only when .js file matches
190
+ {
191
+ files: ["**/*.js"],
192
+ ignores: [".eslintrc.js"]
193
+ handler: jsHandler
194
+ }
195
+ ];
196
+ ```
197
+
198
+ You can use negated patterns in `ignores` to exclude a file that was already ignored, such as:
199
+
200
+ ```js
201
+ export default [
202
+
203
+ // Ignore all JSON files except tsconfig.json
204
+ {
205
+ files: ["**/*"],
206
+ ignores: ["**/*.json", "!tsconfig.json"]
207
+ },
208
+
209
+ ];
210
+ ```
211
+
212
+ ### Config Functions
213
+
214
+ Config arrays can also include config functions when `extraConfigTypes` contains `"function"`. A config function accepts a single parameter, `context` (defined by you), and must return either a config object or a config array (it cannot return another function). Config functions allow end users to execute code in the creation of appropriate config objects. Here's an example:
215
+
216
+ ```js
217
+ export default [
218
+
219
+ // JS config
220
+ {
221
+ files: ["**/*.js"],
222
+ handler: jsHandler
223
+ },
224
+
225
+ // JSON configs
226
+ function (context) {
227
+ return [
228
+
229
+ // match all JSON files
230
+ {
231
+ name: context.name + " JSON Handler",
232
+ files: ["**/*.json"],
233
+ handler: jsonHandler
234
+ },
235
+
236
+ // match only package.json
237
+ {
238
+ name: context.name + " package.json Handler",
239
+ files: ["package.json"],
240
+ handler: packageJsonHandler
241
+ }
242
+ ];
243
+ }
244
+ ];
245
+ ```
246
+
247
+ When a config array is normalized, each function is executed and replaced in the config array with the return value.
248
+
249
+ **Note:** Config functions can also be async.
250
+
251
+ ### Normalizing Config Arrays
252
+
253
+ Once a config array has been created and loaded with all of the raw config data, it must be normalized before it can be used. The normalization process goes through and flattens the config array as well as executing all config functions to get their final values.
254
+
255
+ To normalize a config array, call the `normalize()` method and pass in a context object:
256
+
257
+ ```js
258
+ await configs.normalize({
259
+ name: "MyApp"
260
+ });
261
+ ```
262
+
263
+ The `normalize()` method returns a promise, so be sure to use the `await` operator. The config array instance is normalized in-place, so you don't need to create a new variable.
264
+
265
+ If you want to disallow async config functions, you can call `normalizeSync()` instead. This method is completely synchronous and does not require using the `await` operator as it does not return a promise:
266
+
267
+ ```js
268
+ await configs.normalizeSync({
269
+ name: "MyApp"
270
+ });
271
+ ```
272
+
273
+ **Important:** Once a `ConfigArray` is normalized, it cannot be changed further. You can, however, create a new `ConfigArray` and pass in the normalized instance to create an unnormalized copy.
274
+
275
+ ### Getting Config for a File
276
+
277
+ To get the config for a file, use the `getConfig()` method on a normalized config array and pass in the filename to get a config for:
278
+
279
+ ```js
280
+ // pass in absolute filename
281
+ const fileConfig = configs.getConfig(path.resolve(process.cwd(), "package.json"));
282
+ ```
283
+
284
+ The config array always returns an object, even if there are no configs matching the given filename. You can then inspect the returned config object to determine how to proceed.
285
+
286
+ A few things to keep in mind:
287
+
288
+ * You must pass in the absolute filename to get a config for.
289
+ * The returned config object never has `files`, `ignores`, or `name` properties; the only properties on the object will be the other configuration options specified.
290
+ * The config array caches configs, so subsequent calls to `getConfig()` with the same filename will return in a fast lookup rather than another calculation.
291
+ * A config will only be generated if the filename matches an entry in a `files` key. A config will not be generated without matching a `files` key (configs without a `files` key are only applied when another config with a `files` key is applied; configs without `files` are never applied on their own). Any config with a `files` key entry ending with `/**` or `/*` will only be applied if another entry in the same `files` key matches or another config matches.
292
+
293
+ ## Determining Ignored Paths
294
+
295
+ You can determine if a file is ignored by using the `isFileIgnored()` method and passing in the absolute path of any file, as in this example:
296
+
297
+ ```js
298
+ const ignored = configs.isFileIgnored('/foo/bar/baz.txt');
299
+ ```
300
+
301
+ A file is considered ignored if any of the following is true:
302
+
303
+ * **It's parent directory is ignored.** For example, if `foo` is in `ignores`, then `foo/a.js` is considered ignored.
304
+ * **It has an ancestor directory that is ignored.** For example, if `foo` is in `ignores`, then `foo/baz/a.js` is considered ignored.
305
+ * **It matches an ignored file pattern.** For example, if `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored.
306
+ * **If it matches an entry in `files` and also in `ignores`.** For example, if `**/*.js` is in `files` and `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored.
307
+ * **The file is outside the `basePath`.** If the `basePath` is `/usr/me`, then `/foo/a.js` is considered ignored.
308
+
309
+ For directories, use the `isDirectoryIgnored()` method and pass in the absolute path of any directory, as in this example:
310
+
311
+ ```js
312
+ const ignored = configs.isDirectoryIgnored('/foo/bar/');
313
+ ```
314
+
315
+ A directory is considered ignored if any of the following is true:
316
+
317
+ * **It's parent directory is ignored.** For example, if `foo` is in `ignores`, then `foo/baz` is considered ignored.
318
+ * **It has an ancestor directory that is ignored.** For example, if `foo` is in `ignores`, then `foo/bar/baz/a.js` is considered ignored.
319
+ * **It matches and ignored file pattern.** For example, if `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored.
320
+ * **If it matches an entry in `files` and also in `ignores`.** For example, if `**/*.js` is in `files` and `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored.
321
+ * **The file is outside the `basePath`.** If the `basePath` is `/usr/me`, then `/foo/a.js` is considered ignored.
322
+
323
+ **Important:** A pattern such as `foo/**` means that `foo` and `foo/` are *not* ignored whereas `foo/bar` is ignored. If you want to ignore `foo` and all of its subdirectories, use the pattern `foo` or `foo/` in `ignores`.
324
+
325
+ ## Caching Mechanisms
326
+
327
+ Each `ConfigArray` aggressively caches configuration objects to avoid unnecessary work. This caching occurs in two ways:
328
+
329
+ 1. **File-based Caching.** For each filename that is passed into a method, the resulting config is cached against that filename so you're always guaranteed to get the same object returned from `getConfig()` whenever you pass the same filename in.
330
+ 2. **Index-based Caching.** Whenever a config is calculated, the config elements that were used to create the config are also cached. So if a given filename matches elements 1, 5, and 7, the resulting config is cached with a key of `1,5,7`. That way, if another file is passed that matches the same config elements, the result is already known and doesn't have to be recalculated. That means two files that match all the same elements will return the same config from `getConfig()`.
331
+
332
+ ## Acknowledgements
333
+
334
+ The design of this project was influenced by feedback on the ESLint RFC, and incorporates ideas from:
335
+
336
+ * Teddy Katz (@not-an-aardvark)
337
+ * Toru Nagashima (@mysticatea)
338
+ * Kai Cataldo (@kaicataldo)
339
+
340
+ ## License
341
+
342
+ Apache 2.0