@naturalcycles/dev-lib 14.1.0 → 14.1.2

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.
@@ -411,7 +411,12 @@ module.exports = {
411
411
  '@typescript-eslint/no-unsafe-call': 0,
412
412
  '@typescript-eslint/no-unsafe-function-type': 2,
413
413
  '@typescript-eslint/no-wrapper-object-types': 2,
414
- '@typescript-eslint/no-empty-object-type': 2,
414
+ '@typescript-eslint/no-empty-object-type': [
415
+ 2,
416
+ {
417
+ allowInterfaces: 'always',
418
+ },
419
+ ],
415
420
  '@typescript-eslint/no-unnecessary-template-expression': 2,
416
421
  '@typescript-eslint/no-unnecessary-parameter-property-assignment': 2,
417
422
  '@typescript-eslint/restrict-template-expressions': 0,
@@ -25,7 +25,14 @@ async function lintAllCommand() {
25
25
  default: false,
26
26
  },
27
27
  }).argv;
28
+ // todo: produce a cleaner "list of changed files"
29
+ let gitStatusAtStart;
28
30
  const hadChangesBefore = (0, nodejs_lib_1.gitHasUncommittedChanges)();
31
+ if ((commitOnChanges || failOnChanges) && hadChangesBefore) {
32
+ console.log('lint-all: git shows changes before run:');
33
+ gitStatusAtStart = gitStatus();
34
+ console.log(gitStatusAtStart);
35
+ }
29
36
  // We run eslint BEFORE Prettier, because eslint can delete e.g unused imports.
30
37
  await (0, eslint_all_command_1.eslintAllCommand)();
31
38
  if (node_fs_1.default.existsSync(`node_modules/stylelint`) &&
@@ -40,8 +47,9 @@ async function lintAllCommand() {
40
47
  // detect changes
41
48
  const hasChanges = (0, nodejs_lib_1.gitHasUncommittedChanges)();
42
49
  if (hasChanges) {
43
- if (hadChangesBefore) {
44
- console.log(`lint-all: there are changes before running lint-all, will not commit`);
50
+ const gitStatusAfter = gitStatus();
51
+ if (gitStatusAfter === gitStatusAtStart) {
52
+ console.log(`lint-all: git status is the same as before the run, will not commit`);
45
53
  }
46
54
  else {
47
55
  const msg = 'style(ci): ' + (0, js_lib_1._truncate)((0, nodejs_lib_1.commitMessageToTitleMessage)((0, nodejs_lib_1.getLastGitCommitMsg)()), 60);
@@ -52,6 +60,7 @@ async function lintAllCommand() {
52
60
  }
53
61
  // fail on changes
54
62
  if (failOnChanges) {
63
+ console.log(gitStatusAfter);
55
64
  console.log('lint-all failOnChanges: exiting with status 1');
56
65
  process.exitCode = 1;
57
66
  }
@@ -86,3 +95,11 @@ function canRunBinary(name) {
86
95
  return false;
87
96
  }
88
97
  }
98
+ function gitStatus() {
99
+ try {
100
+ return (0, node_child_process_1.execSync)('git status', {
101
+ encoding: 'utf8',
102
+ });
103
+ }
104
+ catch { }
105
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
- "version": "14.1.0",
3
+ "version": "14.1.2",
4
4
  "scripts": {
5
5
  "prepare": "husky",
6
6
  "tsn-debug": "tsn testScript.ts",