redlint 3.17.2 β†’ 3.18.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 CHANGED
@@ -1,3 +1,15 @@
1
+ 2025.01.29, v3.18.1
2
+
3
+ feature:
4
+ - 610e884 redlint: putout v38.0.0
5
+ - a5c6f65 redlint: eslint-plugin-putout v24.0.0
6
+
7
+ 2025.01.27, v3.18.0
8
+
9
+ feature:
10
+ - cb83eaf redlint: rename to jsx: add
11
+ - 80584df redlint: @putout/plugin-eslint v10.0.0
12
+
1
13
  2025.01.21, v3.17.2
2
14
 
3
15
  feature:
package/bin/redlint.js CHANGED
@@ -23,9 +23,11 @@ import {debug} from '../lib/debug.js';
23
23
  import {logo} from '../lib/help/logo.js';
24
24
  import {version} from '../lib/cli/version.js';
25
25
  import {chooseConvert} from '../lib/convert/index.js';
26
+ import {chooseRename} from '../lib/rename/index.js';
26
27
  import {convert} from '../lib/convert/convert.js';
27
28
  import {masterConvert} from '../lib/convert/master.js';
28
29
  import {askFilename} from '../lib/dialog.js';
30
+ import {masterRename} from '../lib/rename/master.js';
29
31
  import {
30
32
  isScan,
31
33
  isScanDebug,
@@ -41,7 +43,10 @@ import {
41
43
  isVersion,
42
44
  isDebug,
43
45
  isConvert,
46
+ isRename,
44
47
  isConvertChosen,
48
+ isRenameToJsChosen,
49
+ isRenameToJsxChosen,
45
50
  isConvertChosenDebug,
46
51
  isBack,
47
52
  isExit,
@@ -92,6 +97,9 @@ async function uiLoop(arg) {
92
97
  if (isConvert(arg))
93
98
  arg = await chooseConvert();
94
99
 
100
+ if (isRename(arg))
101
+ arg = await chooseRename();
102
+
95
103
  if (isDebug(arg))
96
104
  arg = await debug();
97
105
 
@@ -130,6 +138,16 @@ async function uiLoop(arg) {
130
138
  return;
131
139
  }
132
140
 
141
+ if (isRenameToJsChosen(arg)) {
142
+ await masterRename('*.jsx', arg, filesystem);
143
+ return;
144
+ }
145
+
146
+ if (isRenameToJsxChosen(arg)) {
147
+ await masterRename('*.js', arg, filesystem);
148
+ return;
149
+ }
150
+
133
151
  if (isConvertChosenDebug(arg)) {
134
152
  const filename = await askFilename();
135
153
 
package/lib/choose.js CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  HELP,
10
10
  VERSION,
11
11
  CONVERT,
12
+ RENAME,
12
13
  DEBUG,
13
14
  EXIT,
14
15
  } from './menu.js';
@@ -17,6 +18,7 @@ export const choose = async () => {
17
18
  const command = await chooseDialog('Command:', [
18
19
  SCAN,
19
20
  FIX,
21
+ RENAME,
20
22
  CONVERT,
21
23
  PACK,
22
24
  EXTRACT,
package/lib/debug.js CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  FIX_DEBUG,
6
6
  CONVERT_JS_TO_JSON_DEBUG,
7
7
  CONVERT_JSON_TO_JS_DEBUG,
8
+ RENAME_JS_TO_JSX_DEBUG,
8
9
  BACK,
9
10
  EXIT,
10
11
  BUNDLE_DEBUG,
@@ -17,6 +18,8 @@ export const debug = async () => {
17
18
  PACK_DEBUG,
18
19
  CONVERT_JS_TO_JSON_DEBUG,
19
20
  CONVERT_JSON_TO_JS_DEBUG,
21
+ RENAME_JS_TO_JSX_DEBUG,
22
+ RENAME_JS_TO_JSX_DEBUG,
20
23
  BUNDLE_DEBUG,
21
24
  BACK,
22
25
  EXIT,
package/lib/menu.js CHANGED
@@ -14,6 +14,7 @@ export const HELP = 'οΈ– help';
14
14
  export const VERSION = 'πŸ“¦ version';
15
15
  export const DEBUG = 'πŸ”§ debug';
16
16
  export const CONVERT = '🐌 convert';
17
+ export const RENAME = 'πŸ¦” rename';
17
18
  export const BACK = 'πŸ”™ back';
18
19
  export const EXIT = 'πŸšͺ exit';
19
20
 
@@ -23,6 +24,11 @@ export const CONVERT_JS_TO_JSON_DEBUG = '🦏 convert js to json: debug';
23
24
  export const CONVERT_JSON_TO_JS = '🦏 convert json to js';
24
25
  export const CONVERT_JSON_TO_JS_DEBUG = '🦏 convert json to js: debug';
25
26
 
27
+ export const RENAME_JS_TO_JSX = '🦏 rename js to jsx';
28
+ export const RENAME_JS_TO_JSX_DEBUG = '🦏 rename js to jsx: debug';
29
+
30
+ export const RENAME_JSX_TO_JS = '🦏 rename jsx to js';
31
+ export const RENAME_JSX_TO_JS_DEBUG = '🦏 rename jsx to js: debug';
26
32
  export const isScan = (a) => a === SCAN || a === 'scan';
27
33
  export const isScanDebug = (a) => a === SCAN_DEBUG || a === 'scan:debug';
28
34
  export const isBundleDebug = (a) => a === BUNDLE_DEBUG || a === 'bundle:debug';
@@ -40,6 +46,7 @@ export const isDebug = (a) => a === DEBUG || a === 'debug';
40
46
  export const isBack = (a) => a === BACK || a === 'back';
41
47
  export const isExit = (a) => a === EXIT || a === 'exit';
42
48
  export const isConvert = (a) => a === CONVERT || a === 'convert';
49
+ export const isRename = (a) => a === RENAME || a === 'rename';
43
50
  export const isConvertChosen = (a) => {
44
51
  return [
45
52
  CONVERT_JSON_TO_JS,
@@ -47,8 +54,13 @@ export const isConvertChosen = (a) => {
47
54
  CONVERT_RC_TO_FLAT,
48
55
  ].includes(a);
49
56
  };
57
+ export const isRenameToJsxChosen = (a) => a === RENAME_JS_TO_JSX;
58
+ export const isRenameToJsChosen = (a) => a === RENAME_JSX_TO_JS;
50
59
  export const isConvertChosenDebug = (a) => a === CONVERT_JS_TO_JSON_DEBUG || a === CONVERT_JSON_TO_JS_DEBUG;
51
60
 
52
61
  export const isConvertToJson = (a) => a === CONVERT_JS_TO_JSON || a === CONVERT_JS_TO_JSON_DEBUG;
53
62
  export const isConvertToJs = (a) => a === CONVERT_JSON_TO_JS || a === CONVERT_JSON_TO_JS_DEBUG;
54
63
  export const isConvertRCToFlat = (a) => a === CONVERT_RC_TO_FLAT;
64
+
65
+ export const isRenameToJs = (a) => a === RENAME_JS_TO_JSX || a === RENAME_JS_TO_JSX_DEBUG;
66
+ export const isRenameToJsx = (a) => a === RENAME_JSX_TO_JS || a === RENAME_JSX_TO_JS_DEBUG;
@@ -0,0 +1,33 @@
1
+ import * as pluginReact from '@putout/plugin-react';
2
+ import {isRenameToJs, isRenameToJsx} from '../menu.js';
3
+
4
+ const [, pluginRenameJsxToJs] = pluginReact.rules['rename-file-jsx-to-js'];
5
+ const [, pluginRenameJsToJsx] = pluginReact.rules['rename-file-js-to-jsx'];
6
+
7
+ export const createOptions = (filename, type) => {
8
+ if (isRenameToJsx(type))
9
+ return {
10
+ rules: {
11
+ 'react/rename-jsx-to-js': ['on', {
12
+ filename,
13
+ }],
14
+ },
15
+ plugins: [
16
+ ['react/rename-jsx-to-js', pluginRenameJsxToJs],
17
+ ],
18
+ };
19
+
20
+ if (isRenameToJs(type))
21
+ return {
22
+ rules: {
23
+ 'react/rename-js-to-jsx': ['on', {
24
+ filename,
25
+ }],
26
+ },
27
+ plugins: [
28
+ ['react/rename-js-to-jsx', pluginRenameJsToJsx],
29
+ ],
30
+ };
31
+
32
+ return {};
33
+ };
@@ -0,0 +1,19 @@
1
+ import {choose as chooseDialog} from '@putout/cli-choose';
2
+ import {
3
+ RENAME_JS_TO_JSX,
4
+ RENAME_JSX_TO_JS,
5
+ BACK,
6
+ EXIT,
7
+ } from '../menu.js';
8
+
9
+ export * from './rename.js';
10
+ export const chooseRename = async () => {
11
+ const command = await chooseDialog('Rename:', [
12
+ RENAME_JS_TO_JSX,
13
+ RENAME_JSX_TO_JS,
14
+ BACK,
15
+ EXIT,
16
+ ]);
17
+
18
+ return command;
19
+ };
@@ -0,0 +1,39 @@
1
+ import {run} from '../run.js';
2
+ import {
3
+ setStart,
4
+ setEnd,
5
+ setPush,
6
+ setFail,
7
+ setSuccess,
8
+ setSuffixText,
9
+ } from '../spinner.js';
10
+
11
+ export function masterRename(filename, type, filesystem, overrides = {}) {
12
+ const {
13
+ start = setStart,
14
+ end = setEnd,
15
+ push = setPush,
16
+ fail = setFail,
17
+ success = setSuccess,
18
+ suffix = setSuffixText,
19
+ } = overrides;
20
+
21
+ const slave = new URL('./slave.js', import.meta.url);
22
+ const workerData = {
23
+ filename,
24
+ type,
25
+ filesystem,
26
+ };
27
+
28
+ return run({
29
+ fix: true,
30
+ start,
31
+ end,
32
+ push,
33
+ fail,
34
+ success,
35
+ slave,
36
+ workerData,
37
+ suffix,
38
+ });
39
+ }
@@ -0,0 +1,34 @@
1
+ import {
2
+ parse,
3
+ transform,
4
+ print,
5
+ } from 'putout';
6
+ import {createProgress} from '@putout/engine-runner/progress';
7
+ import {
8
+ branch as originalBranch,
9
+ merge as originalMerge,
10
+ } from '@putout/processor-filesystem';
11
+ import {createOptions} from './create-options.js';
12
+
13
+ export const rename = (filename, type, filesystem, overrides = {}) => {
14
+ const {
15
+ progress = createProgress(),
16
+ branch = originalBranch,
17
+ merge = originalMerge,
18
+ } = overrides;
19
+
20
+ const [{source}] = branch(filesystem);
21
+ const ast = parse(source);
22
+ const options = createOptions(filename, type);
23
+
24
+ transform(ast, filesystem, {
25
+ fix: true,
26
+ fixCount: 1,
27
+ progress,
28
+ ...options,
29
+ });
30
+
31
+ const code = print(ast);
32
+
33
+ return merge(filesystem, [code]);
34
+ };
@@ -0,0 +1,23 @@
1
+ import {parentPort, workerData} from 'node:worker_threads';
2
+ import {createProgress} from '@putout/engine-runner/progress';
3
+ import {rename} from './rename.js';
4
+ import {createSlave} from '../slave.js';
5
+
6
+ const {
7
+ filename,
8
+ type,
9
+ filesystem,
10
+ } = workerData;
11
+
12
+ const progress = createProgress();
13
+
14
+ await createSlave(runPack, {
15
+ progress,
16
+ parentPort,
17
+ });
18
+
19
+ async function runPack() {
20
+ return await rename(filename, type, filesystem, {
21
+ progress,
22
+ });
23
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redlint",
3
- "version": "3.17.2",
3
+ "version": "3.18.1",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Lint Filesystem with 🐊Putout",
@@ -38,9 +38,10 @@
38
38
  "@putout/formatter-dump": "^5.0.0",
39
39
  "@putout/operator-filesystem": "^5.1.0",
40
40
  "@putout/operator-json": "^2.0.0",
41
- "@putout/plugin-eslint": "^9.1.0",
41
+ "@putout/plugin-eslint": "^10.0.0",
42
42
  "@putout/plugin-filesystem": "^7.0.0",
43
43
  "@putout/plugin-nodejs": "^13.1.1",
44
+ "@putout/plugin-react": "^2.0.1",
44
45
  "@putout/processor-filesystem": "^5.0.0",
45
46
  "chalk": "^5.3.0",
46
47
  "ci-info": "^4.0.0",
@@ -48,7 +49,7 @@
48
49
  "fullstore": "^3.0.0",
49
50
  "ignore": "^7.0.0",
50
51
  "ora": "^8.0.1",
51
- "putout": "^37.0.1",
52
+ "putout": "^38.0.0",
52
53
  "strip-ansi": "^7.1.0",
53
54
  "try-to-catch": "^3.0.1"
54
55
  },
@@ -65,7 +66,7 @@
65
66
  "@putout/test": "^11.0.0",
66
67
  "c8": "^10.1.2",
67
68
  "eslint": "^9.0.0",
68
- "eslint-plugin-putout": "^23.0.0",
69
+ "eslint-plugin-putout": "^24.0.0",
69
70
  "estree-to-babel": "^10.0.1",
70
71
  "just-kebab-case": "^4.2.0",
71
72
  "madrun": "^10.0.0",