mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-21 12:08:03 +02:00
chore: upgrade dependencies (#7993)
* chore: upgrade dependencies * Fix lint * Bump more * Fix lint
This commit is contained in:
parent
38dd7cfa04
commit
275f509d13
35 changed files with 1779 additions and 1788 deletions
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import stylelint from 'stylelint';
|
||||
import stylelint, {type Rule} from 'stylelint';
|
||||
|
||||
const ruleName = 'docusaurus/copyright-header';
|
||||
const messages = stylelint.utils.ruleMessages(ruleName, {
|
||||
|
@ -14,46 +14,48 @@ const messages = stylelint.utils.ruleMessages(ruleName, {
|
|||
|
||||
type SecondaryOption = {header?: string};
|
||||
|
||||
const plugin = stylelint.createPlugin(
|
||||
ruleName,
|
||||
(primaryOption: boolean, secondaryOption: SecondaryOption, context) =>
|
||||
(root, result) => {
|
||||
stylelint.utils.validateOptions(
|
||||
result,
|
||||
ruleName,
|
||||
{
|
||||
actual: primaryOption,
|
||||
possible: [true, false],
|
||||
},
|
||||
{
|
||||
actual: secondaryOption,
|
||||
possible: (v) =>
|
||||
typeof (v as SecondaryOption | undefined)?.header === 'string',
|
||||
},
|
||||
);
|
||||
const rule: Rule<boolean, string> =
|
||||
(primaryOption, secondaryOption, context) => (root, result) => {
|
||||
stylelint.utils.validateOptions(
|
||||
result,
|
||||
ruleName,
|
||||
{
|
||||
actual: primaryOption,
|
||||
possible: [true, false],
|
||||
},
|
||||
{
|
||||
actual: secondaryOption,
|
||||
possible: (v) =>
|
||||
typeof (v as SecondaryOption | undefined)?.header === 'string',
|
||||
},
|
||||
);
|
||||
|
||||
if (
|
||||
root.first &&
|
||||
root.first.type === 'comment' &&
|
||||
root.first.source?.start?.column === 1
|
||||
) {
|
||||
const {text} = root.first;
|
||||
if (text === secondaryOption.header) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (context.fix) {
|
||||
root.first?.before(`/*${secondaryOption.header!}\n */`);
|
||||
if (
|
||||
root.first &&
|
||||
root.first.type === 'comment' &&
|
||||
root.first.source?.start?.column === 1
|
||||
) {
|
||||
const {text} = root.first;
|
||||
if (text === secondaryOption.header) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (context.fix) {
|
||||
root.first?.before(`/*${secondaryOption.header!}\n */`);
|
||||
return;
|
||||
}
|
||||
|
||||
stylelint.utils.report({
|
||||
message: messages.rejected,
|
||||
node: root,
|
||||
result,
|
||||
ruleName,
|
||||
});
|
||||
},
|
||||
);
|
||||
stylelint.utils.report({
|
||||
message: messages.rejected,
|
||||
node: root,
|
||||
result,
|
||||
ruleName,
|
||||
});
|
||||
};
|
||||
|
||||
rule.ruleName = ruleName;
|
||||
rule.messages = messages;
|
||||
|
||||
const plugin = stylelint.createPlugin(ruleName, rule);
|
||||
|
||||
export = plugin;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue