I had an error in my pipeline in GitLab. I changed the settings in .eslint.json using information from StackOverflow. But I still have problem.
My .eslint.json looks like:
{
  "extends": "eslint:recommended",
  "rules": {
    "semi": ["warn", "never"],
    "quotes": ["warn", "single"],
    "no-console": ["off"]
  },
  "parserOptions": {
    "ecmaVersion": 9
  },
  "env": {
    "es6": true,
    "node": true,
    "browser": true,
    "amd": true
  },
  "globals": {
    "$": true,
    "require": true
    "process": true
  },
  "root": true
}
In env I added "adm": true and in globals I added "process": true and "require": true. 
The errors are:
error 'require' is not defined no-undef
error 'process' is not defined no-undef
The file where is the errors are looks like this:
const qs = require("querystring");
const coEndpoint =
    process.env.NODE_ENV == "production"
So where is the problem? Is this a problem with env node? How can I fixed this?
It happens when you declare your package type as module in your package. json . If you do this, certain CommonJS variables can't be used, including require . To fix this, remove "type": "module" from your package.
To specify environments in a configuration file, use the env key and specify which environments you want to enable by setting each to true. For example, the following enables the browser, es6 and Node.js environments:
In your .eslintrc.js file ;
...
env: {
   browser: true,
   node: true,    <<<<--- Add this
   es6: true
 },
...
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With