@naturalcycles/dev-lib 20.54.3 → 20.56.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.
@@ -156,7 +156,7 @@ export default {
156
156
  'for-direction': 2,
157
157
  'getter-return': 2,
158
158
  'id-denylist': [
159
- 2,
159
+ 0, // ox
160
160
  'any',
161
161
  'Number',
162
162
  'number',
@@ -167,7 +167,7 @@ export default {
167
167
  'Undefined',
168
168
  'undefined',
169
169
  ],
170
- 'id-match': 2,
170
+ 'id-match': 0, // ox
171
171
  // 'simple-import-sort/imports': [
172
172
  // 2,
173
173
  // {
@@ -49,7 +49,7 @@ function describeStatement(node) {
49
49
  function isMethodOverload(node) {
50
50
  if (!node) return false
51
51
  if (node.type !== 'MethodDefinition' && node.type !== 'TSAbstractMethodDefinition') return false
52
- return node.value && node.value.type === 'TSEmptyBodyFunctionExpression'
52
+ return node.value?.type === 'TSEmptyBodyFunctionExpression'
53
53
  }
54
54
 
55
55
  function getInsertionTarget(sourceCode, prevNode, nextNode) {
@@ -86,7 +86,7 @@ function findDecoratorTarget(sourceCode, prevNode, nextNode) {
86
86
  const segment = sourceCode.text.slice(prevNode.range[1], nextNode.range[0])
87
87
  const decoratorRegex = /(?:^|\n)([ \t]*@)/
88
88
  const match = decoratorRegex.exec(segment)
89
- if (!match || match.index === undefined) return null
89
+ if (match?.index === undefined) return null
90
90
 
91
91
  const relative = match.index + match[0].length - match[1].length
92
92
  const absolute = prevNode.range[1] + relative
@@ -98,7 +98,7 @@ function findDocCommentBeforeIndex(sourceCode, prevNode, targetStart) {
98
98
 
99
99
  const slice = sourceCode.text.slice(prevNode.range[1], targetStart)
100
100
  const docMatch = slice.match(/(\/\*\*[\s\S]*?\*\/)([ \t]*\r?\n[ \t]*)?$/)
101
- if (!docMatch || docMatch.index === undefined) return null
101
+ if (docMatch?.index === undefined) return null
102
102
 
103
103
  const commentStart = prevNode.range[1] + docMatch.index
104
104
  return { range: [commentStart, commentStart], loc: null }
@@ -180,7 +180,7 @@ const paddingLineBetweenStatementsRule = {
180
180
  }
181
181
 
182
182
  for (const option of options) {
183
- if (!option || option.blankLine !== 'always') continue
183
+ if (option?.blankLine !== 'always') continue
184
184
 
185
185
  if (matchesSelector(option.prev, 'function') && matchesSelector(option.next, '*')) {
186
186
  requiresBlankLine.afterFunction = true
@@ -271,7 +271,7 @@ const paddingLineBetweenStatementsRule = {
271
271
  }
272
272
 
273
273
  function isSingleLine(node, sourceCode) {
274
- if (!node || !node.range) return false
274
+ if (!node?.range) return false
275
275
  const start = sourceCode.getLocFromIndex(node.range[0])
276
276
  const endIndex = node.range[1] > node.range[0] ? node.range[1] - 1 : node.range[1]
277
277
  const end = sourceCode.getLocFromIndex(endIndex)
@@ -93,6 +93,18 @@ export const sharedConfig = {
93
93
  'valid-title': 0,
94
94
  'vitest/valid-title': 0,
95
95
  'valid-describe-callback': 0,
96
+ // 'id-denylist': [
97
+ // 0, // actually not useful
98
+ // 'any',
99
+ // 'Number',
100
+ // 'number',
101
+ // 'String',
102
+ // 'string',
103
+ // 'Boolean',
104
+ // 'boolean',
105
+ // 'Undefined',
106
+ // 'undefined',
107
+ // ],
96
108
  'id-match': [
97
109
  2,
98
110
  '^.+$',
@@ -152,7 +164,7 @@ export const sharedConfig = {
152
164
  'guard-for-in': 2,
153
165
  'max-params': [2, { max: 5 }],
154
166
  'prefer-spread': 2,
155
- 'import/extensions': [0, 'always', { ignorePackages: true }], // disabled as it's buggy; would be nice to enable eventually
167
+ 'import/extensions': [2, 'always', { ignorePackages: true, checkTypeImports: true }],
156
168
  'import/newline-after-import': 2,
157
169
  'import/no-amd': 2,
158
170
  'import/no-commonjs': 2,
@@ -192,7 +204,7 @@ export const sharedConfig = {
192
204
  'typescript/no-unnecessary-type-constraint': 2,
193
205
  // "typescript/no-unsafe-argument": 2, // looks good, but too strict for now
194
206
  // "typescript/no-dynamic-delete": 2,
195
- 'typescript/prefer-optional-chain': 0, // buggy
207
+ 'typescript/prefer-optional-chain': 2,
196
208
  'typescript/non-nullable-type-assertion-style': 2,
197
209
  'typescript/prefer-literal-enum-member': 2,
198
210
  'typescript/prefer-reduce-type-parameter': 2,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
3
  "type": "module",
4
- "version": "20.54.3",
4
+ "version": "20.56.0",
5
5
  "dependencies": {
6
6
  "prompts": "^2",
7
7
  "@naturalcycles/js-lib": "^15",