Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- remove unused types - stop using `namespace` to prevent internal types from being published - mark `@internal` to internal types
- Loading branch information
1 parent
1a17872
commit d9fecd8
Showing
20 changed files
with
632 additions
and
611 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"stylelint": major | ||
--- | ||
|
||
Changed: type definitions to reorganize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,20 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Given an object of problem messages, return another | ||
* that provides the same messages postfixed with the rule | ||
* that has been violated. | ||
* | ||
* @template {import('stylelint').RuleMessages} T | ||
* @template {{[K in keyof T]: T[K]}} R | ||
* @param {string} ruleName | ||
* @param {T} messages - Object whose keys are message identifiers | ||
* and values are either message strings or functions that return message strings | ||
* @returns {R} New message object, whose messages will be marked with the rule name | ||
* @type {import('stylelint').Utils['ruleMessages']} | ||
*/ | ||
function ruleMessages(ruleName, messages) { | ||
/** @typedef {keyof T} K */ | ||
const newMessages = /** @type {R} */ ({}); | ||
module.exports = function ruleMessages(ruleName, messages) { | ||
/** @type {import('stylelint').RuleMessages} */ | ||
const newMessages = {}; | ||
|
||
for (const [messageId, messageText] of /** @type {[K, T[K]][]} */ (Object.entries(messages))) { | ||
for (const [messageId, messageText] of Object.entries(messages)) { | ||
if (typeof messageText === 'string') { | ||
newMessages[messageId] = /** @type {R[K]} */ (`${messageText} (${ruleName})`); | ||
newMessages[messageId] = `${messageText} (${ruleName})`; | ||
} else { | ||
newMessages[messageId] = /** @type {R[K]} */ ( | ||
(...args) => `${messageText(...args)} (${ruleName})` | ||
); | ||
newMessages[messageId] = (...args) => `${messageText(...args)} (${ruleName})`; | ||
} | ||
} | ||
|
||
// @ts-expect-error -- TS2322: Type 'RuleMessages' is not assignable to type 'R'. | ||
return newMessages; | ||
} | ||
|
||
module.exports = /** @type {typeof import('stylelint').utils.ruleMessages} */ (ruleMessages); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.