@naturalcycles/dev-lib 20.10.1 → 20.11.1

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.
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  rules: {
3
- '@typescript-eslint/adjacent-overload-signatures': 2,
3
+ '@typescript-eslint/adjacent-overload-signatures': 0, // ox
4
4
  '@typescript-eslint/ban-ts-comment': 0,
5
5
  'no-restricted-globals': 0, // oxlint
6
6
  '@typescript-eslint/no-restricted-types': [
@@ -32,11 +32,11 @@ export default {
32
32
  },
33
33
  },
34
34
  ],
35
- '@typescript-eslint/consistent-type-imports': 2,
35
+ '@typescript-eslint/consistent-type-imports': 0, // ox
36
36
  '@typescript-eslint/consistent-type-exports': 2,
37
37
  '@typescript-eslint/consistent-type-assertions': 2,
38
- '@typescript-eslint/consistent-type-definitions': [2, 'interface'],
39
- '@typescript-eslint/consistent-generic-constructors': [2, 'constructor'],
38
+ '@typescript-eslint/consistent-type-definitions': [0, 'interface'], // ox
39
+ '@typescript-eslint/consistent-generic-constructors': [0, 'constructor'], // ox
40
40
  // Doc: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
41
41
  // Loosely based on this: https://github.com/xojs/eslint-config-xo-typescript/blob/main/index.js
42
42
  '@typescript-eslint/naming-convention': [
@@ -120,9 +120,9 @@ export default {
120
120
  ],
121
121
  '@typescript-eslint/no-array-constructor': 2,
122
122
  '@typescript-eslint/no-extra-non-null-assertion': 2,
123
- '@typescript-eslint/no-floating-promises': 2,
123
+ '@typescript-eslint/no-floating-promises': 0, // oxlint
124
124
  '@typescript-eslint/no-inferrable-types': [
125
- 2,
125
+ 0, // ox
126
126
  {
127
127
  ignoreParameters: true,
128
128
  },
@@ -133,8 +133,8 @@ export default {
133
133
  '@typescript-eslint/no-unused-expressions': 0, // oxlint
134
134
  '@typescript-eslint/prefer-as-const': 2,
135
135
  '@typescript-eslint/prefer-for-of': 0, // oxlint
136
- '@typescript-eslint/prefer-function-type': 2,
137
- '@typescript-eslint/prefer-namespace-keyword': 2,
136
+ '@typescript-eslint/prefer-function-type': 0, // ox
137
+ '@typescript-eslint/prefer-namespace-keyword': 0, // ox
138
138
  '@typescript-eslint/promise-function-async': [
139
139
  2,
140
140
  {
@@ -250,7 +250,7 @@ export default {
250
250
  'no-shadow-restricted-names': 2,
251
251
  'no-sparse-arrays': 0, // oxlint
252
252
  'no-this-before-super': 2,
253
- '@typescript-eslint/only-throw-error': 0, // biome
253
+ '@typescript-eslint/only-throw-error': 0, // biome, ox
254
254
  'no-undef': 0, // covered by TS, conflicts with typescript-eslint
255
255
  'no-underscore-dangle': 0,
256
256
  'no-unreachable': 2,
@@ -289,7 +289,7 @@ export default {
289
289
  'guard-for-in': 0, // oxlint
290
290
  'prefer-spread': 0, // oxlint
291
291
  '@typescript-eslint/no-namespace': [
292
- 2,
292
+ 0, // ox
293
293
  {
294
294
  allowDeclarations: true, // allows `namespace NodeJS {}` augmentations
295
295
  },
@@ -309,23 +309,23 @@ export default {
309
309
  // { vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' },
310
310
  // ],
311
311
  '@typescript-eslint/no-duplicate-enum-values': 0, // oxlint
312
- '@typescript-eslint/no-redundant-type-constituents': 0, // `'a' | string` is still useful for DX
312
+ '@typescript-eslint/no-redundant-type-constituents': 0, // ox, `'a' | string` is still useful for DX
313
313
  '@typescript-eslint/no-empty-function': 0,
314
314
  '@typescript-eslint/no-var-requires': 0,
315
315
  '@typescript-eslint/no-require-imports': 0,
316
316
  '@typescript-eslint/no-explicit-any': 0, // oxlint
317
317
  '@typescript-eslint/no-non-null-assertion': 0,
318
318
  '@typescript-eslint/explicit-module-boundary-types': [
319
- 2,
319
+ 0, // ox
320
320
  {
321
321
  allowArgumentsExplicitlyTypedAsAny: true,
322
322
  },
323
323
  ],
324
- '@typescript-eslint/array-type': 2,
324
+ '@typescript-eslint/array-type': 0, // ox
325
325
  '@typescript-eslint/prefer-regexp-exec': 0, // auto-fixer breaks code sometimes!
326
326
  '@typescript-eslint/prefer-find': 2,
327
327
  'prefer-promise-reject-errors': 0,
328
- '@typescript-eslint/prefer-promise-reject-errors': 2,
328
+ '@typescript-eslint/prefer-promise-reject-errors': 0, // ox
329
329
  'unicorn/prefer-import-meta-properties': 2,
330
330
  'unicorn/no-array-callback-reference': 0, // false positives
331
331
  'unicorn/no-process-exit': 0,
@@ -412,26 +412,26 @@ export default {
412
412
  'unicorn/prefer-modern-math-apis': 0, // oxlint
413
413
  'unicorn/prefer-set-size': 0, // oxlint
414
414
  'unicorn/prefer-string-starts-ends-with': 0, // oxlint
415
- '@typescript-eslint/return-await': [2, 'always'],
416
- '@typescript-eslint/require-await': 0,
415
+ '@typescript-eslint/return-await': [2, 'always'], // ox is not good yet
416
+ '@typescript-eslint/require-await': 0, // ox
417
417
  'unicorn/no-array-reverse': 0, // too early
418
- '@typescript-eslint/no-misused-promises': 0,
418
+ '@typescript-eslint/no-misused-promises': 0, // ox, but not good rule
419
419
  '@typescript-eslint/no-unsafe-assignment': 0,
420
420
  '@typescript-eslint/no-unsafe-member-access': 0,
421
421
  '@typescript-eslint/no-unsafe-call': 0,
422
- '@typescript-eslint/no-unsafe-function-type': 2,
422
+ '@typescript-eslint/no-unsafe-function-type': 0, // ox
423
423
  '@typescript-eslint/no-wrapper-object-types': 2,
424
424
  '@typescript-eslint/no-empty-object-type': [
425
- 2,
425
+ 0, // ox
426
426
  {
427
427
  allowInterfaces: 'always',
428
428
  },
429
429
  ],
430
- '@typescript-eslint/no-unnecessary-template-expression': 2,
430
+ '@typescript-eslint/no-unnecessary-template-expression': 0, // ox
431
431
  '@typescript-eslint/no-unnecessary-parameter-property-assignment': 2,
432
- '@typescript-eslint/restrict-template-expressions': 0,
432
+ '@typescript-eslint/restrict-template-expressions': 0, // ox
433
433
  '@typescript-eslint/no-unsafe-return': 0,
434
- '@typescript-eslint/restrict-plus-operands': 0,
434
+ '@typescript-eslint/restrict-plus-operands': 0, // ox
435
435
  '@typescript-eslint/unbound-method': 0,
436
436
  '@typescript-eslint/no-unsafe-argument': 0, // prevents "legit" use of `any`
437
437
  'unicorn/prefer-export-from': 0, // breaks auto-imports in IntelliJ Idea
@@ -460,9 +460,9 @@ export default {
460
460
  'no-else-return': 2,
461
461
  'no-sequences': 2,
462
462
  'no-useless-concat': 0, // oxlint
463
- '@typescript-eslint/ban-tslint-comment': 2,
463
+ '@typescript-eslint/ban-tslint-comment': 0, // ox
464
464
  '@typescript-eslint/explicit-function-return-type': [
465
- 2,
465
+ 0, // ox
466
466
  {
467
467
  // defaults
468
468
  // allowExpressions: false,
@@ -478,14 +478,14 @@ export default {
478
478
  },
479
479
  ],
480
480
  '@typescript-eslint/method-signature-style': 2,
481
- '@typescript-eslint/no-unnecessary-boolean-literal-compare': 2,
481
+ '@typescript-eslint/no-unnecessary-boolean-literal-compare': 0, // ox
482
482
  // '@typescript-eslint/no-unnecessary-condition': [2, {
483
483
  // allowConstantLoopConditions: true,
484
484
  // }],
485
485
  '@typescript-eslint/prefer-includes': 2,
486
486
  '@typescript-eslint/prefer-optional-chain': 2,
487
487
  '@typescript-eslint/prefer-string-starts-ends-with': 2,
488
- '@typescript-eslint/prefer-ts-expect-error': 2,
488
+ '@typescript-eslint/prefer-ts-expect-error': 0, // ox
489
489
  '@typescript-eslint/explicit-member-accessibility': [
490
490
  2,
491
491
  {
@@ -493,16 +493,37 @@ export default {
493
493
  overrides: { parameterProperties: 'off' },
494
494
  },
495
495
  ],
496
- '@typescript-eslint/no-mixed-enums': 2,
497
- '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 2,
496
+ '@typescript-eslint/no-confusing-non-null-assertion': 0, // ox
497
+ '@typescript-eslint/no-mixed-enums': 0, // ox
498
+ '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 0, // ox
498
499
  '@typescript-eslint/no-unnecessary-qualifier': 2,
499
- '@typescript-eslint/prefer-enum-initializers': 2,
500
- '@typescript-eslint/prefer-literal-enum-member': 2,
500
+ '@typescript-eslint/prefer-enum-initializers': 0, // ox
501
+ '@typescript-eslint/prefer-literal-enum-member': 0, // ox
501
502
  '@typescript-eslint/prefer-reduce-type-parameter': 0, // gives ts compilation error
502
503
  '@typescript-eslint/prefer-nullish-coalescing': 0, // we prefer `||` actually
503
504
  '@typescript-eslint/dot-notation': 0, // not always desireable
504
505
  '@typescript-eslint/consistent-indexed-object-style': 0, // Record looses the name of the key
505
506
  '@typescript-eslint/no-unsafe-enum-comparison': 0, // not practically helpful
507
+ '@typescript-eslint/no-base-to-string': 0, // oxlint
508
+ '@typescript-eslint/await-thenable': 0, // oxlint
509
+ '@typescript-eslint/no-array-delete': 0, // oxlint
510
+
511
+ '@typescript-eslint/no-confusing-void-expression': 0,
512
+ '@typescript-eslint/no-duplicate-type-constituents': 0,
513
+ '@typescript-eslint/no-for-in-array': 0,
514
+ '@typescript-eslint/no-implied-eval': 0,
515
+ '@typescript-eslint/no-meaningless-void-operator': 0,
516
+ '@typescript-eslint/no-unnecessary-type-arguments': 0,
517
+ '@typescript-eslint/no-unnecessary-type-assertion': 0,
518
+ '@typescript-eslint/no-unsafe-type-assertion': 0,
519
+ '@typescript-eslint/no-unsafe-unary-minus': 0,
520
+ '@typescript-eslint/non-nullable-type-assertion-style': 0,
521
+ '@typescript-eslint/prefer-return-this-type': 0,
522
+ '@typescript-eslint/related-getter-setter-pairs': 0,
523
+ '@typescript-eslint/require-array-sort-compare': 0,
524
+ '@typescript-eslint/switch-exhaustiveness-check': 0,
525
+ '@typescript-eslint/use-unknown-in-catch-callback-variable': 0,
526
+
506
527
  // stylistic - replaced by custom oxlint rules
507
528
  // '@stylistic/padding-line-between-statements': [
508
529
  // 2,
@@ -1,5 +1,6 @@
1
1
  import sharedConfig from '@naturalcycles/dev-lib/cfg/eslint.config.js'
2
2
 
3
3
  export default {
4
+ // oxlint-disable-next-line typescript/no-misused-spread
4
5
  ...sharedConfig,
5
6
  }
@@ -65,7 +65,14 @@ if (eslintConfigPath) {
65
65
  let oxlintCmd = undefined
66
66
 
67
67
  if (oxlintConfigPath) {
68
- oxlintCmd = ['oxlint', '--fix', '--fix-suggestions', '--fix-dangerously', '--max-warnings=0']
68
+ oxlintCmd = [
69
+ 'oxlint',
70
+ '--type-aware',
71
+ '--fix',
72
+ '--fix-suggestions',
73
+ '--fix-dangerously',
74
+ '--max-warnings=0',
75
+ ]
69
76
  .filter(Boolean)
70
77
  .join(' ')
71
78
  }
@@ -87,7 +87,7 @@
87
87
  "typescript/non-nullable-type-assertion-style": 2,
88
88
  "typescript/prefer-literal-enum-member": 2,
89
89
  "typescript/promise-function-async": [
90
- 2,
90
+ 0, // todo, options don't work yet
91
91
  {
92
92
  "checkArrowFunctions": false,
93
93
  "checkFunctionDeclarations": true,
@@ -96,6 +96,38 @@
96
96
  }
97
97
  ],
98
98
  "typescript/prefer-for-of": 2,
99
+ "typescript/no-confusing-non-null-assertion": 2,
100
+ "typescript/ban-tslint-comment": 2,
101
+ "typescript/prefer-function-type": 2,
102
+ "typescript/prefer-namespace-keyword": 2,
103
+ "typescript/consistent-generic-constructors": [2, "constructor"],
104
+ "typescript/consistent-type-definitions": [2, "interface"],
105
+ "typescript/consistent-type-imports": 2,
106
+ "typescript/no-inferrable-types": [
107
+ 2,
108
+ {
109
+ "ignoreParameters": true
110
+ }
111
+ ],
112
+ "typescript/adjacent-overload-signatures": 2,
113
+ "typescript/array-type": 2,
114
+ "typescript/prefer-enum-initializers": 2,
115
+ "typescript/prefer-promise-reject-errors": 2,
116
+ "typescript/prefer-ts-expect-error": 2,
117
+ "typescript/require-await": 0, // not good yet
118
+ "typescript/restrict-plus-operands": 2,
119
+ "typescript/return-await": [0, "always"], // not good yet
120
+ "typescript/only-throw-error": 2,
121
+ "typescript/no-unsafe-function-type": 2,
122
+ "typescript/no-misused-promises": 0,
123
+ "typescript/no-mixed-enums": 2,
124
+ "typescript/no-unnecessary-type-assertion": 2,
125
+ "typescript/no-unnecessary-boolean-literal-compare": 2,
126
+ "typescript/no-base-to-string": 2,
127
+ "typescript/unbound-method": 0,
128
+ "typescript/require-array-sort-compare": 0, // not good
129
+ "typescript/restrict-template-expressions": 0, // not good
130
+ "typescript/no-redundant-type-constituents": 0, // `'a' | string` is still useful for DX
99
131
  "unicorn/no-anonymous-default-export": 2,
100
132
  "unicorn/no-array-reduce": 2,
101
133
  "unicorn/no-document-cookie": 2,
@@ -5,7 +5,7 @@
5
5
  "extends": "./tsconfig.src.json",
6
6
  "compilerOptions": {
7
7
  "rootDir": "${configDir}/..",
8
- "baseUrl": "${configDir}/..",
8
+ // "baseUrl": "${configDir}/..",
9
9
  "outDir": "${configDir}/../dist/e2e",
10
10
  "paths": {
11
11
  "@src/*": ["${configDir}/../src/*"]
@@ -5,7 +5,7 @@
5
5
  "extends": "./tsconfig.src.json",
6
6
  "compilerOptions": {
7
7
  "rootDir": "${configDir}/..",
8
- "baseUrl": "${configDir}/..",
8
+ // "baseUrl": "${configDir}/..",
9
9
  "outDir": "${configDir}/../dist/scripts",
10
10
  "paths": {
11
11
  "@src/*": ["${configDir}/../src/*"]
@@ -6,7 +6,7 @@
6
6
  {
7
7
  "compilerOptions": {
8
8
  "rootDir": "${configDir}/src",
9
- "baseUrl": "${configDir}/src",
9
+ // "baseUrl": "${configDir}/src",
10
10
  "outDir": "${configDir}/dist",
11
11
  // Target/module
12
12
  "target": "es2024",
package/dist/lint.util.js CHANGED
@@ -142,6 +142,7 @@ export function runOxlint(fix = true) {
142
142
  args: [
143
143
  // '--report-unused-disable-directives',
144
144
  '--max-warnings=0',
145
+ '--type-aware',
145
146
  fix && '--fix',
146
147
  fix && '--fix-suggestions',
147
148
  fix && '--fix-dangerously',
@@ -151,7 +152,7 @@ export function runOxlint(fix = true) {
151
152
  }
152
153
  const prettierPaths = [
153
154
  // Everything inside these folders
154
- `./{${prettierDirs}}/**/*.{${prettierExtensionsAll}}`,
155
+ `./{${prettierDirs.join(',')}}/**/*.{${prettierExtensionsAll}}`,
155
156
  // Root
156
157
  `./*.{${prettierExtensionsAll}}`,
157
158
  // Exclude
@@ -189,7 +190,7 @@ export function runPrettier(opt = {}) {
189
190
  }
190
191
  const stylelintPaths = [
191
192
  // Everything inside these folders
192
- `./{${prettierDirs}}/**/*.{${stylelintExtensions}}`,
193
+ `./{${prettierDirs.join(',')}}/**/*.{${stylelintExtensions}}`,
193
194
  // Exclude
194
195
  ...lintExclude.map((s) => `!${s}`),
195
196
  ];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
3
  "type": "module",
4
- "version": "20.10.1",
4
+ "version": "20.11.1",
5
5
  "dependencies": {
6
6
  "@biomejs/biome": "^2",
7
7
  "@commitlint/cli": "^20",
@@ -23,6 +23,7 @@
23
23
  "micromatch": "^4",
24
24
  "mitm": "^1",
25
25
  "oxlint": "^1",
26
+ "oxlint-tsgolint": "^0.5",
26
27
  "prettier": "^3",
27
28
  "typescript-eslint": "^8",
28
29
  "vue-eslint-parser": "^10"