Skip to content

Can't commit to some files in docs folder #8346

Description

@james-tindal

When particular files in the docs folder are staged, the format:staged script throws, blocking committing.

To reproduce:
Type a comment in docs/join-us/quick-start.md
git add .
git commit or yarn run format:staged

The result will be something like this:

$ eslint "**/*.js" --fix && node docs/.format/format.js --staged && pretty-quick --staged --verbose --pattern "**/*.{js,json}"
/Users/james/Downloads/RSSHub-fix-docs-format/docs/.format/format.js:88
        const f = fullFileList.find((x) => x.path.indexOf(e) !== -1);
                                                  ^

TypeError: Cannot read properties of undefined (reading 'indexOf')
    at /Users/james/Downloads/RSSHub-fix-docs-format/docs/.format/format.js:88:51
    at Array.find (<anonymous>)
    at /Users/james/Downloads/RSSHub-fix-docs-format/docs/.format/format.js:88:32
    at Array.forEach (<anonymous>)
    at buildStagedList (/Users/james/Downloads/RSSHub-fix-docs-format/docs/.format/format.js:87:20)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async /Users/james/Downloads/RSSHub-fix-docs-format/docs/.format/format.js:106:24
Env Value
OS macOS 10.15.7
Node version 16.9.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions