immosquare-cleaner 0.1.37 → 0.1.38

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c030c05f23229f944ba787e6850bdbd1184fe0f4ff8e11f3132e9adb87393513
4
- data.tar.gz: a62492be16c026632af02d92d8e5148f8921f14b5bccdcc108d2fb7b4e9b600a
3
+ metadata.gz: 826f3aa2e653950168ccbbb34157ad1096e6a9e70f2c017e5bd3081ab7757114
4
+ data.tar.gz: b2363325006e03329f63de37f1c62801f8bc57ca4570511fb367e4dfd80869ac
5
5
  SHA512:
6
- metadata.gz: 64605783d9491ef0153aed196a3b26c33c685d098655a3ed9e9c061175ab734dd0bfc511306c7b65507114fb32964c6bf0979941c666a507f7b1029a736d64d4
7
- data.tar.gz: 170c2d8bbf624fb1ddb6409a1a489e6278a2091983a289c0ad2a79f85840efe223846f814a7e96d51678eda96595f417b5ab55fbeae6fc3a224a9a41f4c57a72
6
+ metadata.gz: 1a0f7f2846f19cac93d25f63d29527e6eb9297fda94e1a0058e45abbee950c447f97f354ad79f5ba85da58aac0e8f2afaa5003c1c45f21bbea38e4aca58b3b59
7
+ data.tar.gz: '09aed90bad520d075dd1b951f5654df5c97f053776d8f7b3dc62668eac92fbb190061d1b6313b629320bb85cd9b2b24c50a97071a7ca24a16c271b1f91275697'
@@ -1,3 +1,3 @@
1
1
  module ImmosquareCleaner
2
- VERSION = "0.1.37".freeze
2
+ VERSION = "0.1.38".freeze
3
3
  end
@@ -105,9 +105,8 @@ module ImmosquareCleaner
105
105
  File.write(temp_file_path, File.read(file_path))
106
106
  cmds = [
107
107
  "bun eslint --config #{gem_root}/linters/eslint.config.mjs #{temp_file_path} --fix",
108
- "bun jscodeshift -t #{gem_root}/linters/jscodeshift/arrow-function-transform.js #{temp_file_path}"
108
+ "bun jscodeshift --silent --transform #{gem_root}/linters/jscodeshift/arrow-function-transform.js #{temp_file_path}"
109
109
  ]
110
- puts(cmds)
111
110
  launch_cmds(cmds)
112
111
  File.normalize_last_line(temp_file_path)
113
112
  File.write(file_path, File.read(temp_file_path))
