redlint 5.3.4 → 5.4.1
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/ChangeLog +10 -0
- package/README.md +29 -0
- package/bin/redlint.js +1 -0
- package/lib/help/help.js +17 -13
- package/lib/help/logo.js +9 -16
- package/lib/menu.js +1 -1
- package/lib/test/get-fixture-names/get-fixture-only-names-plugin/index.js +32 -0
- package/lib/test/get-fixture-names/index.js +10 -0
- package/package.json +2 -2
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -39,6 +39,35 @@ To scan your files use `redlint scan`:
|
|
|
39
39
|
|
|
40
40
|
<img width="718" alt="image" src="https://github.com/putoutjs/redlint/assets/1573141/58672a61-4408-4c1e-ab75-2fbcca7f225d">
|
|
41
41
|
|
|
42
|
+
## Rules
|
|
43
|
+
|
|
44
|
+
- ✅ [`madrun/rename-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-madrun#rename-file);
|
|
45
|
+
- ✅ [`package-json/find-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-package-json#find-file);
|
|
46
|
+
- ✅ [`package-json/remove-exports-with-missing-files`](https://github.com/coderaiser/putout/tree/master/packages/plugin-package-json#remove-exports-with-missing-files);
|
|
47
|
+
- ✅ [`esm/resolve-imported-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-esm#resolve-imported-file);
|
|
48
|
+
- ✅ [`esm/shorten-imported-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-esm#shorten-imported-file);
|
|
49
|
+
- ✅ [`esm/apply-name-to-imported-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-esm#apply-name-to-imported-file);
|
|
50
|
+
- ✅ [`esm/apply-namespace-to-imported-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-esm#apply-name-to-imported-file);
|
|
51
|
+
- ✅ [`esm/apply-privately-imported-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-esm#apply-privately-imported-file);
|
|
52
|
+
- ✅ [`esm/apply-js-imported-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-esm#apply-js-imported-file);
|
|
53
|
+
- ✅ [`putout-config/remove-empty-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-putout-config#remove-empty-file);
|
|
54
|
+
- ✅ [`typescript/find-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-typescript#find-file);
|
|
55
|
+
- ✅ [`typescript/cts-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-typescript#cts-file);
|
|
56
|
+
- ✅ [`typescript/mts-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-typescript#mts-file);
|
|
57
|
+
- ✅ [`typescript/rename-file-cts-to-ts`](https://github.com/coderaiser/putout/tree/master/packages/plugin-typescript#rename-file-cts-to-ts);
|
|
58
|
+
- ✅ [`typescript/rename-file-mts-to-ts`](https://github.com/coderaiser/putout/tree/master/packages/plugin-typescript#rename-file-mts-to-ts);
|
|
59
|
+
- ✅ [`nodejs/apply-privately-required-files`](https://github.com/coderaiser/putout/tree/master/packages/plugin-nodejs#apply-privately-required-files`);
|
|
60
|
+
- ✅ [`nodejs/cjs-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-nodejs#cjs-file`);
|
|
61
|
+
- ✅ [`nodejs/mjs-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-nodejs#mjs-file`);
|
|
62
|
+
- ✅ [`nodejs/rename-file-cjs-to-js`](https://github.com/coderaiser/putout/tree/master/packages/plugin-nodejs#rename-file-cjs-to-js`);
|
|
63
|
+
- ✅ [`nodejs/rename-file-mjs-to-js`](https://github.com/coderaiser/putout/tree/master/packages/plugin-nodejs#rename-file-mjs-to-js`);
|
|
64
|
+
- ✅ [`filesystem/remove-vim-swap-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-filesystem#remove-vim-swap-file`);
|
|
65
|
+
- ✅ [`filesystem/remove-files`](https://github.com/coderaiser/putout/tree/master/packages/plugin-filesystem#remove-files`);
|
|
66
|
+
- ✅ [`filesystem/remove-nyc-output-files`](https://github.com/coderaiser/putout/tree/master/packages/plugin-filesystem#remove-nyc-output-file`);
|
|
67
|
+
- ✅ [`filesystem/remove-travis-yml-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-filesystem#remove-travis-yml-file`);
|
|
68
|
+
- ✅ [`filesystem/remove-empty-directory`](https://github.com/coderaiser/putout/tree/master/packages/plugin-filesystem#remove-empty-directory`);
|
|
69
|
+
- ✅ [`filesystem/remove-ds-store-file`](https://github.com/coderaiser/putout/tree/master/packages/plugin-filesystem#remove-ds-store-file`);
|
|
70
|
+
|
|
42
71
|
## Convert
|
|
43
72
|
|
|
44
73
|
To convert file to **JSON** or **JavaScript** use:
|
package/bin/redlint.js
CHANGED
package/lib/help/help.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
|
+
import montag from 'montag';
|
|
2
3
|
import {logo} from './logo.js';
|
|
3
4
|
|
|
4
5
|
const {stdout} = process;
|
|
@@ -7,21 +8,24 @@ export const help = ({header = true}) => {
|
|
|
7
8
|
if (header) {
|
|
8
9
|
stdout.write('Lint your files according to 🐊Putout rules.\n\n');
|
|
9
10
|
process.stdout.write(logo);
|
|
10
|
-
stdout.write('\n');
|
|
11
|
+
stdout.write('\n\n');
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
stdout.write(`Usage: redlint [command]\n`);
|
|
14
15
|
|
|
15
|
-
stdout.write(`
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
stdout.write(montag`
|
|
17
|
+
Commands:
|
|
18
|
+
scan - scan files according to 🐊Putout rules
|
|
19
|
+
fix - fix files according to 🐊Putout rules
|
|
20
|
+
pack - pack 'filesystem.red' with directory contents
|
|
21
|
+
extract - extract directory contents from 'filesystem.red'
|
|
22
|
+
convert - convert one file type to another according to selected choice from menu
|
|
23
|
+
help - show help screen and exit
|
|
24
|
+
generate - generate .filesystem.json file and exit
|
|
25
|
+
generate:simple - generate simple .filesystem.json file and exit
|
|
26
|
+
version - show version and exit
|
|
27
|
+
debug - run commands without workers
|
|
28
|
+
`);
|
|
29
|
+
stdout.write('\n');
|
|
27
30
|
};
|
|
31
|
+
|
package/lib/help/logo.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
+
import montag from 'montag';
|
|
3
|
+
|
|
4
|
+
export const logo = montag`
|
|
5
|
+
${chalk.red('██████ ███████ ██████ ')} ██ ██ ███ ██ ████████
|
|
6
|
+
${chalk.red('██ ██ ██ ██ ██')} ██ ██ ████ ██ ██
|
|
7
|
+
${chalk.red('██████ █████ ██ ██')} ██ ██ ██ ██ ██ ██
|
|
8
|
+
${chalk.red('██ ██ ██ ██ ██')} ██ ██ ██ ██ ██ ██
|
|
9
|
+
${chalk.red('██ ██ ███████ ██████ ')} ███████ ██ ██ ████ ██
|
|
10
|
+
`;
|
|
2
11
|
|
|
3
|
-
/*
|
|
4
|
-
console.log(`
|
|
5
|
-
${chalk.red('██████ ███████ ██████ ')} ${chalk.white('██ ██ ███ ██ ████████ ')}
|
|
6
|
-
${chalk.red('██ ██ ██ ██ ██')} ${chalk.white('██ ██ ████ ██ ██ ')}
|
|
7
|
-
${chalk.red('██████ █████ ██ ██')} ${chalk.white('██ ██ ██ ██ ██ ██ ')}
|
|
8
|
-
${chalk.red('██ ██ ██ ██ ██')} ${chalk.white('██ ██ ██ ██ ██ ██ ')}
|
|
9
|
-
${chalk.red('██ ██ ███████ ██████ ')} ${chalk.white('███████ ██ ██ ████ ██ ')}
|
|
10
|
-
`);
|
|
11
|
-
*/
|
|
12
|
-
export const logo = `
|
|
13
|
-
${chalk.red('██████ ███████ ██████ ')} ██ ██ ███ ██ ████████
|
|
14
|
-
${chalk.red('██ ██ ██ ██ ██')} ██ ██ ████ ██ ██
|
|
15
|
-
${chalk.red('██████ █████ ██ ██')} ██ ██ ██ ██ ██ ██
|
|
16
|
-
${chalk.red('██ ██ ██ ██ ██')} ██ ██ ██ ██ ██ ██
|
|
17
|
-
${chalk.red('██ ██ ███████ ██████ ')} ███████ ██ ██ ████ ██
|
|
18
|
-
`.slice(1);
|
package/lib/menu.js
CHANGED
|
@@ -42,7 +42,7 @@ export const isExtract = (a) => a === EXTRACT || a === 'extract';
|
|
|
42
42
|
export const isExtractDebug = (a) => a === EXTRACT_DEBUG || a === 'extract:debug';
|
|
43
43
|
export const isGenerate = (a) => a === GENERATE || a === 'generate';
|
|
44
44
|
export const isGenerateSimple = (a) => a === GENERATE_SIMPLE || a === 'generate:simple';
|
|
45
|
-
export const isHelp = (a) => a === HELP || a === 'help';
|
|
45
|
+
export const isHelp = (a) => a === '-h' || a === '--help' || a === HELP || a === 'help';
|
|
46
46
|
export const isVersion = (a) => a === VERSION || a === 'version' || a === '-v';
|
|
47
47
|
export const isTest = (a) => a === TEST || a === 'test';
|
|
48
48
|
export const isDebug = (a) => a === DEBUG || a === 'debug';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {operator} from 'putout';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
getTemplateValues,
|
|
5
|
+
compare,
|
|
6
|
+
} = operator;
|
|
7
|
+
|
|
8
|
+
const TRANSFORM = 't.transform(__a)';
|
|
9
|
+
const TRANSFORM_COUPLE = 't.transform(__a, __b)';
|
|
10
|
+
|
|
11
|
+
export const report = (path) => parseValue(path);
|
|
12
|
+
|
|
13
|
+
export const fix = () => {};
|
|
14
|
+
|
|
15
|
+
export const include = () => [TRANSFORM, TRANSFORM_COUPLE];
|
|
16
|
+
|
|
17
|
+
export const filter = (path) => {
|
|
18
|
+
return compare(path.parentPath.parentPath, 'test.only(__a, __b)');
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function parseValue(path) {
|
|
22
|
+
const {length} = path.node.arguments;
|
|
23
|
+
|
|
24
|
+
if (length === 1) {
|
|
25
|
+
const {__a} = getTemplateValues(path, TRANSFORM);
|
|
26
|
+
return __a.value;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const {__a} = getTemplateValues(path, TRANSFORM_COUPLE);
|
|
30
|
+
|
|
31
|
+
return __a.value;
|
|
32
|
+
}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import {putout} from 'putout';
|
|
2
2
|
import * as getFixtureNamesPlugin from './get-fixture-names-plugin/index.js';
|
|
3
|
+
import * as getFixtureOnlyNamesPlugin from './get-fixture-only-names-plugin/index.js';
|
|
3
4
|
|
|
4
5
|
const getName = (a) => a.message;
|
|
6
|
+
const isOnly = (a) => a.rule === 'get-fixture-only-names';
|
|
5
7
|
|
|
6
8
|
export const getFixtureNames = (source) => {
|
|
7
9
|
const {places} = putout(source, {
|
|
8
10
|
fix: false,
|
|
9
11
|
plugins: [
|
|
10
12
|
['get-fixture-names', getFixtureNamesPlugin],
|
|
13
|
+
['get-fixture-only-names', getFixtureOnlyNamesPlugin],
|
|
11
14
|
],
|
|
12
15
|
});
|
|
13
16
|
|
|
17
|
+
const fixturesOnly = places.filter(isOnly);
|
|
18
|
+
|
|
19
|
+
if (fixturesOnly.length) {
|
|
20
|
+
const names = fixturesOnly.map(getName);
|
|
21
|
+
return convertToTuple(names);
|
|
22
|
+
}
|
|
23
|
+
|
|
14
24
|
const names = places.map(getName);
|
|
15
25
|
|
|
16
26
|
return convertToTuple(names);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redlint",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "Lint Filesystem with 🐊Putout",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"fullstore": "^4.0.0",
|
|
52
52
|
"ignore": "^7.0.0",
|
|
53
53
|
"jest-diff": "^30.2.0",
|
|
54
|
+
"montag": "^1.2.1",
|
|
54
55
|
"obligator": "^3.0.0",
|
|
55
56
|
"ora": "^9.0.0",
|
|
56
57
|
"putout": "^41.2.0",
|
|
@@ -73,7 +74,6 @@
|
|
|
73
74
|
"eslint-plugin-putout": "^30.0.0",
|
|
74
75
|
"just-kebab-case": "^4.2.0",
|
|
75
76
|
"madrun": "^12.0.0",
|
|
76
|
-
"montag": "^1.0.0",
|
|
77
77
|
"nodemon": "^3.0.1",
|
|
78
78
|
"supertape": "^12.0.7"
|
|
79
79
|
},
|