diff --git a/.eslintrc.js b/.eslintrc.js index 5533fc7..b197a9b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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", diff --git a/src/adapter/js-yaml-adapter.ts b/src/adapter/js-yaml-adapter.ts index 25be6f0..d21ed5d 100644 --- a/src/adapter/js-yaml-adapter.ts +++ b/src/adapter/js-yaml-adapter.ts @@ -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 @@ -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