@naturalcycles/dev-lib 13.2.2 → 13.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.
@@ -0,0 +1,9 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'jest/prefer-equality-matcher': 2,
4
+ 'jest/prefer-spy-on': 2,
5
+ 'jest/prefer-to-be': 2,
6
+ 'jest/prefer-to-contain': 2,
7
+ 'jest/consistent-test-it': [2, { fn: 'test', withinDescribe: 'test' }],
8
+ },
9
+ }
@@ -3,6 +3,11 @@
3
3
  *
4
4
  * Shared eslint config.
5
5
  */
6
+
7
+ // detect if jest is installed
8
+ const hasJest = require('fs').existsSync('./node_modules/jest')
9
+ // console.log({hasJest})
10
+
6
11
  module.exports = {
7
12
  env: {
8
13
  es2020: true,
@@ -33,8 +38,9 @@ module.exports = {
33
38
  // https://github.com/import-js/eslint-plugin-import/blob/main/config/typescript.js
34
39
  // 'plugin:import/typescript',
35
40
  './eslint-rules.js',
41
+ hasJest && './eslint-jest-rules.js',
36
42
  'prettier', // must be last! it only turns off eslint rules that conflict with prettier
37
- ],
43
+ ].filter(Boolean),
38
44
  parser: '@typescript-eslint/parser',
39
45
  parserOptions: {
40
46
  project: ['tsconfig.json'],
@@ -48,9 +54,9 @@ module.exports = {
48
54
  '@typescript-eslint',
49
55
  // https://github.com/sweepline/eslint-plugin-unused-imports
50
56
  'unused-imports',
51
- // 'jest', // add manually if needed!
57
+ hasJest && 'jest',
52
58
  'unicorn',
53
- ],
59
+ ].filter(Boolean),
54
60
  },
55
61
  {
56
62
  files: ['*.vue'],
@@ -9,6 +9,7 @@ exports.expectResults = void 0;
9
9
  * ]).toMatchSnapshot()
10
10
  */
11
11
  function expectResults(fn, values) {
12
+ // eslint-disable-next-line jest/valid-expect
12
13
  return expect(new Map(values.map(v => [v, fn(v)])));
13
14
  }
14
15
  exports.expectResults = expectResults;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
- "version": "13.2.2",
3
+ "version": "13.4.0",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "tsn-debug": "tsn testScript.ts",
@@ -36,7 +36,7 @@
36
36
  "@naturalcycles/js-lib": "^14.0.0",
37
37
  "@naturalcycles/nodejs-lib": "^12.0.0",
38
38
  "@types/fs-extra": "^9.0.0",
39
- "@types/jest": "^28.1.0",
39
+ "@types/jest": "^29.0.0",
40
40
  "@types/node": "^18.0.0",
41
41
  "@types/yargs": "^16.0.0",
42
42
  "@typescript-eslint/eslint-plugin": "^5.0.0",