@@ -2,33 +2,40 @@ module.exports = (fileInfo, api) => {
2
2
  const j = api.jscodeshift
3
3
  const root = j(fileInfo.source)
4
4
 
5
- // Trouver toutes les expressions de fonction
6
- const functions = root.find(j.FunctionExpression)
5
+ // Find all function declarations
6
+ const functions = root.find(j.FunctionDeclaration)
7
7
 
8
- // Journal détaillé des fonctions trouvées
8
+ // Log details of the found functions
9
9
  functions.forEach((path) => {
10
- const { id, generator, async } = path.value
10
+ const { id, generator, async, loc } = path.value
11
11
  console.log("Function found:", {
12
12
  id: id ? id.name : "anonymous",
13
13
  generator,
14
14
  async,
15
- loc: path.value.loc.start
15
+ loc: loc.start
16
16
  })
17
17
  })
18
18
 
19
- // Filtrer les fonctions à transformer
19
+ // Filter non-generator, non-async functions
20
20
  const functionsToTransform = functions.filter((path) => {
21
- const { id, generator, async } = path.value
22
- return !id && !generator && !async
21
+ const { generator, async } = path.value
22
+ return !generator && !async
23
23
  })
24
24
 
25
- // Log les fonctions à transformer
25
+ // Log the number of functions to be transformed
26
26
  console.log("Functions to be transformed:", functionsToTransform.size())
27
27
 
28
- // Appliquer la transformation
28
+ // Transform to arrow functions and preserve comments
29
29
  functionsToTransform.replaceWith((path) => {
30
- const { params, body, async } = path.value
31
- return j.arrowFunctionExpression(params, body, async)
30
+ const { id, params, body, async, comments } = path.value
31
+ const arrowFunction = j.variableDeclaration("const", [
32
+ j.variableDeclarator(
33
+ j.identifier(id.name),
34
+ j.arrowFunctionExpression(params, body, async)
35
+ )
36
+ ])
37
+ arrowFunction.comments = comments
38
+ return arrowFunction
32
39
  })
33
40
 
34
41
  return root.toSource()
@@ -0,0 +1,88 @@
1
+ ---
2
+ require: rubocop/cop/style/method_call_with_args_parentheses_override
3
+ AllCops:
4
+ NewCops: enable
5
+ EnabledByDefault: false
6
+ UseCache: true
7
+ SuggestExtensions: false
8
+ TargetRubyVersion: 2.7.6
9
+ Metrics:
10
+ Enabled: false
11
+ Lint/UselessAssignment:
12
+ Enabled: false
13
+ Lint/RescueException:
14
+ Enabled: false
15
+ Lint/UnusedMethodArgument:
16
+ Enabled: false
17
+ Naming/VariableNumber:
18
+ Enabled: false
19
+ Naming/FileName:
20
+ Enabled: false
21
+ MethodParameterName:
22
+ MinNameLength: 1
23
+ Layout/LeadingEmptyLines:
24
+ Enabled: false
25
+ Layout/InitialIndentation:
26
+ Enabled: false
27
+ Layout/TrailingEmptyLines:
28
+ Enabled: false
29
+ Layout/ExtraSpacing:
30
+ Enabled: false
31
+ Layout/LineLength:
32
+ Enabled: false
33
+ Layout/TrailingWhitespace:
34
+ Enabled: true
35
+ Layout/EmptyLines:
36
+ Enabled: false
37
+ Layout/SpaceInsideBlockBraces:
38
+ SpaceBeforeBlockParameters: false
39
+ Layout/EmptyLinesAroundClassBody:
40
+ EnforcedStyle: empty_lines
41
+ Layout/FirstHashElementIndentation:
42
+ EnforcedStyle: consistent
43
+ Layout/ArgumentAlignment:
44
+ EnforcedStyle: with_fixed_indentation
45
+ Layout/HashAlignment:
46
+ EnforcedHashRocketStyle: table
47
+ Layout/MultilineAssignmentLayout:
48
+ EnforcedStyle: same_line
49
+ Layout/SpaceInsideHashLiteralBraces:
50
+ EnforcedStyle: no_space
51
+ Layout/MultilineMethodCallIndentation:
52
+ EnforcedStyle: indented
53
+ Style/RedundantBegin:
54
+ Enabled: false
55
+ Style/MultilineTernaryOperator:
56
+ Enabled: false
57
+ Style/NestedTernaryOperator:
58
+ Enabled: false
59
+ Style/MultilineIfModifier:
60
+ Enabled: false
61
+ Style/FrozenStringLiteralComment:
62
+ Enabled: false
63
+ Style/Next:
64
+ Enabled: false
65
+ Style/Documentation:
66
+ Enabled: false
67
+ Style/IfUnlessModifierOfIfUnless:
68
+ Enabled: false
69
+ Style/NegatedIf:
70
+ Enabled: false
71
+ Style/MethodCallWithArgsParentheses:
72
+ Enabled: true
73
+ Style/FormatStringToken:
74
+ EnforcedStyle: template
75
+ Style/NumericPredicate:
76
+ EnforcedStyle: comparison
77
+ Style/StringLiterals:
78
+ EnforcedStyle: double_quotes
79
+ Style/StringLiteralsInInterpolation:
80
+ EnforcedStyle: double_quotes
81
+ Style/HashSyntax:
82
+ EnforcedStyle: hash_rockets
83
+ Style/WordArray:
84
+ EnforcedStyle: brackets
85
+ Style/SymbolArray:
86
+ EnforcedStyle: brackets
87
+ Gemspec/RequireMFA:
88
+ Enabled: false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immosquare-cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.37
4
+ version: 0.1.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - IMMO SQUARE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-21 00:00:00.000000000 Z
11
+ date: 2024-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erb_lint
@@ -119,6 +119,7 @@ files:
119
119
  - linters/eslint.config.mjs
120
120
  - linters/jscodeshift/arrow-function-transform.js
121
121
  - linters/prettier.yml
122
+ - linters/rubocop-2.7.6.yml
122
123
  - linters/rubocop-3.2.2.yml
123
124
  - linters/rubocop-3.3.1.yml
124
125
  - linters/rubocop.yml