@naturalcycles/dev-lib 13.35.2 → 13.37.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/eslint-rules.js +48 -0
- package/cfg/eslint-vue2.config.js +31 -0
- package/cfg/eslint-vue3.config.js +31 -0
- package/cfg/eslint.config.js +2 -26
- package/cfg/jest.config.js +3 -1
- package/dist/testing/testing.util.d.ts +0 -6
- package/dist/testing/testing.util.js +1 -18
- package/package.json +1 -1
package/cfg/eslint-rules.js
CHANGED
|
@@ -445,5 +445,53 @@ module.exports = {
|
|
|
445
445
|
'@typescript-eslint/dot-notation': 0, // not always desireable
|
|
446
446
|
'@typescript-eslint/consistent-indexed-object-style': 0, // Record looses the name of the key
|
|
447
447
|
'@typescript-eslint/no-unsafe-enum-comparison': 0, // not practically helpful
|
|
448
|
+
// non-default vue rules
|
|
449
|
+
'vue/block-order': [
|
|
450
|
+
'error',
|
|
451
|
+
{
|
|
452
|
+
order: ['script', 'template', 'style'],
|
|
453
|
+
},
|
|
454
|
+
],
|
|
455
|
+
'vue/component-api-style': [2, ['script-setup', 'composition', 'composition-vue2']],
|
|
456
|
+
'vue/component-name-in-template-casing': [
|
|
457
|
+
2,
|
|
458
|
+
'PascalCase',
|
|
459
|
+
{
|
|
460
|
+
registeredComponentsOnly: true,
|
|
461
|
+
},
|
|
462
|
+
],
|
|
463
|
+
'vue/component-options-name-casing': [2, 'PascalCase'],
|
|
464
|
+
'vue/custom-event-name-casing': [2, 'camelCase'],
|
|
465
|
+
'vue/define-emits-declaration': [2, 'type-based'],
|
|
466
|
+
'vue/define-macros-order': 2,
|
|
467
|
+
'vue/define-props-declaration': 2,
|
|
468
|
+
'vue/html-comment-content-spacing': 2,
|
|
469
|
+
'vue/match-component-file-name': [
|
|
470
|
+
2,
|
|
471
|
+
{
|
|
472
|
+
extensions: ['vue', 'jsx'],
|
|
473
|
+
shouldMatchCase: true,
|
|
474
|
+
},
|
|
475
|
+
],
|
|
476
|
+
'vue/match-component-import-name': 2,
|
|
477
|
+
'vue/no-boolean-default': 2,
|
|
478
|
+
'vue/no-deprecated-model-definition': 2,
|
|
479
|
+
'vue/no-multiple-objects-in-class': 2,
|
|
480
|
+
'vue/no-ref-object-destructure': 2,
|
|
481
|
+
'vue/no-required-prop-with-default': 2,
|
|
482
|
+
'vue/no-root-v-if': 2,
|
|
483
|
+
'vue/no-this-in-before-route-enter': 2,
|
|
484
|
+
'vue/padding-line-between-blocks': 2,
|
|
485
|
+
'vue/prefer-define-options': 2,
|
|
486
|
+
'vue/prefer-separate-static-class': 2,
|
|
487
|
+
'vue/require-direct-export': 2,
|
|
488
|
+
'vue/require-emit-validator': 2,
|
|
489
|
+
'vue/require-expose': 2,
|
|
490
|
+
'vue/require-macro-variable-name': 2,
|
|
491
|
+
'vue/require-typed-object-prop': 2,
|
|
492
|
+
'vue/require-typed-ref': 2,
|
|
493
|
+
'vue/v-for-delimiter-style': [2, 'of'],
|
|
494
|
+
'vue/valid-define-options': 2,
|
|
495
|
+
'vue/eqeqeq': 2,
|
|
448
496
|
},
|
|
449
497
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @naturalcycles/dev-lib/cfg/eslint-vue2.config.js
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
overrides: [
|
|
7
|
+
{
|
|
8
|
+
files: ['*.vue'],
|
|
9
|
+
extends: [
|
|
10
|
+
'eslint:recommended',
|
|
11
|
+
'plugin:@typescript-eslint/recommended-type-checked',
|
|
12
|
+
'plugin:@typescript-eslint/stylistic-type-checked',
|
|
13
|
+
'plugin:unicorn/recommended',
|
|
14
|
+
'plugin:vue/recommended',
|
|
15
|
+
'./eslint-rules.js',
|
|
16
|
+
'prettier', // must go last
|
|
17
|
+
],
|
|
18
|
+
env: {
|
|
19
|
+
browser: true,
|
|
20
|
+
},
|
|
21
|
+
parser: 'vue-eslint-parser',
|
|
22
|
+
parserOptions: {
|
|
23
|
+
parser: '@typescript-eslint/parser',
|
|
24
|
+
project: ['tsconfig.json'],
|
|
25
|
+
sourceType: 'module',
|
|
26
|
+
ecmaVersion: 'latest',
|
|
27
|
+
extraFileExtensions: ['.vue'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @naturalcycles/dev-lib/cfg/eslint-vue3.config.js
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
overrides: [
|
|
7
|
+
{
|
|
8
|
+
files: ['*.vue'],
|
|
9
|
+
extends: [
|
|
10
|
+
'eslint:recommended',
|
|
11
|
+
'plugin:@typescript-eslint/recommended-type-checked',
|
|
12
|
+
'plugin:@typescript-eslint/stylistic-type-checked',
|
|
13
|
+
'plugin:unicorn/recommended',
|
|
14
|
+
'plugin:vue/vue3-recommended',
|
|
15
|
+
'./eslint-rules.js',
|
|
16
|
+
'prettier', // must go last
|
|
17
|
+
],
|
|
18
|
+
env: {
|
|
19
|
+
browser: true,
|
|
20
|
+
},
|
|
21
|
+
parser: 'vue-eslint-parser',
|
|
22
|
+
parserOptions: {
|
|
23
|
+
parser: '@typescript-eslint/parser',
|
|
24
|
+
project: ['tsconfig.json'],
|
|
25
|
+
sourceType: 'module',
|
|
26
|
+
ecmaVersion: 'latest',
|
|
27
|
+
extraFileExtensions: ['.vue'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
}
|
package/cfg/eslint.config.js
CHANGED
|
@@ -37,15 +37,15 @@ module.exports = {
|
|
|
37
37
|
// 'plugin:import/recommended',
|
|
38
38
|
// https://github.com/import-js/eslint-plugin-import/blob/main/config/typescript.js
|
|
39
39
|
// 'plugin:import/typescript',
|
|
40
|
-
'./eslint-rules.js',
|
|
41
40
|
hasJest && './eslint-jest-rules.js',
|
|
41
|
+
'./eslint-rules.js',
|
|
42
42
|
'prettier', // must be last! it only turns off eslint rules that conflict with prettier
|
|
43
43
|
].filter(Boolean),
|
|
44
44
|
parser: '@typescript-eslint/parser',
|
|
45
45
|
parserOptions: {
|
|
46
46
|
project: ['tsconfig.json'],
|
|
47
47
|
sourceType: 'module',
|
|
48
|
-
ecmaVersion:
|
|
48
|
+
ecmaVersion: 'latest',
|
|
49
49
|
extraFileExtensions: ['.vue', '.html'],
|
|
50
50
|
},
|
|
51
51
|
plugins: [
|
|
@@ -58,29 +58,5 @@ module.exports = {
|
|
|
58
58
|
'unicorn',
|
|
59
59
|
].filter(Boolean),
|
|
60
60
|
},
|
|
61
|
-
{
|
|
62
|
-
files: ['*.vue'],
|
|
63
|
-
extends: [
|
|
64
|
-
'eslint:recommended',
|
|
65
|
-
'plugin:@typescript-eslint/recommended',
|
|
66
|
-
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
67
|
-
'plugin:unicorn/recommended',
|
|
68
|
-
'./eslint-rules.js',
|
|
69
|
-
'plugin:vue/recommended',
|
|
70
|
-
'prettier', // must go last
|
|
71
|
-
],
|
|
72
|
-
env: {
|
|
73
|
-
browser: true,
|
|
74
|
-
},
|
|
75
|
-
parser: 'vue-eslint-parser',
|
|
76
|
-
parserOptions: {
|
|
77
|
-
parser: '@typescript-eslint/parser',
|
|
78
|
-
project: ['tsconfig.json'],
|
|
79
|
-
sourceType: 'module',
|
|
80
|
-
ecmaVersion: 2020,
|
|
81
|
-
extraFileExtensions: ['.vue'],
|
|
82
|
-
// createDefaultProgram: true,
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
61
|
],
|
|
86
62
|
}
|
package/cfg/jest.config.js
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
const fs = require('node:fs')
|
|
7
7
|
|
|
8
|
-
const runInIDE = process.argv.some(
|
|
8
|
+
const runInIDE = process.argv.some(
|
|
9
|
+
a => a === '--runTestsByPath' || a.includes('IDEA') || a.includes('Visual Studio'),
|
|
10
|
+
)
|
|
9
11
|
const ideIntegrationTest = runInIDE && process.argv.some(a => a.endsWith('.integration.test.ts'))
|
|
10
12
|
const ideManualTest = runInIDE && process.argv.some(a => a.endsWith('.manual.test.ts'))
|
|
11
13
|
const { CI, GITHUB_ACTIONS } = process.env
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Does Object.freeze recursively for given object.
|
|
3
|
-
*
|
|
4
|
-
* Based on: https://github.com/substack/deep-freeze/blob/master/index.js
|
|
5
|
-
*/
|
|
6
|
-
export declare function deepFreeze(o: any): void;
|
|
7
1
|
export declare function silentConsole(): void;
|
|
8
2
|
export declare const jestLogger: import("@naturalcycles/js-lib").CommonLogger;
|
|
9
3
|
export declare const jestLog: import("@naturalcycles/js-lib").CommonLogFunction;
|
|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jestLog = exports.jestLogger = exports.silentConsole =
|
|
3
|
+
exports.jestLog = exports.jestLogger = exports.silentConsole = void 0;
|
|
4
4
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
5
5
|
const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
|
|
6
|
-
/**
|
|
7
|
-
* Does Object.freeze recursively for given object.
|
|
8
|
-
*
|
|
9
|
-
* Based on: https://github.com/substack/deep-freeze/blob/master/index.js
|
|
10
|
-
*/
|
|
11
|
-
function deepFreeze(o) {
|
|
12
|
-
Object.freeze(o);
|
|
13
|
-
Object.getOwnPropertyNames(o).forEach(prop => {
|
|
14
|
-
if (o.hasOwnProperty(prop) && // eslint-disable-line no-prototype-builtins
|
|
15
|
-
o[prop] !== null &&
|
|
16
|
-
(typeof o[prop] === 'object' || typeof o[prop] === 'function') &&
|
|
17
|
-
!Object.isFrozen(o[prop])) {
|
|
18
|
-
deepFreeze(o[prop]);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
exports.deepFreeze = deepFreeze;
|
|
23
6
|
function silentConsole() {
|
|
24
7
|
console.log = () => { };
|
|
25
8
|
console.debug = () => { };
|