@putout/plugin-gitignore 4.0.0 → 6.0.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.
- package/lib/gitignore.js +19 -61
- package/package.json +10 -10
package/lib/gitignore.js
CHANGED
|
@@ -1,64 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
import {operator} from 'putout';
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
const {
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const {ignore, __ignore} = operator;
|
|
4
|
+
const {
|
|
5
|
+
match,
|
|
6
|
+
replace,
|
|
7
|
+
report,
|
|
8
|
+
} = ignore(__ignore, {
|
|
9
|
+
name: '.gitignore',
|
|
10
|
+
list: [
|
|
11
|
+
'.idea',
|
|
12
|
+
'*.swp',
|
|
13
|
+
'yarn-error.log',
|
|
14
|
+
'coverage',
|
|
15
|
+
],
|
|
16
|
+
});
|
|
7
17
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
'coverage',
|
|
13
|
-
];
|
|
14
|
-
|
|
15
|
-
module.exports.report = () => `Dot files should be added to .gitignore`;
|
|
16
|
-
|
|
17
|
-
module.exports.match = ({options}) => {
|
|
18
|
-
const {dismiss = []} = options;
|
|
19
|
-
const newNames = filterNames(names, dismiss);
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
[__ignore]: ({__array}) => {
|
|
23
|
-
const list = __array.elements.map(getValue);
|
|
24
|
-
|
|
25
|
-
for (const name of newNames) {
|
|
26
|
-
if (!list.includes(name))
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return false;
|
|
31
|
-
},
|
|
32
|
-
};
|
|
18
|
+
export {
|
|
19
|
+
match,
|
|
20
|
+
replace,
|
|
21
|
+
report,
|
|
33
22
|
};
|
|
34
|
-
|
|
35
|
-
module.exports.replace = ({options}) => {
|
|
36
|
-
const {dismiss = []} = options;
|
|
37
|
-
const newNames = filterNames(names, dismiss);
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
[__ignore]: ({__array}, path) => {
|
|
41
|
-
const list = __array.elements.map(getValue);
|
|
42
|
-
|
|
43
|
-
for (const name of newNames) {
|
|
44
|
-
if (!list.includes(name))
|
|
45
|
-
__array.elements.push(StringLiteral(name));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return path;
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
function filterNames(names, dismiss) {
|
|
54
|
-
const newNames = [];
|
|
55
|
-
|
|
56
|
-
for (const name of names) {
|
|
57
|
-
if (dismiss.includes(name))
|
|
58
|
-
continue;
|
|
59
|
-
|
|
60
|
-
newNames.push(name);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return newNames;
|
|
64
|
-
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-gitignore",
|
|
3
|
-
"version": "
|
|
4
|
-
"type": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
|
+
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout plugin helps with .gitignore",
|
|
7
7
|
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-gitignore#readme",
|
|
@@ -31,21 +31,21 @@
|
|
|
31
31
|
"gitignore"
|
|
32
32
|
],
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@putout/test": "^
|
|
35
|
-
"c8": "^
|
|
36
|
-
"eslint": "^
|
|
37
|
-
"eslint-plugin-n": "^
|
|
38
|
-
"eslint-plugin-putout": "^
|
|
34
|
+
"@putout/test": "^9.0.0",
|
|
35
|
+
"c8": "^9.0.0",
|
|
36
|
+
"eslint": "^9.0.0",
|
|
37
|
+
"eslint-plugin-n": "^17.0.0",
|
|
38
|
+
"eslint-plugin-putout": "^22.0.0",
|
|
39
39
|
"lerna": "^6.0.1",
|
|
40
|
-
"madrun": "^
|
|
40
|
+
"madrun": "^10.0.0",
|
|
41
41
|
"nodemon": "^3.0.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"putout": ">=
|
|
44
|
+
"putout": ">=35"
|
|
45
45
|
},
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"engines": {
|
|
48
|
-
"node": ">=
|
|
48
|
+
"node": ">=18"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|