我正试图在我们的项目中实现esint缓存。虽然它在本地机器上运行得很好,但在gitlab lint阶段不起作用。
本地:
Gitlab:
从屏幕截图中可以看出,gitlab没有使用缓存。
package.json:
"scripts": {
"build": "nuxt build",
"dev": "nuxt",
"generate": "nuxt generate",
"start": "nuxt start",
"lint": "npm-run-all lint:eslint lint:ts lint:stylelint",
"lint:eslint": "./node_modules/.bin/eslint --cache --cache-strategy content -c .eslintrc.js .",
"lint:eslint:fix": "npm run lint:eslint -- --fix",
"lint:ts": "tsc --noEmit",
"lint:stylelint": "./node_modules/.bin/stylelint --cache --config stylelint.config.js .",
"lint:stylelint:fix": "npm run lint:stylelint -- --fix",
"test": "npm run cypress:start",
"test-ci": "npm run cypress:start-ci",
"test-e2e": "start-server-and-test dev http://localhost:3000 cypress open --e2e",
"cypress:start": "RESPOND_MOCK_RESULT_DELAY=1 cypress open --component",
"cypress:start-ci": "RESPOND_MOCK_RESULT_DELAY=1 cypress run --component --browser chrome",
"storybook": "start-storybook -p 9000 --no-version-updates",
"build-storybook": "build-storybook -c .storybook",
"postinstall": "husky install",
"clean-tsc": "rimraf tmp"
},
"lint-staged": {
"**/*.{vue, ts}": [
"./node_modules/.bin/eslint ./config/linters/eslint-config.js --max-warnings=0"
],
"**/*.ts": [
"bash -c tsc --noEmit"
],
"**/*.scss": [
"./node_modules/.bin/stylelint --config stylelint.config.js"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"post-commit": "clean-tsc"
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
],
"devDependencies": {
"@babel/core": "7.13.15",
"@babel/plugin-transform-runtime": "7.13.15",
"@babel/preset-env": "7.13.15",
"@nuxt/babel-preset-app": "2.15.6",
"@nuxt/types": "2.15.8",
"@nuxt/typescript-build": "2.1.0",
"@nuxtjs/axios": "5.13.6",
"@nuxtjs/dotenv": "1.4.1",
"@storybook/addon-actions": "6.3.8",
"@storybook/addon-links": "6.3.8",
"@storybook/addon-storysource": "6.3.8",
"@storybook/addon-viewport": "6.3.8",
"@storybook/vue": "6.3.8",
"@types/crypto-js": "4.1.0",
"@types/lodash": "4.14.178",
"@types/node": "16.7.8",
"@types/swiper": "5.4.3",
"@types/vuelidate": "0.7.15",
"@types/webpack-env": "1.16.0",
"@typescript-eslint/eslint-plugin": "4.22.1",
"@typescript-eslint/parser": "4.22.1",
"@vue/test-utils": "1.3.0",
"anychart": "8.11.0",
"app-root-path": "3.0.0",
"babel-eslint": "10.1.0",
"babel-loader": "8.2.2",
"crypto-js": "4.1.1",
"css-loader": "5.2.7",
"cypress": "10.10.0",
"cypress-multi-reporters": "1.6.1",
"date-fns": "2.28.0",
"dotenv-flow": "3.2.0",
"element-ui": "2.15.9",
"eslint": "7.25.0",
"eslint-config-airbnb-base": "14.2.1",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-unused-imports": "1.1.5",
"eslint-plugin-vue": "7.9.0",
"eslint-webpack-plugin": "2.5.4",
"flag-icons": "6.0.3",
"fork-ts-checker-webpack-plugin": "6.2.12",
"husky": "8.0.1",
"iso-country-currency": "0.6.0",
"jwt-decode": "3.1.2",
"lint-staged": "10.5.4",
"lodash": "4.17.21",
"lvovich": "2.0.0",
"normalize.css": "8.0.1",
"npm-run-all": "4.1.5",
"nuxt": "2.15.8",
"nuxt-property-decorator": "2.9.1",
"postcss-easy-media-query": "1.0.0",
"postcss-inline-svg": "4.1.0",
"postcss-loader": "3.0.0",
"postcss-scss": "2.1.1",
"resolve-url-loader": "3.1.2",
"rimraf": "3.0.2",
"sass": "1.32.13",
"sass-loader": "10.2.0",
"start-server-and-test": "1.14.0",
"storybook-addon-designs": "6.1.0",
"storybook-vue-router": "1.0.7",
"style-loader": "1.2.1",
"stylelint": "13.13.1",
"stylelint-config-rational-order": "0.1.2",
"stylelint-config-standard": "22.0.0",
"stylelint-order": "4.1.0",
"stylelint-webpack-plugin": "2.1.1",
"swiper": "5.3.8",
"ts-loader": "8.2.0",
"ts-node": "10.2.1",
"typescript": "3.9.9",
"uuid": "8.3.2",
"vue": "2.6.14",
"vue-awesome-swiper": "4.1.1",
"vue-bem-cn": "1.1.1",
"vue-click-outside": "1.1.0",
"vue-eslint-parser": "7.6.0",
"vue-inline-svg": "2.1.0",
"vue-inputmask": "0.2.1",
"vue-loader": "15.9.3",
"vue-popperjs": "2.3.0",
"vue-property-decorator": "9.1.2",
"vue2-datepicker": "3.10.4",
"vuelidate": "0.7.6",
"vuex": "3.6.2",
"vuex-module-decorators": "1.2.0",
"vuex-persistedstate": "3.2.1",
"webpack": "4.46.0",
"webpack-dev-server": "3.11.2"
},
"resolutions": {
"@babel/core": "7.13.15",
"@babel/preset-env": "7.13.15"
},
"packageManager": "yarn@2.4.2"
gitlab阶段输出:
Running with gitlab-runner 14.9.1 (bd40e3da)
on Runner1 cEWYset_
Preparing the "docker" executor
Using Docker executor with image node:16 ...
Pulling docker image node:16 ...
Using docker image sha256:147af8719073e2afc51f6c60792867b0329ef40b2e76dbf6dedd9afc85b510f3 for node:16 with digest node@sha256:6d592fdb89fccdeb880d14f30bf139b8a755f33b376f025b70e50ac5547c8ccf ...
Preparing environment
Running on runner-cewyset-project-17-concurrent-0 via runner1...
Getting source from Git repository
Fetching changes with git depth set to 1...
Initialized empty Git repository in /builds/my_project/.git/
Created fresh repository.
Checking out ce13aedf as issue/NBOM-682...
Skipping Git submodules setup
Executing "step_script" stage of the job script
Using docker image sha256:147af8719073e2afc51f6c60792867b0329ef40b2e76dbf6dedd9afc85b510f3 for node:16 with digest node@sha256:6d592fdb89fccdeb880d14f30bf139b8a755f33b376f025b70e50ac5547c8ccf ...
$ yarn install --immutable --immutable-cache --skip-builds
⤠YN0000: â Resolution step
Resolution step
00:00
⤠YN0002: â @nuxt/types@npm:2.15.8 doesn't provide webpack (p1a032), requested by sass-loader
⤠YN0002: â @nuxt/typescript-build@npm:2.1.0 [7e7d0] doesn't provide webpack (p59f68), requested by fork-ts-checker-webpack-plugin
⤠YN0002: â @nuxt/typescript-build@npm:2.1.0 [7e7d0] doesn't provide webpack (pc05f7), requested by ts-loader
⤠YN0002: â @storybook/core@npm:6.3.8 [2e4c8] doesn't provide webpack (p4aa58), requested by @storybook/core-client
⤠YN0002: â @storybook/csf-tools@npm:6.3.8 doesn't provide @babel/core (p4793d), requested by @babel/plugin-transform-react-jsx
⤠YN0002: â @storybook/csf-tools@npm:6.3.8 doesn't provide @babel/core (p197f9), requested by @babel/preset-env
⤠YN0002: â @storybook/vue@npm:6.3.8 [7e7d0] doesn't provide typescript (p6db5c), requested by ts-loader
⤠YN0060: â aplgo-backoffice@workspace:. provides @storybook/addon-actions (p35c9b) with version 6.3.8, which doesn't satisfy what storybook-vue-router requests
⤠YN0002: â aplgo-backoffice@workspace:. doesn't provide @storybook/addons (p8488a), requested by storybook-vue-router
⤠YN0002: â aplgo-backoffice@workspace:. doesn't provide mocha (pdf97f), requested by cypress-multi-reporters
⤠YN0002: â aplgo-backoffice@workspace:. doesn't provide vue-class-component (p9513b), requested by vue-property-decorator
⤠YN0002: â aplgo-backoffice@workspace:. doesn't provide vue-router (p4a39c), requested by storybook-vue-router
⤠YN0002: â aplgo-backoffice@workspace:. doesn't provide vue-template-compiler (pb9003), requested by @storybook/vue
⤠YN0002: â aplgo-backoffice@workspace:. doesn't provide vue-template-compiler (pb2b16), requested by @vue/test-utils
⤠YN0002: â nuxt-property-decorator@npm:2.9.1 doesn't provide vue (pbab38), requested by vue-class-component
⤠YN0002: â nuxt-property-decorator@npm:2.9.1 doesn't provide vue (p28c57), requested by vue-property-decorator
⤠YN0002: â nuxt-property-decorator@npm:2.9.1 doesn't provide vue (pfcb4b), requested by vuex-class
⤠YN0002: â nuxt-property-decorator@npm:2.9.1 doesn't provide vue (p81681), requested by vuex-module-decorators
⤠YN0002: â nuxt-property-decorator@npm:2.9.1 doesn't provide vuex (p77ea5), requested by vuex-class
⤠YN0002: â nuxt-property-decorator@npm:2.9.1 doesn't provide vuex (p14b0f), requested by vuex-module-decorators
⤠YN0002: â nuxt@npm:2.15.8 doesn't provide consola (p2d844), requested by @nuxt/components
⤠YN0002: â react-dev-utils@npm:11.0.4 doesn't provide typescript (p79ddf), requested by fork-ts-checker-webpack-plugin
⤠YN0002: â react-dev-utils@npm:11.0.4 doesn't provide webpack (p2af19), requested by fork-ts-checker-webpack-plugin
⤠YN0002: â storybook-addon-designs@npm:6.1.0 doesn't provide react (p0b861), requested by @figspec/react
⤠YN0000: â Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
⤠YN0000: â Completed in 0s 497ms
⤠YN0000: â Fetch step
Fetch step
00:01
⤠YN0013: â 2162 packages were already cached
⤠YN0000: â Completed in 1s 220ms
⤠YN0000: â Link step
Link step
⤠YN0062: â fsevents@patch:fsevents@npm%3A2.3.2#builtin<compat/fsevents>::version=2.3.2&hash=11e9ea The platform linux is incompatible with this module, link skipped.
⤠YN0062: â fsevents@patch:fsevents@npm%3A1.2.13#builtin<compat/fsevents>::version=1.2.13&hash=11e9ea The platform linux is incompatible with this module, link skipped.
⤠YN0006: â aplgo-backoffice@workspace:. lists build scripts, but is referenced through a soft link. Soft links don't support build scripts, so they'll be ignored.
⤠YN0000: â Completed in 33s 176ms
⤠YN0000: Done with warnings in 35s 508ms
$ DEBUG=eslint:cli-engine yarn lint:eslint
2022-10-21T05:51:57.876Z eslint:cli-engine Lint /builds/aplgo/my-project/accordion-block/index.ts
...
gitlab lint.yml
我希望
--cache-strategy content
在CI中git克隆后将正常工作。也许我错过了smth?