mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 07:37:19 +02:00
chore(v2): upgrade devDependencies (#2538)
* chore(v2): upgrade devDependencies * chore(v2): upgrade devDependencies * chore: prettier
This commit is contained in:
parent
ea8c916528
commit
b07507c9cc
148 changed files with 2385 additions and 1975 deletions
|
@ -19,7 +19,7 @@ const DEFAULT_OPTIONS = {
|
|||
remarkPlugins: [emoji, slug, rightToc],
|
||||
};
|
||||
|
||||
module.exports = async function(fileString) {
|
||||
module.exports = async function (fileString) {
|
||||
const callback = this.async();
|
||||
|
||||
const {data, content} = matter(fileString);
|
||||
|
|
|
@ -14,15 +14,15 @@ const parseOptions = {
|
|||
plugins: ['jsx'],
|
||||
sourceType: 'module',
|
||||
};
|
||||
const isImport = child => child.type === 'import';
|
||||
const hasImports = index => index > -1;
|
||||
const isExport = child => child.type === 'export';
|
||||
const isImport = (child) => child.type === 'import';
|
||||
const hasImports = (index) => index > -1;
|
||||
const isExport = (child) => child.type === 'export';
|
||||
|
||||
const isTarget = (child, name) => {
|
||||
let found = false;
|
||||
const ast = parse(child.value, parseOptions);
|
||||
traverse(ast, {
|
||||
VariableDeclarator: path => {
|
||||
VariableDeclarator: (path) => {
|
||||
if (path.node.id.name === name) {
|
||||
found = true;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ const getOrCreateExistingTargetIndex = (children, name) => {
|
|||
const plugin = (options = {}) => {
|
||||
const name = options.name || 'rightToc';
|
||||
|
||||
const transformer = node => {
|
||||
const transformer = (node) => {
|
||||
const headings = search(node);
|
||||
const {children} = node;
|
||||
const targetIndex = getOrCreateExistingTargetIndex(children, name);
|
||||
|
|
|
@ -57,7 +57,7 @@ describe('slug plugin', () => {
|
|||
|
||||
test('should not overwrite `data` on headings', () => {
|
||||
const result = process('# Normal\n', [
|
||||
function() {
|
||||
function () {
|
||||
function transform(tree) {
|
||||
tree.children[0].data = {foo: 'bar'};
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ describe('slug plugin', () => {
|
|||
|
||||
test('should not overwrite `data.hProperties` on headings', () => {
|
||||
const result = process('# Normal\n', [
|
||||
function() {
|
||||
function () {
|
||||
function transform(tree) {
|
||||
tree.children[0].data = {hProperties: {className: ['foo']}};
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ describe('slug plugin', () => {
|
|||
'## Something also',
|
||||
].join('\n\n'),
|
||||
[
|
||||
function() {
|
||||
function () {
|
||||
function transform(tree) {
|
||||
tree.children[1].data = {hProperties: {id: 'here'}};
|
||||
tree.children[3].data = {hProperties: {id: 'something'}};
|
||||
|
|
|
@ -12,7 +12,7 @@ const toString = require('mdast-util-to-string');
|
|||
const slugs = require('github-slugger')();
|
||||
|
||||
function slug() {
|
||||
const transformer = ast => {
|
||||
const transformer = (ast) => {
|
||||
slugs.reset();
|
||||
|
||||
function visitor(headingNode) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue