Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module.exports = {
"plugin:import/typescript",
],
rules: {
// the base rule does not understand typescript, so use the typescript-eslint variant
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": "error",
"semi": ["error", "never"],
"sort-imports": [
"error",
Expand Down
15 changes: 7 additions & 8 deletions src/adapter/js-yaml-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import { Settings } from "../settings"
import { SortUtil } from "../util/sort-util"
import { removeTrailingCharacters, splitYaml } from "../util/yaml-text"

/**
* @param value Any loaded yaml value.
* @returns True for a mapping without keys, e.g. an empty document.
*/
const isEmptyMapping = (value: unknown): boolean =>
typeof value === "object" && value !== null && !Array.isArray(value) && Object.keys(value).length === 0

export class JsYamlAdapter {
settings: Settings

Expand Down Expand Up @@ -88,12 +95,4 @@ export class JsYamlAdapter {
}
return sortKeys
}

}

/**
* @param value Any loaded yaml value.
* @returns True for a mapping without keys, e.g. an empty document.
*/
const isEmptyMapping = (value: unknown): boolean =>
typeof value === "object" && value !== null && !Array.isArray(value) && Object.keys(value).length === 0
Loading