immosquare-cleaner 0.1.46 → 0.1.47
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/immosquare-cleaner/version.rb +1 -1
- data/linters/rubocop-3.3.4.yml +2 -0
- data/linters/rubocop.yml +2 -0
- data/node_modules/@eslint/eslintrc/node_modules/ignore/LICENSE-MIT +21 -0
- data/node_modules/@eslint/eslintrc/node_modules/ignore/README.md +412 -0
- data/node_modules/@eslint/eslintrc/node_modules/ignore/index.d.ts +61 -0
- data/node_modules/@eslint/eslintrc/node_modules/ignore/index.js +618 -0
- data/node_modules/@eslint/eslintrc/node_modules/ignore/legacy.js +539 -0
- data/node_modules/@eslint/eslintrc/node_modules/ignore/package.json +73 -0
- data/node_modules/@eslint/js/package.json +1 -1
- data/node_modules/@eslint/plugin-kit/LICENSE +201 -0
- data/node_modules/@eslint/plugin-kit/README.md +224 -0
- data/node_modules/@eslint/plugin-kit/dist/cjs/index.cjs +555 -0
- data/node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts +239 -0
- data/node_modules/@eslint/plugin-kit/dist/cjs/types.ts +7 -0
- data/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts +239 -0
- data/node_modules/@eslint/plugin-kit/dist/esm/index.js +551 -0
- data/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts +6 -0
- data/node_modules/@eslint/plugin-kit/dist/esm/types.ts +7 -0
- data/node_modules/@eslint/plugin-kit/package.json +62 -0
- data/node_modules/eslint/README.md +2 -2
- data/node_modules/eslint/lib/config/config.js +278 -0
- data/node_modules/eslint/lib/config/flat-config-array.js +3 -204
- data/node_modules/eslint/lib/languages/js/source-code/source-code.js +29 -94
- data/node_modules/eslint/lib/linter/apply-disable-directives.js +17 -28
- data/node_modules/eslint/lib/linter/file-context.js +134 -0
- data/node_modules/eslint/lib/linter/linter.js +37 -42
- data/node_modules/eslint/lib/rules/id-length.js +1 -0
- data/node_modules/eslint/lib/rules/no-invalid-regexp.js +34 -18
- data/node_modules/eslint/lib/rules/require-unicode-regexp.js +95 -14
- data/node_modules/eslint/lib/rules/utils/regular-expressions.js +11 -3
- data/node_modules/eslint/lib/types/index.d.ts +1635 -0
- data/node_modules/eslint/lib/types/rules/best-practices.d.ts +1075 -0
- data/node_modules/eslint/lib/types/rules/deprecated.d.ts +294 -0
- data/node_modules/eslint/lib/types/rules/ecmascript-6.d.ts +561 -0
- data/node_modules/eslint/lib/types/rules/index.d.ts +50 -0
- data/node_modules/eslint/lib/types/rules/node-commonjs.d.ts +160 -0
- data/node_modules/eslint/lib/types/rules/possible-errors.d.ts +598 -0
- data/node_modules/eslint/lib/types/rules/strict-mode.d.ts +38 -0
- data/node_modules/eslint/lib/types/rules/stylistic-issues.d.ts +1932 -0
- data/node_modules/eslint/lib/types/rules/variables.d.ts +221 -0
- data/node_modules/eslint/lib/types/use-at-your-own-risk.d.ts +85 -0
- data/node_modules/eslint/package.json +20 -8
- data/node_modules/ignore/index.d.ts +1 -1
- data/node_modules/ignore/index.js +25 -7
- data/node_modules/ignore/legacy.js +34 -14
- data/node_modules/ignore/package.json +12 -11
- data/node_modules/npm-check-updates/build/index.js +282 -282
- data/node_modules/npm-check-updates/build/index.js.map +1 -1
- data/node_modules/npm-check-updates/package.json +1 -1
- data/package.json +3 -3
- metadata +31 -4
- data/linters/rubocop-2.7.6.yml +0 -88
- data/node_modules/eslint/lib/linter/config-comment-parser.js +0 -169
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e98219e99dbffc58eabd35323a1bc836d038e6a372b645e53877cd9da32934e1
|
4
|
+
data.tar.gz: e46b493a5ca20d0f87ca7ec82b79756c5c24f41a4e0be7af99cc64a3e8d43dd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ed4fa2d6f6ab50eea1dd61fe53f77275da3b70535ca67ee38d1b8ffc05b81961a0fd2a930373c3ea3c38ceccd656a71f3514b513f5f5467e322e7ea21619980
|
7
|
+
data.tar.gz: aae7630a14379f129b868f5957bc5a60cb44852b552281d0db58cdda58f85ca62b3b6a7ab2f667a87e7a9d68bbe20ac49d2ca13bae77dfeb78310e3a598b491b
|
data/linters/rubocop-3.3.4.yml
CHANGED
data/linters/rubocop.yml
CHANGED
@@ -62,6 +62,8 @@ Layout/MultilineMethodCallIndentation:
|
|
62
62
|
EnforcedStyle: indented
|
63
63
|
|
64
64
|
#################### Style ###########################
|
65
|
+
Style/SingleArgumentDig:
|
66
|
+
Enabled: false # On ne veut pas transformer les .dig de 1 argument en array car on a fait un override de dig pour ajouter dig sur les active record dans le gem immosquare-extensions
|
65
67
|
Style/RedundantBegin:
|
66
68
|
Enabled: false # Cette méthode retire les begin au début des méthodes
|
67
69
|
Style/MultilineTernaryOperator:
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2013 Kael Zhang <i@kael.me>, contributors
|
2
|
+
http://kael.me/
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,412 @@
|
|
1
|
+
<table><thead>
|
2
|
+
<tr>
|
3
|
+
<th>Linux</th>
|
4
|
+
<th>OS X</th>
|
5
|
+
<th>Windows</th>
|
6
|
+
<th>Coverage</th>
|
7
|
+
<th>Downloads</th>
|
8
|
+
</tr>
|
9
|
+
</thead><tbody><tr>
|
10
|
+
<td colspan="2" align="center">
|
11
|
+
<a href="https://github.com/kaelzhang/node-ignore/actions/workflows/nodejs.yml">
|
12
|
+
<img
|
13
|
+
src="https://github.com/kaelzhang/node-ignore/actions/workflows/nodejs.yml/badge.svg"
|
14
|
+
alt="Build Status" /></a>
|
15
|
+
</td>
|
16
|
+
<td align="center">
|
17
|
+
<a href="https://ci.appveyor.com/project/kaelzhang/node-ignore">
|
18
|
+
<img
|
19
|
+
src="https://ci.appveyor.com/api/projects/status/github/kaelzhang/node-ignore?branch=master&svg=true"
|
20
|
+
alt="Windows Build Status" /></a>
|
21
|
+
</td>
|
22
|
+
<td align="center">
|
23
|
+
<a href="https://codecov.io/gh/kaelzhang/node-ignore">
|
24
|
+
<img
|
25
|
+
src="https://codecov.io/gh/kaelzhang/node-ignore/branch/master/graph/badge.svg"
|
26
|
+
alt="Coverage Status" /></a>
|
27
|
+
</td>
|
28
|
+
<td align="center">
|
29
|
+
<a href="https://www.npmjs.org/package/ignore">
|
30
|
+
<img
|
31
|
+
src="http://img.shields.io/npm/dm/ignore.svg"
|
32
|
+
alt="npm module downloads per month" /></a>
|
33
|
+
</td>
|
34
|
+
</tr></tbody></table>
|
35
|
+
|
36
|
+
# ignore
|
37
|
+
|
38
|
+
`ignore` is a manager, filter and parser which implemented in pure JavaScript according to the [.gitignore spec 2.22.1](http://git-scm.com/docs/gitignore).
|
39
|
+
|
40
|
+
`ignore` is used by eslint, gitbook and [many others](https://www.npmjs.com/browse/depended/ignore).
|
41
|
+
|
42
|
+
Pay **ATTENTION** that [`minimatch`](https://www.npmjs.org/package/minimatch) (which used by `fstream-ignore`) does not follow the gitignore spec.
|
43
|
+
|
44
|
+
To filter filenames according to a .gitignore file, I recommend this npm package, `ignore`.
|
45
|
+
|
46
|
+
To parse an `.npmignore` file, you should use `minimatch`, because an `.npmignore` file is parsed by npm using `minimatch` and it does not work in the .gitignore way.
|
47
|
+
|
48
|
+
### Tested on
|
49
|
+
|
50
|
+
`ignore` is fully tested, and has more than **five hundreds** of unit tests.
|
51
|
+
|
52
|
+
- Linux + Node: `0.8` - `7.x`
|
53
|
+
- Windows + Node: `0.10` - `7.x`, node < `0.10` is not tested due to the lack of support of appveyor.
|
54
|
+
|
55
|
+
Actually, `ignore` does not rely on any versions of node specially.
|
56
|
+
|
57
|
+
Since `4.0.0`, ignore will no longer support `node < 6` by default, to use in node < 6, `require('ignore/legacy')`. For details, see [CHANGELOG](https://github.com/kaelzhang/node-ignore/blob/master/CHANGELOG.md).
|
58
|
+
|
59
|
+
## Table Of Main Contents
|
60
|
+
|
61
|
+
- [Usage](#usage)
|
62
|
+
- [`Pathname` Conventions](#pathname-conventions)
|
63
|
+
- See Also:
|
64
|
+
- [`glob-gitignore`](https://www.npmjs.com/package/glob-gitignore) matches files using patterns and filters them according to gitignore rules.
|
65
|
+
- [Upgrade Guide](#upgrade-guide)
|
66
|
+
|
67
|
+
## Install
|
68
|
+
|
69
|
+
```sh
|
70
|
+
npm i ignore
|
71
|
+
```
|
72
|
+
|
73
|
+
## Usage
|
74
|
+
|
75
|
+
```js
|
76
|
+
import ignore from 'ignore'
|
77
|
+
const ig = ignore().add(['.abc/*', '!.abc/d/'])
|
78
|
+
```
|
79
|
+
|
80
|
+
### Filter the given paths
|
81
|
+
|
82
|
+
```js
|
83
|
+
const paths = [
|
84
|
+
'.abc/a.js', // filtered out
|
85
|
+
'.abc/d/e.js' // included
|
86
|
+
]
|
87
|
+
|
88
|
+
ig.filter(paths) // ['.abc/d/e.js']
|
89
|
+
ig.ignores('.abc/a.js') // true
|
90
|
+
```
|
91
|
+
|
92
|
+
### As the filter function
|
93
|
+
|
94
|
+
```js
|
95
|
+
paths.filter(ig.createFilter()); // ['.abc/d/e.js']
|
96
|
+
```
|
97
|
+
|
98
|
+
### Win32 paths will be handled
|
99
|
+
|
100
|
+
```js
|
101
|
+
ig.filter(['.abc\\a.js', '.abc\\d\\e.js'])
|
102
|
+
// if the code above runs on windows, the result will be
|
103
|
+
// ['.abc\\d\\e.js']
|
104
|
+
```
|
105
|
+
|
106
|
+
## Why another ignore?
|
107
|
+
|
108
|
+
- `ignore` is a standalone module, and is much simpler so that it could easy work with other programs, unlike [isaacs](https://npmjs.org/~isaacs)'s [fstream-ignore](https://npmjs.org/package/fstream-ignore) which must work with the modules of the fstream family.
|
109
|
+
|
110
|
+
- `ignore` only contains utility methods to filter paths according to the specified ignore rules, so
|
111
|
+
- `ignore` never try to find out ignore rules by traversing directories or fetching from git configurations.
|
112
|
+
- `ignore` don't cares about sub-modules of git projects.
|
113
|
+
|
114
|
+
- Exactly according to [gitignore man page](http://git-scm.com/docs/gitignore), fixes some known matching issues of fstream-ignore, such as:
|
115
|
+
- '`/*.js`' should only match '`a.js`', but not '`abc/a.js`'.
|
116
|
+
- '`**/foo`' should match '`foo`' anywhere.
|
117
|
+
- Prevent re-including a file if a parent directory of that file is excluded.
|
118
|
+
- Handle trailing whitespaces:
|
119
|
+
- `'a '`(one space) should not match `'a '`(two spaces).
|
120
|
+
- `'a \ '` matches `'a '`
|
121
|
+
- All test cases are verified with the result of `git check-ignore`.
|
122
|
+
|
123
|
+
# Methods
|
124
|
+
|
125
|
+
## .add(pattern: string | Ignore): this
|
126
|
+
## .add(patterns: Array<string | Ignore>): this
|
127
|
+
|
128
|
+
- **pattern** `String | Ignore` An ignore pattern string, or the `Ignore` instance
|
129
|
+
- **patterns** `Array<String | Ignore>` Array of ignore patterns.
|
130
|
+
|
131
|
+
Adds a rule or several rules to the current manager.
|
132
|
+
|
133
|
+
Returns `this`
|
134
|
+
|
135
|
+
Notice that a line starting with `'#'`(hash) is treated as a comment. Put a backslash (`'\'`) in front of the first hash for patterns that begin with a hash, if you want to ignore a file with a hash at the beginning of the filename.
|
136
|
+
|
137
|
+
```js
|
138
|
+
ignore().add('#abc').ignores('#abc') // false
|
139
|
+
ignore().add('\\#abc').ignores('#abc') // true
|
140
|
+
```
|
141
|
+
|
142
|
+
`pattern` could either be a line of ignore pattern or a string of multiple ignore patterns, which means we could just `ignore().add()` the content of a ignore file:
|
143
|
+
|
144
|
+
```js
|
145
|
+
ignore()
|
146
|
+
.add(fs.readFileSync(filenameOfGitignore).toString())
|
147
|
+
.filter(filenames)
|
148
|
+
```
|
149
|
+
|
150
|
+
`pattern` could also be an `ignore` instance, so that we could easily inherit the rules of another `Ignore` instance.
|
151
|
+
|
152
|
+
## <strike>.addIgnoreFile(path)</strike>
|
153
|
+
|
154
|
+
REMOVED in `3.x` for now.
|
155
|
+
|
156
|
+
To upgrade `ignore@2.x` up to `3.x`, use
|
157
|
+
|
158
|
+
```js
|
159
|
+
import fs from 'fs'
|
160
|
+
|
161
|
+
if (fs.existsSync(filename)) {
|
162
|
+
ignore().add(fs.readFileSync(filename).toString())
|
163
|
+
}
|
164
|
+
```
|
165
|
+
|
166
|
+
instead.
|
167
|
+
|
168
|
+
## .filter(paths: Array<Pathname>): Array<Pathname>
|
169
|
+
|
170
|
+
```ts
|
171
|
+
type Pathname = string
|
172
|
+
```
|
173
|
+
|
174
|
+
Filters the given array of pathnames, and returns the filtered array.
|
175
|
+
|
176
|
+
- **paths** `Array.<Pathname>` The array of `pathname`s to be filtered.
|
177
|
+
|
178
|
+
### `Pathname` Conventions:
|
179
|
+
|
180
|
+
#### 1. `Pathname` should be a `path.relative()`d pathname
|
181
|
+
|
182
|
+
`Pathname` should be a string that have been `path.join()`ed, or the return value of `path.relative()` to the current directory,
|
183
|
+
|
184
|
+
```js
|
185
|
+
// WRONG, an error will be thrown
|
186
|
+
ig.ignores('./abc')
|
187
|
+
|
188
|
+
// WRONG, for it will never happen, and an error will be thrown
|
189
|
+
// If the gitignore rule locates at the root directory,
|
190
|
+
// `'/abc'` should be changed to `'abc'`.
|
191
|
+
// ```
|
192
|
+
// path.relative('/', '/abc') -> 'abc'
|
193
|
+
// ```
|
194
|
+
ig.ignores('/abc')
|
195
|
+
|
196
|
+
// WRONG, that it is an absolute path on Windows, an error will be thrown
|
197
|
+
ig.ignores('C:\\abc')
|
198
|
+
|
199
|
+
// Right
|
200
|
+
ig.ignores('abc')
|
201
|
+
|
202
|
+
// Right
|
203
|
+
ig.ignores(path.join('./abc')) // path.join('./abc') -> 'abc'
|
204
|
+
```
|
205
|
+
|
206
|
+
In other words, each `Pathname` here should be a relative path to the directory of the gitignore rules.
|
207
|
+
|
208
|
+
Suppose the dir structure is:
|
209
|
+
|
210
|
+
```
|
211
|
+
/path/to/your/repo
|
212
|
+
|-- a
|
213
|
+
| |-- a.js
|
214
|
+
|
|
215
|
+
|-- .b
|
216
|
+
|
|
217
|
+
|-- .c
|
218
|
+
|-- .DS_store
|
219
|
+
```
|
220
|
+
|
221
|
+
Then the `paths` might be like this:
|
222
|
+
|
223
|
+
```js
|
224
|
+
[
|
225
|
+
'a/a.js'
|
226
|
+
'.b',
|
227
|
+
'.c/.DS_store'
|
228
|
+
]
|
229
|
+
```
|
230
|
+
|
231
|
+
#### 2. filenames and dirnames
|
232
|
+
|
233
|
+
`node-ignore` does NO `fs.stat` during path matching, so for the example below:
|
234
|
+
|
235
|
+
```js
|
236
|
+
// First, we add a ignore pattern to ignore a directory
|
237
|
+
ig.add('config/')
|
238
|
+
|
239
|
+
// `ig` does NOT know if 'config', in the real world,
|
240
|
+
// is a normal file, directory or something.
|
241
|
+
|
242
|
+
ig.ignores('config')
|
243
|
+
// `ig` treats `config` as a file, so it returns `false`
|
244
|
+
|
245
|
+
ig.ignores('config/')
|
246
|
+
// returns `true`
|
247
|
+
```
|
248
|
+
|
249
|
+
Specially for people who develop some library based on `node-ignore`, it is important to understand that.
|
250
|
+
|
251
|
+
Usually, you could use [`glob`](http://npmjs.org/package/glob) with `option.mark = true` to fetch the structure of the current directory:
|
252
|
+
|
253
|
+
```js
|
254
|
+
import glob from 'glob'
|
255
|
+
|
256
|
+
glob('**', {
|
257
|
+
// Adds a / character to directory matches.
|
258
|
+
mark: true
|
259
|
+
}, (err, files) => {
|
260
|
+
if (err) {
|
261
|
+
return console.error(err)
|
262
|
+
}
|
263
|
+
|
264
|
+
let filtered = ignore().add(patterns).filter(files)
|
265
|
+
console.log(filtered)
|
266
|
+
})
|
267
|
+
```
|
268
|
+
|
269
|
+
## .ignores(pathname: Pathname): boolean
|
270
|
+
|
271
|
+
> new in 3.2.0
|
272
|
+
|
273
|
+
Returns `Boolean` whether `pathname` should be ignored.
|
274
|
+
|
275
|
+
```js
|
276
|
+
ig.ignores('.abc/a.js') // true
|
277
|
+
```
|
278
|
+
|
279
|
+
## .createFilter()
|
280
|
+
|
281
|
+
Creates a filter function which could filter an array of paths with `Array.prototype.filter`.
|
282
|
+
|
283
|
+
Returns `function(path)` the filter function.
|
284
|
+
|
285
|
+
## .test(pathname: Pathname) since 5.0.0
|
286
|
+
|
287
|
+
Returns `TestResult`
|
288
|
+
|
289
|
+
```ts
|
290
|
+
interface TestResult {
|
291
|
+
ignored: boolean
|
292
|
+
// true if the `pathname` is finally unignored by some negative pattern
|
293
|
+
unignored: boolean
|
294
|
+
}
|
295
|
+
```
|
296
|
+
|
297
|
+
- `{ignored: true, unignored: false}`: the `pathname` is ignored
|
298
|
+
- `{ignored: false, unignored: true}`: the `pathname` is unignored
|
299
|
+
- `{ignored: false, unignored: false}`: the `pathname` is never matched by any ignore rules.
|
300
|
+
|
301
|
+
## static `ignore.isPathValid(pathname): boolean` since 5.0.0
|
302
|
+
|
303
|
+
Check whether the `pathname` is an valid `path.relative()`d path according to the [convention](#1-pathname-should-be-a-pathrelatived-pathname).
|
304
|
+
|
305
|
+
This method is **NOT** used to check if an ignore pattern is valid.
|
306
|
+
|
307
|
+
```js
|
308
|
+
ignore.isPathValid('./foo') // false
|
309
|
+
```
|
310
|
+
|
311
|
+
## ignore(options)
|
312
|
+
|
313
|
+
### `options.ignorecase` since 4.0.0
|
314
|
+
|
315
|
+
Similar as the `core.ignorecase` option of [git-config](https://git-scm.com/docs/git-config), `node-ignore` will be case insensitive if `options.ignorecase` is set to `true` (the default value), otherwise case sensitive.
|
316
|
+
|
317
|
+
```js
|
318
|
+
const ig = ignore({
|
319
|
+
ignorecase: false
|
320
|
+
})
|
321
|
+
|
322
|
+
ig.add('*.png')
|
323
|
+
|
324
|
+
ig.ignores('*.PNG') // false
|
325
|
+
```
|
326
|
+
|
327
|
+
### `options.ignoreCase?: boolean` since 5.2.0
|
328
|
+
|
329
|
+
Which is alternative to `options.ignoreCase`
|
330
|
+
|
331
|
+
### `options.allowRelativePaths?: boolean` since 5.2.0
|
332
|
+
|
333
|
+
This option brings backward compatibility with projects which based on `ignore@4.x`. If `options.allowRelativePaths` is `true`, `ignore` will not check whether the given path to be tested is [`path.relative()`d](#pathname-conventions).
|
334
|
+
|
335
|
+
However, passing a relative path, such as `'./foo'` or `'../foo'`, to test if it is ignored or not is not a good practise, which might lead to unexpected behavior
|
336
|
+
|
337
|
+
```js
|
338
|
+
ignore({
|
339
|
+
allowRelativePaths: true
|
340
|
+
}).ignores('../foo/bar.js') // And it will not throw
|
341
|
+
```
|
342
|
+
|
343
|
+
****
|
344
|
+
|
345
|
+
# Upgrade Guide
|
346
|
+
|
347
|
+
## Upgrade 4.x -> 5.x
|
348
|
+
|
349
|
+
Since `5.0.0`, if an invalid `Pathname` passed into `ig.ignores()`, an error will be thrown, unless `options.allowRelative = true` is passed to the `Ignore` factory.
|
350
|
+
|
351
|
+
While `ignore < 5.0.0` did not make sure what the return value was, as well as
|
352
|
+
|
353
|
+
```ts
|
354
|
+
.ignores(pathname: Pathname): boolean
|
355
|
+
|
356
|
+
.filter(pathnames: Array<Pathname>): Array<Pathname>
|
357
|
+
|
358
|
+
.createFilter(): (pathname: Pathname) => boolean
|
359
|
+
|
360
|
+
.test(pathname: Pathname): {ignored: boolean, unignored: boolean}
|
361
|
+
```
|
362
|
+
|
363
|
+
See the convention [here](#1-pathname-should-be-a-pathrelatived-pathname) for details.
|
364
|
+
|
365
|
+
If there are invalid pathnames, the conversion and filtration should be done by users.
|
366
|
+
|
367
|
+
```js
|
368
|
+
import {isPathValid} from 'ignore' // introduced in 5.0.0
|
369
|
+
|
370
|
+
const paths = [
|
371
|
+
// invalid
|
372
|
+
//////////////////
|
373
|
+
'',
|
374
|
+
false,
|
375
|
+
'../foo',
|
376
|
+
'.',
|
377
|
+
//////////////////
|
378
|
+
|
379
|
+
// valid
|
380
|
+
'foo'
|
381
|
+
]
|
382
|
+
.filter(isValidPath)
|
383
|
+
|
384
|
+
ig.filter(paths)
|
385
|
+
```
|
386
|
+
|
387
|
+
## Upgrade 3.x -> 4.x
|
388
|
+
|
389
|
+
Since `4.0.0`, `ignore` will no longer support node < 6, to use `ignore` in node < 6:
|
390
|
+
|
391
|
+
```js
|
392
|
+
var ignore = require('ignore/legacy')
|
393
|
+
```
|
394
|
+
|
395
|
+
## Upgrade 2.x -> 3.x
|
396
|
+
|
397
|
+
- All `options` of 2.x are unnecessary and removed, so just remove them.
|
398
|
+
- `ignore()` instance is no longer an [`EventEmitter`](nodejs.org/api/events.html), and all events are unnecessary and removed.
|
399
|
+
- `.addIgnoreFile()` is removed, see the [.addIgnoreFile](#addignorefilepath) section for details.
|
400
|
+
|
401
|
+
****
|
402
|
+
|
403
|
+
# Collaborators
|
404
|
+
|
405
|
+
- [@whitecolor](https://github.com/whitecolor) *Alex*
|
406
|
+
- [@SamyPesse](https://github.com/SamyPesse) *Samy Pessé*
|
407
|
+
- [@azproduction](https://github.com/azproduction) *Mikhail Davydov*
|
408
|
+
- [@TrySound](https://github.com/TrySound) *Bogdan Chadkin*
|
409
|
+
- [@JanMattner](https://github.com/JanMattner) *Jan Mattner*
|
410
|
+
- [@ntwb](https://github.com/ntwb) *Stephen Edgar*
|
411
|
+
- [@kasperisager](https://github.com/kasperisager) *Kasper Isager*
|
412
|
+
- [@sandersn](https://github.com/sandersn) *Nathan Shively-Sanders*
|
@@ -0,0 +1,61 @@
|
|
1
|
+
type Pathname = string
|
2
|
+
|
3
|
+
interface TestResult {
|
4
|
+
ignored: boolean
|
5
|
+
unignored: boolean
|
6
|
+
}
|
7
|
+
|
8
|
+
export interface Ignore {
|
9
|
+
/**
|
10
|
+
* Adds one or several rules to the current manager.
|
11
|
+
* @param {string[]} patterns
|
12
|
+
* @returns IgnoreBase
|
13
|
+
*/
|
14
|
+
add(patterns: string | Ignore | readonly (string | Ignore)[]): this
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Filters the given array of pathnames, and returns the filtered array.
|
18
|
+
* NOTICE that each path here should be a relative path to the root of your repository.
|
19
|
+
* @param paths the array of paths to be filtered.
|
20
|
+
* @returns The filtered array of paths
|
21
|
+
*/
|
22
|
+
filter(pathnames: readonly Pathname[]): Pathname[]
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Creates a filter function which could filter
|
26
|
+
* an array of paths with Array.prototype.filter.
|
27
|
+
*/
|
28
|
+
createFilter(): (pathname: Pathname) => boolean
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Returns Boolean whether pathname should be ignored.
|
32
|
+
* @param {string} pathname a path to check
|
33
|
+
* @returns boolean
|
34
|
+
*/
|
35
|
+
ignores(pathname: Pathname): boolean
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Returns whether pathname should be ignored or unignored
|
39
|
+
* @param {string} pathname a path to check
|
40
|
+
* @returns TestResult
|
41
|
+
*/
|
42
|
+
test(pathname: Pathname): TestResult
|
43
|
+
}
|
44
|
+
|
45
|
+
interface Options {
|
46
|
+
ignorecase?: boolean
|
47
|
+
// For compatibility
|
48
|
+
ignoreCase?: boolean
|
49
|
+
allowRelativePaths?: boolean
|
50
|
+
}
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Creates new ignore manager.
|
54
|
+
*/
|
55
|
+
declare function ignore(options?: Options): Ignore
|
56
|
+
|
57
|
+
declare namespace ignore {
|
58
|
+
export function isPathValid (pathname: string): boolean
|
59
|
+
}
|
60
|
+
|
61
|
+
export default ignore
|