Refactor code-style

This commit is contained in:
Titus Wormer 2023-06-29 11:50:05 +02:00
parent 4fbc22e300
commit e55aa2a8b7
No known key found for this signature in database
GPG key ID: E6E581152ED04E2E
6 changed files with 1441 additions and 1273 deletions

2
dev/index.d.ts vendored
View file

@ -9,7 +9,6 @@ export {
} from './lib/html.js' } from './lib/html.js'
declare module 'micromark-util-types' { declare module 'micromark-util-types' {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface TokenTypeMap { interface TokenTypeMap {
directiveContainer: 'directiveContainer' directiveContainer: 'directiveContainer'
directiveContainerAttributes: 'directiveContainerAttributes' directiveContainerAttributes: 'directiveContainerAttributes'
@ -74,7 +73,6 @@ declare module 'micromark-util-types' {
directiveTextName: 'directiveTextName' directiveTextName: 'directiveTextName'
} }
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface CompileData { interface CompileData {
directiveAttributes?: Attribute[] directiveAttributes?: Attribute[]
directiveStack?: Directive[] directiveStack?: Directive[]

View file

@ -33,9 +33,8 @@ import {types} from 'micromark-util-symbol/types.js'
* @param {TokenType} attributeValueType * @param {TokenType} attributeValueType
* @param {TokenType} attributeValueMarker * @param {TokenType} attributeValueMarker
* @param {TokenType} attributeValueData * @param {TokenType} attributeValueData
* @param {boolean} [disallowEol=false] * @param {boolean | undefined} [disallowEol=false]
*/ */
/* eslint-disable-next-line max-params */
export function factoryAttributes( export function factoryAttributes(
effects, effects,
ok, ok,

View file

@ -23,9 +23,8 @@ import {types} from 'micromark-util-symbol/types.js'
* @param {TokenType} type * @param {TokenType} type
* @param {TokenType} markerType * @param {TokenType} markerType
* @param {TokenType} stringType * @param {TokenType} stringType
* @param {boolean} [disallowEol=false] * @param {boolean | undefined} [disallowEol=false]
*/ */
// eslint-disable-next-line max-params
export function factoryLabel( export function factoryLabel(
effects, effects,
ok, ok,
@ -37,7 +36,7 @@ export function factoryLabel(
) { ) {
let size = 0 let size = 0
let balance = 0 let balance = 0
/** @type {Token|undefined} */ /** @type {Token | undefined} */
let previous let previous
return start return start

View file

@ -22,8 +22,9 @@
* Current context. * Current context.
* @param {Directive} directive * @param {Directive} directive
* Directive. * Directive.
* @returns {boolean | void} * @returns {boolean | undefined}
* Signal whether the directive was handled. * Signal whether the directive was handled.
*
* Yield `false` to let the fallback (a special handle for `'*'`) handle it. * Yield `false` to let the fallback (a special handle for `'*'`) handle it.
* *
* @typedef Directive * @typedef Directive
@ -54,8 +55,8 @@ const own = {}.hasOwnProperty
* Create an extension for `micromark` to support directives when serializing * Create an extension for `micromark` to support directives when serializing
* to HTML. * to HTML.
* *
* @param {HtmlOptions | null | undefined} [options] * @param {HtmlOptions | null | undefined} [options={}]
* Configuration. * Configuration (default: `{}`).
* @returns {HtmlExtension} * @returns {HtmlExtension}
* Extension for `micromark` that can be passed in `htmlExtensions`, to * Extension for `micromark` that can be passed in `htmlExtensions`, to
* support directives when serializing to HTML. * support directives when serializing to HTML.
@ -283,9 +284,9 @@ export function directiveHtml(options) {
assert(stack, 'expected directive stack') assert(stack, 'expected directive stack')
const directive = stack.pop() const directive = stack.pop()
assert(directive, 'expected directive') assert(directive, 'expected directive')
/** @type {boolean|undefined} */ /** @type {boolean | undefined} */
let found let found
/** @type {boolean|void} */ /** @type {boolean | undefined} */
let result let result
assert(directive.name, 'expected `name`') assert(directive.name, 'expected `name`')

View file

@ -90,11 +90,21 @@
"strict": true "strict": true
}, },
"xo": { "xo": {
"overrides": [
{
"files": [
"**/*.ts"
],
"rules": {
"@typescript-eslint/consistent-type-definitions": "off"
}
}
],
"prettier": true, "prettier": true,
"rules": { "rules": {
"max-params": "off",
"n/file-extension-in-import": "off", "n/file-extension-in-import": "off",
"unicorn/no-this-assignment": "off", "unicorn/no-this-assignment": "off"
"unicorn/prefer-node-protocol": "off"
} }
} }
} }

File diff suppressed because it is too large Load diff