Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also find lint-staged config in package.yaml manifest (support pnpm) #1343

Closed
danielbayley opened this issue Oct 26, 2023 · 4 comments · Fixed by #1344
Closed

Also find lint-staged config in package.yaml manifest (support pnpm) #1343

danielbayley opened this issue Oct 26, 2023 · 4 comments · Fixed by #1344

Comments

@danielbayley
Copy link
Contributor

danielbayley commented Oct 26, 2023

Description

Since pnpm supports package.yaml (see: pnpm/pnpm#1799), it would be useful if a lint-staged property would also be respected from this alternative manifest format. json5 is also a possibility.

Since this project already supports reading config from YAML files, this should be an easy win…

Environment

  • OS: macOS Ventura
  • Node.js: v21.1.0
  • lint-staged: v15.0.2
@iiroj
Copy link
Member

iiroj commented Oct 27, 2023

Can you try if it starts working by sinply adding the file name to this list?

/**
* The list of files `lint-staged` will read configuration
* from, in the declared order.
*/
export const searchPlaces = [
PACKAGE_JSON,
'.lintstagedrc',
'.lintstagedrc.json',
'.lintstagedrc.yaml',
'.lintstagedrc.yml',
'.lintstagedrc.mjs',
'.lintstagedrc.js',
'.lintstagedrc.cjs',
'lint-staged.config.mjs',
'lint-staged.config.js',
'lint-staged.config.cjs',
]

@danielbayley danielbayley changed the title Also find eslintConfig in package.yaml manifest (support pnpm) Also find lint-staged config in package.yaml manifest (support pnpm) Oct 27, 2023
@danielbayley
Copy link
Contributor Author

danielbayley commented Oct 27, 2023

Can you try if it starts working by simply adding the file name to this list?

@iiroj It fails with a Validation Error—Should be a string, a function, or an array of strings and functions.—thrown from validateConfig.js… The exact same manifest in package.json format however does not.

@iiroj
Copy link
Member

iiroj commented Oct 27, 2023

Thanks, it probably assumes the file is directly the config, instead of there being the lint-staged key inside it.

danielbayley added a commit to danielbayley/lint-staged that referenced this issue Oct 27, 2023
@danielbayley
Copy link
Contributor Author

Thanks, it probably assumes the file is directly the config, instead of there being the lint-staged key inside it.

@iiroj Yeah I figured. See attempted implementation in #1344

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants