@trigen/oxlint-config 9.2.0 → 9.2.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.
package/package.json
CHANGED
|
@@ -79,6 +79,17 @@ function getTypeSpecifierText(specifier, sourceCode) {
|
|
|
79
79
|
: `type ${text}`
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
function getLinebreak(text) {
|
|
83
|
+
return text.includes('\r\n') ? '\r\n' : '\n'
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function getLineIndent(text, index) {
|
|
87
|
+
const lineStart = text.lastIndexOf('\n', index - 1) + 1
|
|
88
|
+
const indentMatch = /^[ \t]*/.exec(text.slice(lineStart, index))
|
|
89
|
+
|
|
90
|
+
return indentMatch[0]
|
|
91
|
+
}
|
|
92
|
+
|
|
82
93
|
function getMergedText(typeNode, valueNode, sourceCode) {
|
|
83
94
|
const typeSpecifiers = typeNode.specifiers.map(specifier => getTypeSpecifierText(
|
|
84
95
|
specifier,
|
|
@@ -88,11 +99,15 @@ function getMergedText(typeNode, valueNode, sourceCode) {
|
|
|
88
99
|
specifier
|
|
89
100
|
))
|
|
90
101
|
const source = sourceCode.getText(valueNode.source)
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
const linebreak = getLinebreak(sourceCode.text)
|
|
103
|
+
const closingIndent = getLineIndent(sourceCode.text, valueNode.range[0])
|
|
104
|
+
const indent = `${closingIndent} `
|
|
105
|
+
const specifiers = [
|
|
93
106
|
...typeSpecifiers,
|
|
94
107
|
...valueSpecifiers
|
|
95
|
-
]
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
return `import {${linebreak}${indent}${specifiers.join(`,${linebreak}${indent}`)}${linebreak}${closingIndent}} from ${source}`
|
|
96
111
|
}
|
|
97
112
|
|
|
98
113
|
function getFixedText(node, sourceCode) {
|