@naturalcycles/dev-lib 12.14.2 → 12.15.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/cfg/lint-staged.config.js +8 -1
- package/cfg/overwrite/.editorconfig +15 -11
- package/dist/cmd/lint-all.command.js +7 -4
- package/package.json +1 -1
- package/readme.md +3 -4
|
@@ -79,7 +79,14 @@ const linters = {
|
|
|
79
79
|
'**/*.{kt,kts}': match => {
|
|
80
80
|
const filesList = micromatch.not(match, lintExclude).join(' ')
|
|
81
81
|
if (!filesList) return []
|
|
82
|
-
|
|
82
|
+
const dir = './node_modules/@naturalcycles/ktlint'
|
|
83
|
+
|
|
84
|
+
if (!fs.existsSync(dir)) {
|
|
85
|
+
console.log(`!!\n!! Please install @naturalcycles/ktlint to lint *.kt files\n!!\n`, filesList)
|
|
86
|
+
return []
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return [`${dir}/resources/ktlint -F ${filesList}`]
|
|
83
90
|
},
|
|
84
91
|
}
|
|
85
92
|
|
|
@@ -14,35 +14,39 @@ end_of_line = lf
|
|
|
14
14
|
trim_trailing_whitespace = true
|
|
15
15
|
insert_final_newline = true
|
|
16
16
|
|
|
17
|
-
[
|
|
17
|
+
[*.md]
|
|
18
18
|
trim_trailing_whitespace = false
|
|
19
19
|
indent_size = 4
|
|
20
20
|
|
|
21
|
-
[
|
|
21
|
+
[*.html]
|
|
22
22
|
indent_size = 2
|
|
23
23
|
|
|
24
|
-
[
|
|
24
|
+
[*.{css,scss}]
|
|
25
25
|
indent_size = 2
|
|
26
26
|
|
|
27
|
-
[
|
|
27
|
+
[*.{js,ts}]
|
|
28
28
|
indent_size = 2
|
|
29
29
|
|
|
30
|
-
[
|
|
30
|
+
[*.json]
|
|
31
31
|
indent_size = 2
|
|
32
32
|
|
|
33
|
-
[
|
|
34
|
-
indent_size = 2
|
|
35
|
-
|
|
36
|
-
[**.java]
|
|
33
|
+
[*.java]
|
|
37
34
|
indent_size = 4
|
|
38
35
|
|
|
39
|
-
[
|
|
36
|
+
[*.{kt,kts}]
|
|
37
|
+
disabled_rules=no-wildcard-imports
|
|
38
|
+
ij_kotlin_imports_layout=*,java.**,javax.**,kotlin.**,^ # default IntelliJ IDEA style, same as alphabetical, but with "java", "javax", "kotlin" and alias imports in the end of the imports list
|
|
39
|
+
|
|
40
|
+
[*.xml]
|
|
41
|
+
indent_size = 2
|
|
42
|
+
|
|
43
|
+
[*.sql]
|
|
40
44
|
indent_size = 2
|
|
41
45
|
|
|
42
46
|
[.eslintrc]
|
|
43
47
|
indent_size = 2
|
|
44
48
|
|
|
45
|
-
[
|
|
49
|
+
[*.min.*]
|
|
46
50
|
indent_style = ignore
|
|
47
51
|
trim_trailing_whitespace = false
|
|
48
52
|
insert_final_newline = ignore
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lintAllCommand = void 0;
|
|
4
|
+
const fs = require("fs");
|
|
4
5
|
const yargs = require("yargs");
|
|
5
6
|
const git_util_1 = require("../util/git.util");
|
|
6
7
|
const prettier_util_1 = require("../util/prettier.util");
|
|
@@ -21,10 +22,14 @@ async function lintAllCommand() {
|
|
|
21
22
|
},
|
|
22
23
|
}).argv;
|
|
23
24
|
const hadChangesBefore = await (0, git_util_1.gitHasUncommittedChanges)();
|
|
24
|
-
// Currently we position ESLint before TSLint, but let's monitor if it's ok
|
|
25
25
|
await (0, eslint_all_command_1.eslintAllCommand)();
|
|
26
26
|
await (0, stylelint_util_1.stylelintAll)();
|
|
27
27
|
await (0, prettier_util_1.runPrettier)();
|
|
28
|
+
// Running ktlintAll (experimental!)
|
|
29
|
+
if (fs.existsSync(`node_modules/@naturalcycles/ktlint`)) {
|
|
30
|
+
const ktlintLib = require('@naturalcycles/ktlint');
|
|
31
|
+
await ktlintLib.ktlintAll();
|
|
32
|
+
}
|
|
28
33
|
if (commitOnChanges || failOnChanges) {
|
|
29
34
|
// detect changes
|
|
30
35
|
const hasChanges = await (0, git_util_1.gitHasUncommittedChanges)();
|
|
@@ -33,9 +38,7 @@ async function lintAllCommand() {
|
|
|
33
38
|
console.log(`lint-all: there are changes before running lint-all, will not commit`);
|
|
34
39
|
}
|
|
35
40
|
else {
|
|
36
|
-
const msg = 'style(
|
|
37
|
-
(0, git_util_1.commitMessageToTitleMessage)(await (0, git_util_1.getLastGitCommitMsg)()) +
|
|
38
|
-
'\n\n[skip ci]';
|
|
41
|
+
const msg = 'style(ci): ' + (0, git_util_1.commitMessageToTitleMessage)(await (0, git_util_1.getLastGitCommitMsg)()) + '\n\n[skip ci]';
|
|
39
42
|
// pull, commit, push changes
|
|
40
43
|
await (0, git_util_1.gitPull)();
|
|
41
44
|
await (0, git_util_1.gitCommitAll)(msg);
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -149,11 +149,10 @@ Pass `--ext` (e.g `--ext ts,html`) to override the list of ESLint extensions (de
|
|
|
149
149
|
|
|
150
150
|
`ktlint` will be used by lint-staged for all `**/*.{kt,kts}` files.
|
|
151
151
|
|
|
152
|
-
Please install it with `brew install ktlint
|
|
152
|
+
~~Please install it with `brew install ktlint`.~~
|
|
153
153
|
|
|
154
|
-
|
|
155
|
-
[
|
|
156
|
-
install a working version.
|
|
154
|
+
Install it **locally** in you project by adding
|
|
155
|
+
[`@naturalcycles/ktlint`](https://github.com/NaturalCycles/ktlint) to your **dev**Dependencies.
|
|
157
156
|
|
|
158
157
|
#### Other commands
|
|
159
158
|
|