Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Jan 16, 2024
1 parent 4fb40d0 commit ccdad1b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
5 changes: 0 additions & 5 deletions .changeset/afraid-points-impress.md

This file was deleted.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"homepage": "https://ota-meshi.github.io/eslint-plugin-yml/",
"dependencies": {
"debug": "^4.3.2",
"eslint-compat-utils": "^0.3.0",
"eslint-compat-utils": "^0.3.1",
"lodash": "^4.17.21",
"natural-compare": "^1.4.0",
"yaml-eslint-parser": "^1.2.1"
Expand All @@ -80,8 +80,8 @@
"@types/natural-compare": "^1.4.0",
"@types/node": "^20.0.0",
"@types/semver": "^7.3.1",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
"cross-env": "^7.0.2",
"env-cmd": "^10.1.0",
"esbuild": "^0.19.3",
Expand Down
2 changes: 1 addition & 1 deletion src/rules/flow-mapping-curly-spacing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export default createRule("flow-mapping-curly-spacing", {
function checkForObject(node: AST.YAMLMapping) {
if (node.pairs.length === 0) return;

const first = sourceCode.getFirstToken(node)!;
const first = sourceCode.getFirstToken(node);
const last = getClosingBraceOfObject(node)!;
const second = sourceCode.getTokenAfter(first, {
includeComments: true,
Expand Down
10 changes: 5 additions & 5 deletions src/rules/indent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ export default createRule("indent", {
continue;
}
const elementTokens = {
firstToken: sourceCode.getFirstToken(node)!,
lastToken: sourceCode.getLastToken(node)!,
firstToken: sourceCode.getFirstToken(node),
lastToken: sourceCode.getLastToken(node),
};

// Collect comma/comment tokens between the last token of the previous node and the first token of this node.
Expand Down Expand Up @@ -321,7 +321,7 @@ export default createRule("indent", {
// | a,
// | b
// | ]
const open = sourceCode.getFirstToken(node)!;
const open = sourceCode.getFirstToken(node);
const close = sourceCode.getLastToken(node);
processNodeList(node.entries, open, close, 1);
} else if (node.style === "block") {
Expand Down Expand Up @@ -992,7 +992,7 @@ export default createRule("indent", {
if (li?.indentBlockScalar) {
const blockLiteral = li.indentBlockScalar.node;
const diff = li.expectedIndent - li.actualIndent;
const mark = sourceCode.getFirstToken(blockLiteral)!;
const mark = sourceCode.getFirstToken(blockLiteral);
const num = /\d+/u.exec(mark.value)?.[0];
if (num != null) {
const newIndent = Number(num) + diff;
Expand Down Expand Up @@ -1060,7 +1060,7 @@ export default createRule("indent", {
if (li.indentBlockScalar) {
const blockLiteral = li.indentBlockScalar.node;
const diff = li.expectedIndent - li.actualIndent;
const mark = sourceCode.getFirstToken(blockLiteral)!;
const mark = sourceCode.getFirstToken(blockLiteral);
yield fixer.replaceText(
mark,
mark.value.replace(/\d+/u, (num: string) => `${Number(num) + diff}`),
Expand Down
2 changes: 1 addition & 1 deletion src/rules/sort-sequence-values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class YAMLEntryData {
const before =
this.index > 0
? this.sequence.entries[this.index - 1].aroundTokens.after
: sourceCode.getFirstToken(this.sequence.node)!;
: sourceCode.getFirstToken(this.sequence.node);
const after = sourceCode.getTokenAfter(before)!;
return (this.cachedAroundTokens = { before, after });
}
Expand Down

0 comments on commit ccdad1b

Please sign in to comment.