fix(lint): enhance ESLint configuration handling and improve caching for npm and yarn
Signed-off-by: 孙振宇 <>
This commit is contained in:
parent
bdb5d7e1a5
commit
f9d10df52d
@ -65,7 +65,7 @@ class DependenciesResolver {
|
|||||||
|
|
||||||
if (cachingEnabled) {
|
if (cachingEnabled) {
|
||||||
steps.dir(this.workspace) {
|
steps.dir(this.workspace) {
|
||||||
steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: '.npm-cache']]) {
|
steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: '.npm-cache', cacheValidityDecidingFile: 'package-lock.json']]) {
|
||||||
steps.sh "npm install --cache .npm-cache"
|
steps.sh "npm install --cache .npm-cache"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ class DependenciesResolver {
|
|||||||
|
|
||||||
if (cachingEnabled) {
|
if (cachingEnabled) {
|
||||||
steps.dir(this.workspace) {
|
steps.dir(this.workspace) {
|
||||||
steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: '.yarn-cache']]) {
|
steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: '.yarn-cache', cacheValidityDecidingFile: 'yarn.lock']]) {
|
||||||
steps.sh "yarn install --cache-folder .yarn-cache"
|
steps.sh "yarn install --cache-folder .yarn-cache"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,12 @@ class ESLint extends LinterBase {
|
|||||||
steps.dir(workspace) {
|
steps.dir(workspace) {
|
||||||
steps.log.info("${linterType.linter}", "Install eslint dependencies...")
|
steps.log.info("${linterType.linter}", "Install eslint dependencies...")
|
||||||
steps.sh("npm install -g ${deps.join(' ')}")
|
steps.sh("npm install -g ${deps.join(' ')}")
|
||||||
|
// check if given config file is not end with .json
|
||||||
|
if (!configs.endsWith('.json')) {
|
||||||
|
steps.log.warn("${linterType.linter}", "Invalid eslint configuration file, must be a JSON file, convert file as valid JSON file...")
|
||||||
|
steps.sh("mv ${configs} ${configs}.json")
|
||||||
|
configs = "${configs}.json"
|
||||||
|
}
|
||||||
steps.log.info("${linterType.linter}", "Running eslint...")
|
steps.log.info("${linterType.linter}", "Running eslint...")
|
||||||
steps.sh("eslint --config ${configs} ${workspace}")
|
steps.sh("eslint --config ${configs} ${workspace}")
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user