@putout/processor-ignore 2.0.0 → 4.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.
Files changed (3) hide show
  1. package/README.md +2 -4
  2. package/lib/ignore.js +6 -7
  3. package/package.json +12 -11
package/README.md CHANGED
@@ -1,11 +1,9 @@
1
- # @putout/processor-ignore [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL]
1
+ # @putout/processor-ignore [![NPM version][NPMIMGURL]][NPMURL]
2
2
 
3
3
  [NPMIMGURL]: https://img.shields.io/npm/v/@putout/processor-ignore.svg?style=flat&longCache=true
4
4
  [NPMURL]: https://npmjs.org/package/@putout/processor-ignore "npm"
5
- [DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/processor-ignore
6
- [DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/processor-ignore
7
5
 
8
- `putout` processor adds support of `ignore` files, like [.gitignore](https://git-scm.com/docs/gitignore) and [.eslintignore](https://eslint.org/docs/user-guide/configuring#eslintignore)
6
+ 🐊**Putout** processor adds support of `ignore` files, like [.gitignore](https://git-scm.com/docs/gitignore) and [.eslintignore](https://eslint.org/docs/user-guide/configuring#eslintignore)
9
7
 
10
8
  ## Install
11
9
 
package/lib/ignore.js CHANGED
@@ -1,21 +1,19 @@
1
- 'use strict';
2
-
3
1
  const {stringify} = JSON;
4
- const rmLast = (a) => !/\n$/.test(a) ? a : a.slice(0, -1);
2
+ const rmLast = (a) => !a.endsWith('\n') ? a : a.slice(0, -1);
5
3
 
6
4
  const prefix = '__putout_processor_ignore(';
7
- const sufix = ');';
5
+ const sufix = ');\n';
8
6
  const parse = (a) => {
9
7
  const fn = Function(`return ${a}`);
10
8
  return fn();
11
9
  };
12
10
 
13
- module.exports.files = [
11
+ export const files = [
14
12
  '*ignore',
15
13
  '*rc',
16
14
  ];
17
15
 
18
- module.exports.branch = (rawSource) => {
16
+ export const branch = (rawSource) => {
19
17
  const array = convertToArray(rawSource);
20
18
  const source = `${prefix}${array}${sufix}`;
21
19
 
@@ -26,7 +24,7 @@ module.exports.branch = (rawSource) => {
26
24
  }];
27
25
  };
28
26
 
29
- module.exports.merge = (rawSource, list) => {
27
+ export const merge = (rawSource, list) => {
30
28
  const [source] = list;
31
29
  const length = source.length - sufix.length;
32
30
  const str = source.slice(prefix.length, length);
@@ -38,6 +36,7 @@ module.exports.merge = (rawSource, list) => {
38
36
  function convertToArray(str) {
39
37
  const safeStr = str.replace(/\r/g, '');
40
38
  const lines = rmLast(safeStr).split(/\n/g);
39
+
41
40
  return stringify(lines);
42
41
  }
43
42
 
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@putout/processor-ignore",
3
- "version": "2.0.0",
3
+ "version": "4.0.0",
4
+ "type": "module",
4
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
5
- "description": "putout processor adds ability to lint ignore",
6
- "homepage": "http://github.com/coderaiser/putout",
6
+ "description": "🐊Putout processor adds ability to lint ignore",
7
+ "homepage": "https://github.com/coderaiser/putout/tree/master/packages/processor-ignore#readme",
7
8
  "main": "lib/ignore.js",
8
9
  "release": false,
9
10
  "tag": false,
@@ -30,22 +31,22 @@
30
31
  ],
31
32
  "devDependencies": {
32
33
  "@putout/engine-processor": "*",
33
- "@putout/test": "*",
34
+ "@putout/test": "^6.0.0",
34
35
  "c8": "^7.5.0",
35
- "eslint": "^7.0.0",
36
- "eslint-plugin-node": "^11.0.0",
37
- "eslint-plugin-putout": "^8.0.0",
38
- "lerna": "^4.0.0",
39
- "madrun": "^8.0.1",
36
+ "eslint": "^8.0.1",
37
+ "eslint-plugin-n": "^15.2.4",
38
+ "eslint-plugin-putout": "^17.0.0",
39
+ "lerna": "^6.0.1",
40
+ "madrun": "^9.0.0",
40
41
  "nodemon": "^2.0.1",
41
42
  "putout": "*"
42
43
  },
43
44
  "peerDependencies": {
44
- "putout": ">=18"
45
+ "putout": ">=29"
45
46
  },
46
47
  "license": "MIT",
47
48
  "engines": {
48
- "node": ">=14"
49
+ "node": ">=16"
49
50
  },
50
51
  "publishConfig": {
51
52
  "access": "public"