tz-clean 2.1.0 → 2.2.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.
- package/.prettierignore +19 -0
- package/eslint.config.mjs +3 -0
- package/index.js +12 -2
- package/package.json +2 -1
package/.prettierignore
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Minified files
|
|
2
|
+
**/*.min.js
|
|
3
|
+
**/*.min.cjs
|
|
4
|
+
**/*.min.mjs
|
|
5
|
+
**/*.bundle.js
|
|
6
|
+
|
|
7
|
+
# Build output
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
vendor/
|
|
11
|
+
libs/
|
|
12
|
+
|
|
13
|
+
# Package manager
|
|
14
|
+
node_modules/
|
|
15
|
+
|
|
16
|
+
# Lock files
|
|
17
|
+
package-lock.json
|
|
18
|
+
yarn.lock
|
|
19
|
+
pnpm-lock.yaml
|
package/eslint.config.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import js from '@eslint/js';
|
|
2
2
|
import jsdoc from 'eslint-plugin-jsdoc';
|
|
3
|
+
import noComments from 'eslint-plugin-no-comments';
|
|
3
4
|
import perfectionist from 'eslint-plugin-perfectionist';
|
|
4
5
|
import projectStructure from 'eslint-plugin-project-structure';
|
|
5
6
|
import sonarjs from 'eslint-plugin-sonarjs';
|
|
@@ -39,6 +40,7 @@ export default [
|
|
|
39
40
|
sourceType: 'module',
|
|
40
41
|
},
|
|
41
42
|
plugins: {
|
|
43
|
+
'no-comments': noComments,
|
|
42
44
|
'project-structure': projectStructure,
|
|
43
45
|
},
|
|
44
46
|
rules: {
|
|
@@ -54,6 +56,7 @@ export default [
|
|
|
54
56
|
'jsdoc/require-jsdoc': 'warn',
|
|
55
57
|
'jsdoc/require-param': 'warn',
|
|
56
58
|
'jsdoc/require-returns': 'warn',
|
|
59
|
+
'no-comments/disallowComments': 'warn',
|
|
57
60
|
'no-redeclare': 'off',
|
|
58
61
|
'no-undef': 'off',
|
|
59
62
|
'no-unused-vars': ['error', { args: 'none', vars: 'local' }],
|
package/index.js
CHANGED
|
@@ -229,11 +229,19 @@ function runPrettierTools(includePaths = [], excludePaths = []) {
|
|
|
229
229
|
let fixedFiles = [];
|
|
230
230
|
|
|
231
231
|
const targets = includePaths.length > 0 ? includePaths.map((p) => `"${p}"`).join(' ') : '.';
|
|
232
|
-
|
|
232
|
+
|
|
233
|
+
// Build a temporary .prettierignore combining the default one + user excludes
|
|
234
|
+
const defaultIgnorePath = path.join(configDir, '.prettierignore');
|
|
235
|
+
let ignoreContent = fs.readFileSync(defaultIgnorePath, 'utf-8');
|
|
236
|
+
if (excludePaths.length > 0) {
|
|
237
|
+
ignoreContent += '\n# User-specified excludes\n' + excludePaths.join('\n') + '\n';
|
|
238
|
+
}
|
|
239
|
+
const tempIgnorePath = path.join(targetDir, '.tz-clean-prettierignore');
|
|
240
|
+
fs.writeFileSync(tempIgnorePath, ignoreContent);
|
|
233
241
|
|
|
234
242
|
try {
|
|
235
243
|
const prettierOutput = execSync(
|
|
236
|
-
`npx prettier --write ${targets} --config "${path.join(configDir, '.prettierrc')}" --ignore-
|
|
244
|
+
`npx prettier --write ${targets} --config "${path.join(configDir, '.prettierrc')}" --ignore-path "${tempIgnorePath}" --ignore-unknown`,
|
|
237
245
|
{ encoding: 'utf-8' },
|
|
238
246
|
);
|
|
239
247
|
fixedFiles = prettierOutput
|
|
@@ -247,6 +255,8 @@ function runPrettierTools(includePaths = [], excludePaths = []) {
|
|
|
247
255
|
.filter((line) => line.trim() && !line.includes('(unchanged)'))
|
|
248
256
|
.map((line) => line.split(' ')[0]);
|
|
249
257
|
}
|
|
258
|
+
} finally {
|
|
259
|
+
if (fs.existsSync(tempIgnorePath)) fs.unlinkSync(tempIgnorePath);
|
|
250
260
|
}
|
|
251
261
|
return fixedFiles;
|
|
252
262
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tz-clean",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"@eslint/js": "^10.0.1",
|
|
46
46
|
"eslint": "^10.6.0",
|
|
47
47
|
"eslint-plugin-jsdoc": "^63.0.12",
|
|
48
|
+
"eslint-plugin-no-comments": "^1.2.1",
|
|
48
49
|
"eslint-plugin-perfectionist": "^5.10.0",
|
|
49
50
|
"eslint-plugin-project-structure": "^3.14.3",
|
|
50
51
|
"eslint-plugin-sonarjs": "^4.1.0",
|