Skip to content

Update lint-staged example to use node.js path#30510

Merged
kodiakhq[bot] merged 7 commits intovercel:canaryfrom
mi-na-bot:patch-1
Jan 1, 2022
Merged

Update lint-staged example to use node.js path#30510
kodiakhq[bot] merged 7 commits intovercel:canaryfrom
mi-na-bot:patch-1

Conversation

@mi-na-bot
Copy link
Copy Markdown
Contributor

@mi-na-bot mi-na-bot commented Oct 28, 2021

The current example attempts to remove resolve the relative pathname of the absolute pathnames given by lint-staged using string manipulation and process.cwd(). This is a risky solution because pathnames have many platform dependent edge cases. The example also returns pathnames that are technically wrong in linux. /home/project/file => /file,

I propose to use the utilities provided by node.js to resolve the relative pathnames, and to format the sample .lintstagedrc.js file in a manner easier for novice programmers to understand and modify.

Bug

  • Related issues linked using fixes #number
  • Integration tests added
  • Errors have helpful link attached, see contributing.md

Feature

  • Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
  • Related issues linked using fixes #number
  • Integration tests added
  • Documentation added
  • Telemetry added. In case of a feature if it's used or not.
  • Errors have helpful link attached, see contributing.md

Documentation / Examples

  • Make sure the linting passes by running yarn lint

The current example attempts to remove resolve the relative pathname of the absolute pathnames given by `lint-staged` using string manipulation and `process.cwd()`. This is a risky solution because pathnames have many platform dependent edge cases. The example also returns pathnames that are technically wrong in linux. `/home/project/file => /file`,

I propose to use the utilities provided by node.js to resolve the relative pathnames, and to format the sample `.lintstagedrc.js` file in a manner easier for novice programmers to understand and modify.
@mi-na-bot mi-na-bot changed the title Update lint-staged example to use node.js path Update lint-staged example to use node.js path Oct 28, 2021
Comment thread docs/basic-features/eslint.md Outdated
Copy link
Copy Markdown
Member

@ijjk ijjk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@kodiakhq kodiakhq Bot merged commit a178072 into vercel:canary Jan 1, 2022
@vercel vercel locked as resolved and limited conversation to collaborators Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants