immosquare-cleaner 0.1.77 → 0.1.78
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.
- checksums.yaml +4 -4
- data/lib/immosquare-cleaner/version.rb +1 -1
- data/lib/immosquare-cleaner.rb +2 -2
- data/linters/eslint.config.mjs +136 -100
- data/package.json +4 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dadcd82a9246f29c49b8f6133cb4ec9a8b059435828a6a0906b6d70d4a845457
|
4
|
+
data.tar.gz: fb334b4d1e5c6c815269c4cc9a933dc31c0eb64c043c05c3905769a9cf038a9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3e042005cc8401df8c7cbeb967e4caee2e0f2e0d64698ba9b7586981427edd6f3f62bb13d4979eb8bd0248acdca9f59ce4400b04583994ab6445c9899076c80
|
7
|
+
data.tar.gz: 67edec140e0b02668d4980bcc92e8e57c55a4576d2e3be204211b675246b2a5fd526e18e3af3fd4963ed6b4474dd2426266fc77933763d71b07f7695840201eb
|
data/lib/immosquare-cleaner.rb
CHANGED
@@ -155,11 +155,11 @@ module ImmosquareCleaner
|
|
155
155
|
elsif file_path.end_with?(".js", ".mjs", "js.erb", ".jsx", ".ts", ".ts.erb", ".tsx")
|
156
156
|
begin
|
157
157
|
temp_folder_path = "#{gem_root}/tmp"
|
158
|
-
temp_file_path
|
158
|
+
temp_file_path = "#{temp_folder_path}/#{File.basename(file_path)}"
|
159
159
|
FileUtils.mkdir_p(temp_folder_path)
|
160
160
|
File.write(temp_file_path, File.read(file_path))
|
161
161
|
cmds = []
|
162
|
-
cmds << "bundle exec erb_lint --config #{erblint_config_with_version_path} #{file_path} #{ImmosquareCleaner.configuration.erblint_options || "--autocorrect"}" if file_path.end_with?("
|
162
|
+
cmds << "bundle exec erb_lint --config #{erblint_config_with_version_path} #{file_path} #{ImmosquareCleaner.configuration.erblint_options || "--autocorrect"}" if file_path.end_with?(".erb")
|
163
163
|
cmds << "bun eslint --config #{gem_root}/linters/eslint.config.mjs #{temp_file_path} --fix"
|
164
164
|
|
165
165
|
launch_cmds(cmds)
|
data/linters/eslint.config.mjs
CHANGED
@@ -4,114 +4,122 @@ import sonarjs from "eslint-plugin-sonarjs"
|
|
4
4
|
import alignAssignments from "eslint-plugin-align-assignments"
|
5
5
|
import alignImport from "eslint-plugin-align-import"
|
6
6
|
import erb from "eslint-plugin-erb"
|
7
|
+
import tseslint from "@typescript-eslint/eslint-plugin"
|
8
|
+
import tsparser from "@typescript-eslint/parser"
|
9
|
+
|
10
|
+
// Common formatting and style rules
|
11
|
+
const commonRules = {
|
12
|
+
// ==============================================================================================##
|
13
|
+
// SonarJS rules to encourage concise and clear code
|
14
|
+
// Some rules are fixable others are not
|
15
|
+
// https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md
|
16
|
+
// ==============================================================================================##
|
17
|
+
"sonarjs/no-small-switch": [2],
|
18
|
+
"sonarjs/no-nested-template-literals": [2],
|
19
|
+
"sonarjs/prefer-single-boolean-return": [2],
|
20
|
+
"sonarjs/prefer-immediate-return": [2],
|
21
|
+
|
22
|
+
// ==============================================================================================##
|
23
|
+
// Indentation rule: enforces consistent indentation of 2 spaces
|
24
|
+
// ==============================================================================================##
|
25
|
+
indent: [2, 2],
|
26
|
+
|
27
|
+
// ==============================================================================================##
|
28
|
+
// Quotes rule: enforces the use of double quotes for strings
|
29
|
+
// ==============================================================================================##
|
30
|
+
quotes: [2, "double"],
|
31
|
+
|
32
|
+
// ==============================================================================================##
|
33
|
+
// Semicolon rule: disallows the use of semicolons
|
34
|
+
// ==============================================================================================##
|
35
|
+
semi: [2, "never"],
|
36
|
+
|
37
|
+
// ==============================================================================================##
|
38
|
+
// Key spacing rule: enforces consistent spacing between keys and values in object literals
|
39
|
+
// ==============================================================================================##
|
40
|
+
"key-spacing": [2, { align: "value" }],
|
41
|
+
|
42
|
+
// ==============================================================================================##
|
43
|
+
// Parameter reassignment rule: allows the reassignment of function parameters, except for properties
|
44
|
+
// ==============================================================================================##
|
45
|
+
"no-param-reassign": [2, { props: false }],
|
46
|
+
|
47
|
+
// ==============================================================================================##
|
48
|
+
// Comma dangle rule: disallows trailing commas in object and array literals
|
49
|
+
// ==============================================================================================##
|
50
|
+
"comma-dangle": [2, "never"],
|
51
|
+
|
52
|
+
// ==============================================================================================##
|
53
|
+
// Prefer destructuring rule: enforces the use of object destructuring over direct assignments
|
54
|
+
// ==============================================================================================##
|
55
|
+
"prefer-destructuring": [2, { "VariableDeclarator": { "array": false, "object": true }, "AssignmentExpression": { "array": false, "object": true } }, { "enforceForRenamedProperties": false }],
|
56
|
+
|
57
|
+
// ==============================================================================================##
|
58
|
+
// Comma spacing rule: enforces consistent spacing before and after commas
|
59
|
+
// ==============================================================================================##
|
60
|
+
"comma-spacing": [2, { "before": false, "after": true }],
|
61
|
+
|
62
|
+
// ==============================================================================================##
|
63
|
+
// Align assignments rule: enforces alignment of assignments
|
64
|
+
// ==============================================================================================##
|
65
|
+
"align-assignments/align-assignments": [2],
|
66
|
+
|
67
|
+
// ==============================================================================================##
|
68
|
+
// Align imports rule: enforces alignment of import statements
|
69
|
+
// ==============================================================================================##
|
70
|
+
"align-import/align-import": [2],
|
71
|
+
|
72
|
+
// ==============================================================================================##
|
73
|
+
// Prefer arrow functions rule: enforces the use of arrow functions over traditional functions
|
74
|
+
// ==============================================================================================##
|
75
|
+
"prefer-arrow-callback": [2],
|
76
|
+
"prefer-arrow/prefer-arrow-functions": [2, {"disallowPrototype": true, "singleReturnOnly": false, "classPropertiesAllowed": false}],
|
77
|
+
|
78
|
+
// ==============================================================================================##
|
79
|
+
// Enforces no braces where they can be omitted
|
80
|
+
// ==============================================================================================##
|
81
|
+
"arrow-body-style": [2, "as-needed", { requireReturnForObjectLiteral: false }],
|
82
|
+
|
83
|
+
// ==============================================================================================##
|
84
|
+
// Require parens in arrow function arguments
|
85
|
+
// ==============================================================================================##
|
86
|
+
"arrow-parens": [2, "always"],
|
87
|
+
|
88
|
+
// ==============================================================================================##
|
89
|
+
// Require space before/after arrow function's arrow
|
90
|
+
// ==============================================================================================##
|
91
|
+
"arrow-spacing": [2, { before: true, after: true }],
|
92
|
+
|
93
|
+
// ==============================================================================================##
|
94
|
+
// Disallow arrow functions where they could be confused with comparisons
|
95
|
+
// ==============================================================================================##
|
96
|
+
"no-confusing-arrow": [2, { allowParens: true }],
|
97
|
+
|
98
|
+
// ==============================================================================================##
|
99
|
+
// Disallow magic numbers
|
100
|
+
// ==============================================================================================##
|
101
|
+
"no-magic-numbers": ["off", { ignore: [], ignoreArrayIndexes: true, enforceConst: true, detectObjects: false }]
|
102
|
+
}
|
103
|
+
|
104
|
+
// Common plugins configuration
|
105
|
+
const commonPlugins = {
|
106
|
+
"prefer-arrow": preferArrow,
|
107
|
+
"sonarjs": sonarjs,
|
108
|
+
"align-assignments": alignAssignments,
|
109
|
+
"align-import": alignImport
|
110
|
+
}
|
7
111
|
|
8
112
|
export default [
|
9
113
|
js.configs.recommended,
|
10
114
|
{
|
11
115
|
ignores: ["package.json"],
|
12
|
-
plugins:
|
13
|
-
|
14
|
-
|
15
|
-
"align-assignments": alignAssignments,
|
16
|
-
"align-import": alignImport
|
17
|
-
},
|
18
|
-
rules: {
|
19
|
-
// ==============================================================================================##
|
20
|
-
// SonarJS rules to encourage concise and clear code
|
21
|
-
// Some rules are fixable others are not
|
22
|
-
// https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md
|
23
|
-
// ==============================================================================================##
|
24
|
-
"sonarjs/no-small-switch": [2],
|
25
|
-
"sonarjs/no-nested-template-literals": [2],
|
26
|
-
"sonarjs/prefer-single-boolean-return": [2],
|
27
|
-
"sonarjs/prefer-immediate-return": [2],
|
28
|
-
|
29
|
-
|
30
|
-
// ==============================================================================================##
|
31
|
-
// Indentation rule: enforces consistent indentation of 2 spaces
|
32
|
-
// ==============================================================================================##
|
33
|
-
indent: [2, 2],
|
34
|
-
|
35
|
-
// ==============================================================================================##
|
36
|
-
// Quotes rule: enforces the use of double quotes for strings
|
37
|
-
// ==============================================================================================##
|
38
|
-
quotes: [2, "double"],
|
39
|
-
|
40
|
-
// ==============================================================================================##
|
41
|
-
// Semicolon rule: disallows the use of semicolons
|
42
|
-
// ==============================================================================================##
|
43
|
-
semi: [2, "never"],
|
44
|
-
|
116
|
+
plugins: commonPlugins,
|
117
|
+
rules: {
|
118
|
+
...commonRules,
|
45
119
|
// ==============================================================================================##
|
46
120
|
// Undefined variables rule: disables the restriction on using undefined variables
|
47
121
|
// ==============================================================================================##
|
48
|
-
"no-undef": 0
|
49
|
-
|
50
|
-
// ==============================================================================================##
|
51
|
-
// Key spacing rule: enforces consistent spacing between keys and values in object literals
|
52
|
-
// ==============================================================================================##
|
53
|
-
"key-spacing": [2, { align: "value" }],
|
54
|
-
|
55
|
-
// ==============================================================================================##
|
56
|
-
// Parameter reassignment rule: allows the reassignment of function parameters, except for properties
|
57
|
-
// ==============================================================================================##
|
58
|
-
"no-param-reassign": [2, { props: false }],
|
59
|
-
|
60
|
-
// ==============================================================================================##
|
61
|
-
// Comma dangle rule: disallows trailing commas in object and array literals
|
62
|
-
// ==============================================================================================##
|
63
|
-
"comma-dangle": [2, "never"],
|
64
|
-
|
65
|
-
// ==============================================================================================##
|
66
|
-
// Prefer destructuring rule: enforces the use of object destructuring over direct assignments
|
67
|
-
// ==============================================================================================##
|
68
|
-
"prefer-destructuring": [2, { "VariableDeclarator": { "array": false, "object": true }, "AssignmentExpression": { "array": false, "object": true } }, { "enforceForRenamedProperties": false }],
|
69
|
-
|
70
|
-
// ==============================================================================================##
|
71
|
-
// Comma spacing rule: enforces consistent spacing before and after commas
|
72
|
-
// ==============================================================================================##
|
73
|
-
"comma-spacing": [2, { "before": false, "after": true }],
|
74
|
-
|
75
|
-
// ==============================================================================================##
|
76
|
-
// Align assignments rule: enforces alignment of assignments
|
77
|
-
// ==============================================================================================##
|
78
|
-
"align-assignments/align-assignments": [2],
|
79
|
-
|
80
|
-
// ==============================================================================================##
|
81
|
-
// Align imports rule: enforces alignment of import statements
|
82
|
-
// ==============================================================================================##
|
83
|
-
"align-import/align-import": [2],
|
84
|
-
|
85
|
-
// ==============================================================================================##
|
86
|
-
// Prefer arrow functions rule: enforces the use of arrow functions over traditional functions
|
87
|
-
// ==============================================================================================##
|
88
|
-
"prefer-arrow-callback": [2],
|
89
|
-
"prefer-arrow/prefer-arrow-functions": [2, {"disallowPrototype": true, "singleReturnOnly": false, "classPropertiesAllowed": false}],
|
90
|
-
|
91
|
-
// ==============================================================================================##
|
92
|
-
// Enforces no braces where they can be omitted
|
93
|
-
// ==============================================================================================##
|
94
|
-
"arrow-body-style": [2, "as-needed", { requireReturnForObjectLiteral: false }],
|
95
|
-
|
96
|
-
// ==============================================================================================##
|
97
|
-
// Require parens in arrow function arguments
|
98
|
-
// ==============================================================================================##
|
99
|
-
"arrow-parens": [2, "always"],
|
100
|
-
|
101
|
-
// ==============================================================================================##
|
102
|
-
// Require space before/after arrow function's arrow
|
103
|
-
// ==============================================================================================##
|
104
|
-
"arrow-spacing": [2, { before: true, after: true }],
|
105
|
-
|
106
|
-
// ==============================================================================================##
|
107
|
-
// Disallow arrow functions where they could be confused with comparisons
|
108
|
-
// ==============================================================================================##
|
109
|
-
"no-confusing-arrow": [2, { allowParens: true }],
|
110
|
-
|
111
|
-
// ==============================================================================================##
|
112
|
-
// Disallow magic numbers
|
113
|
-
// ==============================================================================================##
|
114
|
-
"no-magic-numbers": ["off", { ignore: [], ignoreArrayIndexes: true, enforceConst: true, detectObjects: false }]
|
122
|
+
"no-undef": 0
|
115
123
|
}
|
116
124
|
},
|
117
125
|
erb.configs.recommended,
|
@@ -126,5 +134,33 @@ export default [
|
|
126
134
|
reportUnusedDisableDirectives: "off"
|
127
135
|
}
|
128
136
|
// your other configuration options
|
137
|
+
},
|
138
|
+
// TypeScript configuration
|
139
|
+
{
|
140
|
+
files: ["**/*.ts", "**/*.tsx"],
|
141
|
+
languageOptions: {
|
142
|
+
parser: tsparser,
|
143
|
+
parserOptions: {
|
144
|
+
ecmaVersion: "latest",
|
145
|
+
sourceType: "module"
|
146
|
+
}
|
147
|
+
},
|
148
|
+
plugins: {
|
149
|
+
"@typescript-eslint": tseslint,
|
150
|
+
...commonPlugins
|
151
|
+
},
|
152
|
+
rules: {
|
153
|
+
// Extend base JavaScript rules
|
154
|
+
...js.configs.recommended.rules,
|
155
|
+
...commonRules,
|
156
|
+
|
157
|
+
// TypeScript specific rules
|
158
|
+
"@typescript-eslint/no-unused-vars": [2],
|
159
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
160
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
161
|
+
|
162
|
+
// TypeScript handles undefined variables
|
163
|
+
"no-undef": "off"
|
164
|
+
}
|
129
165
|
}
|
130
166
|
]
|
data/package.json
CHANGED
@@ -3,13 +3,16 @@
|
|
3
3
|
"private": true,
|
4
4
|
"dependencies": {
|
5
5
|
"@eslint/js": "^9.35.0",
|
6
|
+
"@typescript-eslint/eslint-plugin": "^8.6.0",
|
7
|
+
"@typescript-eslint/parser": "^8.6.0",
|
6
8
|
"eslint": "^9.35.0",
|
7
9
|
"eslint-plugin-align-assignments": "^1.1.2",
|
8
10
|
"eslint-plugin-align-import": "^1.0.0",
|
9
11
|
"eslint-plugin-erb": "^2.1.1",
|
10
12
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
11
13
|
"eslint-plugin-sonarjs": "^3.0.5",
|
12
|
-
"prettier": "^3.6.2"
|
14
|
+
"prettier": "^3.6.2",
|
15
|
+
"typescript": "^5.5.4"
|
13
16
|
},
|
14
17
|
"scripts": {"morning": "bundle update && bundle clean --force && bun update --latest && bun install && bundle exec immosquare-cleaner 'package.json'"}
|
15
18
|
}
|