@naturalcycles/dev-lib 13.3.0 → 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
+ }
@@ -297,11 +297,6 @@ module.exports = {
297
297
  'jest/no-export': 0, // conflicts with typescript isolatedModules
298
298
  'jest/no-conditional-expect': 0,
299
299
  'jest/no-disabled-tests': 0,
300
- 'jest/prefer-equality-matcher': 2,
301
- 'jest/prefer-spy-on': 2,
302
- 'jest/prefer-to-be': 2,
303
- 'jest/prefer-to-contain': 2,
304
- 'jest/consistent-test-it': [2, { fn: 'test', withinDescribe: 'test' }],
305
300
  '@typescript-eslint/no-namespace': [
306
301
  2,
307
302
  {
@@ -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'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
- "version": "13.3.0",
3
+ "version": "13.4.0",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "tsn-debug": "tsn testScript.ts",