lint-staged
Advanced tools
Comparing version 15.2.4 to 15.2.5
@@ -10,2 +10,3 @@ /** @typedef {import('./index').Logger} Logger */ | ||
import { dynamicImport } from './dynamicImport.js' | ||
import { failedToLoadConfig } from './messages.js' | ||
import { resolveConfig } from './resolveConfig.js' | ||
@@ -121,6 +122,6 @@ import { | ||
} catch (error) { | ||
debugLog('Failed to load configuration!') | ||
logger.error(error) | ||
debugLog('Failed to load configuration from `%s` with error:\n', configPath, error) | ||
logger.error(failedToLoadConfig(configPath)) | ||
return {} | ||
} | ||
} |
@@ -88,1 +88,13 @@ import { inspect } from 'node:util' | ||
export const CONFIG_STDIN_ERROR = chalk.redBright(`${error} Failed to read config from stdin.`) | ||
export const failedToLoadConfig = (filepath) => | ||
chalk.redBright(`${error} Failed to read config from file "${filepath}".`) | ||
export const failedToParseConfig = ( | ||
filepath, | ||
error | ||
) => `${chalk.redBright(`${error} Failed to parse config from file "${filepath}".`)} | ||
${error} | ||
See https://github.com/okonet/lint-staged#configuration.` |
@@ -7,3 +7,3 @@ /** @typedef {import('./index').Logger} Logger */ | ||
import { configurationError } from './messages.js' | ||
import { configurationError, failedToParseConfig } from './messages.js' | ||
import { ConfigEmptyError, ConfigFormatError } from './symbols.js' | ||
@@ -27,10 +27,3 @@ import { validateBraces } from './validateBraces.js' | ||
/** | ||
* Runs config validation. Throws error if the config is not valid. | ||
* @param {Object} config | ||
* @param {string} configPath | ||
* @param {Logger} logger | ||
* @returns {Object} config | ||
*/ | ||
export const validateConfig = (config, configPath, logger) => { | ||
export const validateConfigLogic = (config, configPath, logger) => { | ||
debugLog('Validating config from `%s`...', configPath) | ||
@@ -105,8 +98,4 @@ | ||
logger.error(`Could not parse lint-staged config. | ||
logger.error(failedToParseConfig(configPath, message)) | ||
${message} | ||
See https://github.com/okonet/lint-staged#configuration.`) | ||
throw new Error(message) | ||
@@ -120,1 +109,17 @@ } | ||
} | ||
/** | ||
* Runs config validation. Throws error if the config is not valid. | ||
* @param {Object} config | ||
* @param {string} configPath | ||
* @param {Logger} logger | ||
* @returns {Object} config | ||
*/ | ||
export const validateConfig = (config, configPath, logger) => { | ||
try { | ||
return validateConfigLogic(config, configPath, logger) | ||
} catch (error) { | ||
logger.error(failedToParseConfig(configPath, error)) | ||
throw error | ||
} | ||
} |
{ | ||
"name": "lint-staged", | ||
"version": "15.2.4", | ||
"version": "15.2.5", | ||
"description": "Lint files staged by git", | ||
@@ -39,12 +39,12 @@ "license": "MIT", | ||
"dependencies": { | ||
"chalk": "5.3.0", | ||
"commander": "12.1.0", | ||
"debug": "4.3.4", | ||
"execa": "8.0.1", | ||
"lilconfig": "3.1.1", | ||
"listr2": "8.2.1", | ||
"micromatch": "4.0.6", | ||
"pidtree": "0.6.0", | ||
"string-argv": "0.3.2", | ||
"yaml": "2.4.2" | ||
"chalk": "~5.3.0", | ||
"commander": "~12.1.0", | ||
"debug": "~4.3.4", | ||
"execa": "~8.0.1", | ||
"lilconfig": "~3.1.1", | ||
"listr2": "~8.2.1", | ||
"micromatch": "~4.0.7", | ||
"pidtree": "~0.6.0", | ||
"string-argv": "~0.3.2", | ||
"yaml": "~2.4.2" | ||
}, | ||
@@ -51,0 +51,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121254
2091
+ Addeddebug@4.3.7(transitive)
+ Addedlilconfig@3.1.2(transitive)
+ Addedlistr2@8.2.4(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedms@2.1.3(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedyaml@2.4.5(transitive)
- Removeddebug@4.3.4(transitive)
- Removedlilconfig@3.1.1(transitive)
- Removedlistr2@8.2.1(transitive)
- Removedmicromatch@4.0.6(transitive)
- Removedms@2.1.2(transitive)
- Removedpicomatch@4.0.2(transitive)
- Removedyaml@2.4.2(transitive)
Updatedchalk@~5.3.0
Updatedcommander@~12.1.0
Updateddebug@~4.3.4
Updatedexeca@~8.0.1
Updatedlilconfig@~3.1.1
Updatedlistr2@~8.2.1
Updatedmicromatch@~4.0.7
Updatedpidtree@~0.6.0
Updatedstring-argv@~0.3.2
Updatedyaml@~2.4.2