@putout/processor-ignore 1.0.3 → 3.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 +10 -12
  3. package/package.json +18 -15
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,7 +1,5 @@
1
- 'use strict';
2
-
3
- const rmLast = (a) => a.slice(0, -1);
4
- const addNewLine = (a) => /\n$/.test(a) ? a : `${a}\n`;
1
+ const {stringify} = JSON;
2
+ const rmLast = (a) => !a.endsWith('\n') ? a : a.slice(0, -1);
5
3
 
6
4
  const prefix = '__putout_processor_ignore(';
7
5
  const sufix = ');';
@@ -10,11 +8,12 @@ const parse = (a) => {
10
8
  return fn();
11
9
  };
12
10
 
13
- module.exports.files = [
11
+ export const files = [
14
12
  '*ignore',
13
+ '*rc',
15
14
  ];
16
15
 
17
- module.exports.preProcess = (rawSource) => {
16
+ export const branch = (rawSource) => {
18
17
  const array = convertToArray(rawSource);
19
18
  const source = `${prefix}${array}${sufix}`;
20
19
 
@@ -25,7 +24,7 @@ module.exports.preProcess = (rawSource) => {
25
24
  }];
26
25
  };
27
26
 
28
- module.exports.postProcess = (rawSource, list) => {
27
+ export const merge = (rawSource, list) => {
29
28
  const [source] = list;
30
29
  const length = source.length - sufix.length;
31
30
  const str = source.slice(prefix.length, length);
@@ -34,10 +33,9 @@ module.exports.postProcess = (rawSource, list) => {
34
33
  return array.join('\n') + '\n';
35
34
  };
36
35
 
37
- function convertToArray(line) {
38
- const lines = addNewLine(line).split('\n');
39
- const result = '"' + rmLast(lines.join('", "'));
40
-
41
- return `[${result}]`;
36
+ function convertToArray(str) {
37
+ const safeStr = str.replace(/\r/g, '');
38
+ const lines = rmLast(safeStr).split(/\n/g);
39
+ return stringify(lines);
42
40
  }
43
41
 
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@putout/processor-ignore",
3
- "version": "1.0.3",
3
+ "version": "3.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,
@@ -16,8 +17,11 @@
16
17
  "test": "madrun test",
17
18
  "watch:test": "madrun watch:test",
18
19
  "lint": "madrun lint",
20
+ "fresh:lint": "madrun fresh:lint",
21
+ "lint:fresh": "madrun lint:fresh",
19
22
  "fix:lint": "madrun fix:lint",
20
- "coverage": "madrun coverage"
23
+ "coverage": "madrun coverage",
24
+ "report": "madrun report"
21
25
  },
22
26
  "dependencies": {},
23
27
  "keywords": [
@@ -26,24 +30,23 @@
26
30
  "ignore"
27
31
  ],
28
32
  "devDependencies": {
29
- "@putout/engine-processor": "^2.0.0",
30
- "coveralls": "^3.0.0",
31
- "eslint": "^7.0.0",
33
+ "@putout/engine-processor": "*",
34
+ "@putout/test": "^5.0.0",
35
+ "c8": "^7.5.0",
36
+ "eslint": "^8.0.1",
32
37
  "eslint-plugin-node": "^11.0.0",
33
- "eslint-plugin-putout": "^6.0.0",
34
- "lerna": "^3.8.5",
35
- "madrun": "^8.0.1",
38
+ "eslint-plugin-putout": "^15.0.0",
39
+ "lerna": "^4.0.0",
40
+ "madrun": "^9.0.0",
36
41
  "nodemon": "^2.0.1",
37
- "nyc": "^15.0.1",
38
- "putout": "*",
39
- "supertape": "^3.4.2"
42
+ "putout": "*"
40
43
  },
41
44
  "peerDependencies": {
42
- "putout": ">=11"
45
+ "putout": ">=26"
43
46
  },
44
47
  "license": "MIT",
45
48
  "engines": {
46
- "node": ">=12"
49
+ "node": ">=16"
47
50
  },
48
51
  "publishConfig": {
49
52
  "access": "public"