I'm trying to setup a gitlab CI/CD with a linux runner. I'm running into some problems, first it couldn't find eslint as a command, after globally installing it it worked for some reason, but now I'm running into the problem that globals cannot be found. Can anyone help me with this issue? Here is my eslint.config.mjs
:
import globals from "globals";
import pluginJs from "@eslint/js";
import stylisticJs from '@stylistic/eslint-plugin-js'
/** @type {import('eslint').Linter.Config[]} */
export default [
{
files: ["src/**/*.js"],
ignores: [
"src/database/**/*"
],
languageOptions: {
globals: {
...globals.node
}
},
rules: {
"prefer-const": "warn",
"no-constant-binary-expression": "error",
"camelcase": "error",
"@stylistic/js/indent": ["error", 2],
"@stylistic/js/object-curly-spacing": ["error", "never"],
"@stylistic/js/quotes": ["error", "double"],
"no-console": "off"
},
plugins: {'@stylistic/js': stylisticJs}
},
];
And here is my gitlab-ci.yml file:
image: node:latest
stages:
- install
- lint
- build
variables:
NODE_ENV: production
install:
stage: install
script:
- cd server
- npm ci
artifacts:
paths:
- server/node_modules/
eslint:
stage: lint
before_script:
- cd server
- npm ci
script:
- npm i -g eslint
- npm i -g globals
- npm run lint
allow_failure: false
build:
stage: build
script:
- cd server
- npm ci
- npm run build
dependencies:
- install
artifacts:
paths:
- server/dist/
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
when: always
I dont know what to do right now. If you need any logs just ask me.
After adding artifacts to the lint step:
artifacts:
paths:
- server/node_modules/
the issues where resolved. I guess it has something to do with the server not finding what node_modules
directory to use? I'm unsure I'm not a expert at gitlab CI/CD