Skip to content

Commit

Permalink
feat: allow specifying cwd using the Node.js API
Browse files Browse the repository at this point in the history
  • Loading branch information
iiroj committed Apr 25, 2020
1 parent 85de3a3 commit a3bd9d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ const success = await lintStaged({
allowEmpty: false,
concurrent: true,
configPath: './path/to/configuration/file',
cwd: process.cwd(),
debug: false,
maxArgLength: null,
quiet: false,
Expand All @@ -445,6 +446,7 @@ const success = await lintStaged({
allowEmpty: false,
concurrent: true,
config: { '*.js': 'eslint --fix' },
cwd: process.cwd(),
debug: false,
maxArgLength: null,
quiet: false,
Expand Down
3 changes: 3 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function loadConfig(configPath) {
* @param {boolean | number} [options.concurrent] - The number of tasks to run concurrently, or false to run tasks serially
* @param {object} [options.config] - Object with configuration for programmatic API
* @param {string} [options.configPath] - Path to configuration file
* @param {Object} [options.cwd] - Current working directory
* @param {boolean} [options.debug] - Enable debug mode
* @param {number} [options.maxArgLength] - Maximum argument string length
* @param {boolean} [options.quiet] - Disable lint-staged’s own console output
Expand All @@ -65,6 +66,7 @@ module.exports = async function lintStaged(
concurrent = true,
config: configObject,
configPath,
cwd = process.cwd(),
debug = false,
maxArgLength,
quiet = false,
Expand Down Expand Up @@ -107,6 +109,7 @@ module.exports = async function lintStaged(
allowEmpty,
concurrent,
config,
cwd,
debug,
maxArgLength,
quiet,
Expand Down

0 comments on commit a3bd9d7

Please sign in to comment.