@naturalcycles/dev-lib 20.12.3 → 20.12.5

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.
@@ -327,6 +327,7 @@ export default {
327
327
  'prefer-promise-reject-errors': 0,
328
328
  '@typescript-eslint/prefer-promise-reject-errors': 0, // ox
329
329
  'unicorn/prefer-import-meta-properties': 2,
330
+ 'unicorn/prefer-response-static-json': 0, // ox
330
331
  'unicorn/no-array-callback-reference': 0, // false positives
331
332
  'unicorn/no-process-exit': 0,
332
333
  'unicorn/prefer-single-call': 0,
@@ -482,7 +483,7 @@ export default {
482
483
  // '@typescript-eslint/no-unnecessary-condition': [2, {
483
484
  // allowConstantLoopConditions: true,
484
485
  // }],
485
- '@typescript-eslint/prefer-includes': 2,
486
+ '@typescript-eslint/prefer-includes': 0, // ox
486
487
  '@typescript-eslint/prefer-optional-chain': 2,
487
488
  '@typescript-eslint/prefer-string-starts-ends-with': 2,
488
489
  '@typescript-eslint/prefer-ts-expect-error': 0, // ox
@@ -54,6 +54,11 @@ function isMethodOverload(node) {
54
54
 
55
55
  function getInsertionTarget(sourceCode, prevNode, nextNode) {
56
56
  const decoratorTarget = findDecoratorTarget(sourceCode, prevNode, nextNode)
57
+ const baseNode = nextNode.declaration || nextNode
58
+ const targetStart = decoratorTarget?.range?.[0] ?? baseNode?.range?.[0] ?? nextNode.range[0]
59
+ const docCommentTarget = findDocCommentBeforeIndex(sourceCode, prevNode, targetStart)
60
+ if (docCommentTarget) return docCommentTarget
61
+
57
62
  const commentTarget = findLeadingComment(sourceCode, prevNode, nextNode)
58
63
 
59
64
  let target = decoratorTarget || nextNode
@@ -88,6 +93,17 @@ function findDecoratorTarget(sourceCode, prevNode, nextNode) {
88
93
  return { range: [absolute, absolute], loc: null }
89
94
  }
90
95
 
96
+ function findDocCommentBeforeIndex(sourceCode, prevNode, targetStart) {
97
+ if (targetStart === undefined || targetStart <= prevNode.range[1]) return null
98
+
99
+ const slice = sourceCode.text.slice(prevNode.range[1], targetStart)
100
+ const docMatch = slice.match(/(\/\*\*[\s\S]*?\*\/)([ \t]*\r?\n[ \t]*)?$/)
101
+ if (!docMatch || docMatch.index === undefined) return null
102
+
103
+ const commentStart = prevNode.range[1] + docMatch.index
104
+ return { range: [commentStart, commentStart], loc: null }
105
+ }
106
+
91
107
  function hasBlankLineBetween(sourceCode, prevNode, nextNode) {
92
108
  if (!prevNode || !nextNode) return false
93
109
  if (!prevNode.range || !nextNode.range) return false
@@ -160,6 +160,8 @@
160
160
  "unicorn/no-zero-fractions": 2,
161
161
  "unicorn/prefer-array-some": 2,
162
162
  "unicorn/prefer-math-trunc": 2,
163
+ "unicorn/prefer-includes": 2,
164
+ "unicorn/prefer-response-static-json": 2,
163
165
  "import/no-named-default": 2,
164
166
  "unicorn/no-new-array": 0, // it's actually ok
165
167
  "unicorn/catch-error-name": [
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
3
  "type": "module",
4
- "version": "20.12.3",
4
+ "version": "20.12.5",
5
5
  "dependencies": {
6
6
  "@biomejs/biome": "^2",
7
7
  "@commitlint/cli": "^20",
8
8
  "@commitlint/config-conventional": "^20",
9
9
  "@eslint/js": "^9",
10
- "@inquirer/prompts": "^7",
10
+ "@inquirer/prompts": "^8",
11
11
  "@naturalcycles/js-lib": "^15",
12
12
  "@naturalcycles/nodejs-lib": "^15",
13
13
  "@vitest/coverage-v8": "^4",
@@ -23,7 +23,7 @@
23
23
  "micromatch": "^4",
24
24
  "mitm": "^1",
25
25
  "oxlint": "^1",
26
- "oxlint-tsgolint": "^0.6",
26
+ "oxlint-tsgolint": "^0.7",
27
27
  "prettier": "^3",
28
28
  "typescript-eslint": "^8",
29
29
  "vue-eslint-parser": "^10"