@cloudpss/lint-staged-config 1.3.2 → 1.4.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/index.js +10 -8
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
|
|
3
|
-
const path = require('path');
|
|
3
|
+
const path = require('node:path');
|
|
4
4
|
|
|
5
5
|
const prettierSupportInfo = require('prettier').getSupportInfo();
|
|
6
6
|
const eslintCli = new (require('eslint').ESLint)({});
|
|
@@ -80,18 +80,20 @@ module.exports = {
|
|
|
80
80
|
stylelintFiles.push(file);
|
|
81
81
|
} else {
|
|
82
82
|
const filename = path.basename(file);
|
|
83
|
-
if (
|
|
84
|
-
prettierSupportedFilename.includes(filename) ||
|
|
85
|
-
prettierSupportedExt.some((v) => filename.endsWith(v))
|
|
86
|
-
) {
|
|
83
|
+
if (prettierSupportedFilename.includes(filename) || prettierSupportedExt.some((v) => filename.endsWith(v))) {
|
|
87
84
|
prettierFiles.push(file);
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
87
|
}
|
|
88
|
+
|
|
89
|
+
const cacheOptions = `--cache --cache-strategy content`;
|
|
91
90
|
commands.push(
|
|
92
|
-
...makeCommands(eslintFiles, [
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
...makeCommands(eslintFiles, [
|
|
92
|
+
`eslint ${cacheOptions} --cache-location node_modules/.cache/eslint/ --fix --max-warnings 0 --no-error-on-unmatched-pattern`,
|
|
93
|
+
`git add`,
|
|
94
|
+
]),
|
|
95
|
+
...makeCommands(stylelintFiles, [`stylelint ${cacheOptions} --cache-location node_modules/.cache/stylelint/ --fix`, `git add`]),
|
|
96
|
+
...makeCommands(prettierFiles, [`prettier ${cacheOptions} --write`, `git add`]),
|
|
95
97
|
);
|
|
96
98
|
return commands;
|
|
97
99
|
}),
|
package/package.json
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"homepage": "https://cloudpss.net/",
|
|
5
5
|
"repository": "https://codeup.aliyun.com/cloudpss/code-quality.git",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.4.0",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@types/eslint": "^8.37.0",
|
|
10
10
|
"@types/prettier": "^2.7.2"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"eslint": "^8.
|
|
13
|
+
"eslint": "^8.39.0",
|
|
14
14
|
"lint-staged": "^13.2.1",
|
|
15
|
-
"prettier": "^2.8.
|
|
15
|
+
"prettier": "^2.8.8"
|
|
16
16
|
}
|
|
17
17
|
}
|