@stylistic/eslint-plugin-ts
Advanced tools
Comparing version 2.13.0 to 3.0.0
@@ -876,3 +876,5 @@ | ||
avoidEscape?: boolean | ||
allowTemplateLiterals?: boolean | ||
allowTemplateLiterals?: | ||
| boolean | ||
| ('never' | 'avoidEscape' | 'always') | ||
ignoreStringLiterals?: boolean | ||
@@ -879,0 +881,0 @@ } |
@@ -84,3 +84,6 @@ 'use strict'; | ||
node, | ||
loc: leftToken.loc.start, | ||
loc: { | ||
start: leftToken.loc.end, | ||
end: rightToken.loc.start | ||
}, | ||
messageId: "unexpectedWhitespace", | ||
@@ -96,9 +99,6 @@ fix(fixer) { | ||
} | ||
if (!hasNewline) { | ||
return fixer.removeRange([ | ||
leftToken.range[1], | ||
rightToken.range[0] | ||
]); | ||
} | ||
return null; | ||
return fixer.removeRange([ | ||
leftToken.range[1], | ||
rightToken.range[0] | ||
]); | ||
} | ||
@@ -118,3 +118,6 @@ }); | ||
node, | ||
loc: leftToken.loc.start, | ||
loc: { | ||
start: leftToken.loc.end, | ||
end: rightToken.loc.start | ||
}, | ||
messageId, | ||
@@ -141,3 +144,6 @@ fix(fixer) { | ||
node, | ||
loc: leftToken.loc.start, | ||
loc: { | ||
start: leftToken.loc.end, | ||
end: rightToken.loc.start | ||
}, | ||
messageId: "missing", | ||
@@ -151,3 +157,6 @@ fix(fixer) { | ||
node, | ||
loc: leftToken.loc.start, | ||
loc: { | ||
start: leftToken.loc.end, | ||
end: rightToken.loc.start | ||
}, | ||
messageId: "unexpectedNewline", | ||
@@ -154,0 +163,0 @@ fix(fixer) { |
@@ -710,3 +710,3 @@ 'use strict'; | ||
if (prevAlignedNode !== prevNode) | ||
prevAlignedNode = void 0; | ||
prevAlignedNode = undefined; | ||
if (prevAlignedNode && continuesAlignGroup(prevAlignedNode, node)) { | ||
@@ -713,0 +713,0 @@ currentAlignGroup.push(node); |
@@ -308,3 +308,3 @@ 'use strict'; | ||
currentNode = currentNode.parent; | ||
if (currentNode === null || currentNode === void 0) | ||
if (currentNode === null || currentNode === undefined) | ||
throw new Error("Nodes are not in the ancestor-descendant relationship."); | ||
@@ -311,0 +311,0 @@ path.push(currentNode); |
@@ -276,4 +276,4 @@ 'use strict'; | ||
const shouldCheckPenultimate = options.arraysInObjectsException && astUtils.isClosingBracketToken(penultimate) || options.objectsInObjectsException && astUtils.isClosingBraceToken(penultimate); | ||
const penultimateType = shouldCheckPenultimate ? sourceCode.getNodeByRangeIndex(penultimate.range[0]).type : void 0; | ||
const closingCurlyBraceMustBeSpaced = options.arraysInObjectsException && penultimateType === utils$1.AST_NODE_TYPES.TSTupleType || options.objectsInObjectsException && penultimateType !== void 0 && [ | ||
const penultimateType = shouldCheckPenultimate ? sourceCode.getNodeByRangeIndex(penultimate.range[0]).type : undefined; | ||
const closingCurlyBraceMustBeSpaced = options.arraysInObjectsException && penultimateType === utils$1.AST_NODE_TYPES.TSTupleType || options.objectsInObjectsException && penultimateType !== undefined && [ | ||
utils$1.AST_NODE_TYPES.TSMappedType, | ||
@@ -280,0 +280,0 @@ utils$1.AST_NODE_TYPES.TSTypeLiteral |
@@ -72,3 +72,11 @@ 'use strict'; | ||
allowTemplateLiterals: { | ||
type: "boolean" | ||
anyOf: [ | ||
{ | ||
type: "boolean" | ||
}, | ||
{ | ||
type: "string", | ||
enum: ["never", "avoidEscape", "always"] | ||
} | ||
] | ||
}, | ||
@@ -92,8 +100,20 @@ ignoreStringLiterals: { | ||
const options = context.options[1]; | ||
const allowTemplateLiterals = options && typeof options === "object" && options.allowTemplateLiterals === true; | ||
const ignoreStringLiterals = options && typeof options === "object" && options.ignoreStringLiterals === true; | ||
const sourceCode = context.sourceCode; | ||
let avoidEscape = options && typeof options === "object" && options.avoidEscape === true; | ||
if (options === AVOID_ESCAPE) | ||
let avoidEscape = false; | ||
let ignoreStringLiterals = false; | ||
let allowTemplateLiteralsAlways = false; | ||
let allowTemplateLiteralsToAvoidEscape = false; | ||
if (typeof options === "object") { | ||
avoidEscape = options.avoidEscape === true; | ||
ignoreStringLiterals = options.ignoreStringLiterals === true; | ||
if (typeof options.allowTemplateLiterals === "string") { | ||
allowTemplateLiteralsAlways = options.allowTemplateLiterals === "always"; | ||
allowTemplateLiteralsToAvoidEscape = allowTemplateLiteralsAlways || options.allowTemplateLiterals === "avoidEscape"; | ||
} else if (typeof options.allowTemplateLiterals === "boolean") { | ||
allowTemplateLiteralsAlways = options.allowTemplateLiterals === true; | ||
allowTemplateLiteralsToAvoidEscape = options.allowTemplateLiterals === true; | ||
} | ||
} else if (options === AVOID_ESCAPE) { | ||
avoidEscape = true; | ||
} | ||
function isJSXLiteral(node) { | ||
@@ -197,6 +217,6 @@ if (!node.parent) | ||
TemplateLiteral(node) { | ||
if (allowTemplateLiterals || quoteOption === "backtick" || isUsingFeatureOfTemplateLiteral(node)) { | ||
if (allowTemplateLiteralsAlways || quoteOption === "backtick" || isUsingFeatureOfTemplateLiteral(node)) { | ||
return; | ||
} | ||
if (allowTemplateLiterals && avoidEscape && sourceCode.getText(node).includes(settings.quote)) | ||
if (allowTemplateLiteralsToAvoidEscape && avoidEscape && sourceCode.getText(node).includes(settings.quote)) | ||
return; | ||
@@ -238,3 +258,3 @@ context.report({ | ||
{ | ||
allowTemplateLiterals: false, | ||
allowTemplateLiterals: "never", | ||
avoidEscape: false, | ||
@@ -241,0 +261,0 @@ ignoreStringLiterals: false |
@@ -10,4 +10,4 @@ 'use strict'; | ||
const globals = { | ||
...options?.before !== void 0 ? { before: options.before } : {}, | ||
...options?.after !== void 0 ? { after: options.after } : {} | ||
...options?.before !== undefined ? { before: options.before } : {}, | ||
...options?.after !== undefined ? { after: options.after } : {} | ||
}; | ||
@@ -14,0 +14,0 @@ const override = options?.overrides ?? {}; |
@@ -11,3 +11,3 @@ 'use strict'; | ||
// Only include fixable rules | ||
rule.meta.fixable && !rule.meta.deprecated && key === rule.meta.docs.url.split("/").pop() && (!filter) | ||
rule.meta.fixable && !rule.meta.deprecated && key === rule.meta.docs.url.split("/").pop() && (true) | ||
) | ||
@@ -14,0 +14,0 @@ ).map(([key]) => [`${name}/${key}`, 2]) |
{ | ||
"name": "@stylistic/eslint-plugin-ts", | ||
"type": "commonjs", | ||
"version": "2.13.0", | ||
"version": "3.0.0", | ||
"author": "Anthony Fu <anthonyfu117@hotmail.com>", | ||
@@ -66,3 +66,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@typescript-eslint/utils": "^8.13.0", | ||
"@typescript-eslint/utils": "8.13.0", | ||
"eslint-visitor-keys": "^4.2.0", | ||
@@ -69,0 +69,0 @@ "espree": "^10.3.0" |
Sorry, the diff of this file is too big to display
393165
10858
+ Added@typescript-eslint/scope-manager@8.13.0(transitive)
+ Added@typescript-eslint/types@8.13.0(transitive)
+ Added@typescript-eslint/typescript-estree@8.13.0(transitive)
+ Added@typescript-eslint/utils@8.13.0(transitive)
+ Added@typescript-eslint/visitor-keys@8.13.0(transitive)
+ Addedts-api-utils@1.4.3(transitive)
+ Addedtypescript@5.8.2(transitive)
- Removed@typescript-eslint/scope-manager@8.25.0(transitive)
- Removed@typescript-eslint/types@8.25.0(transitive)
- Removed@typescript-eslint/typescript-estree@8.25.0(transitive)
- Removed@typescript-eslint/utils@8.25.0(transitive)
- Removed@typescript-eslint/visitor-keys@8.25.0(transitive)
- Removedts-api-utils@2.0.1(transitive)
- Removedtypescript@5.7.3(transitive)