I am trying to run a simple jhipster api gateway and I am having some trouble with typescript eslint.
I have looked around stackoverflow but all the solutions suggested weren't useful to my case. I am getting the following error as I am trying to build with maven.
[INFO] Error: Failed to load plugin '@typescript-eslint' declared in '../.eslintrc.json': Cannot find module '@typescript-eslint/eslint-plugin' [INFO] Require stack: [INFO] - /Users/user/placeholder.js [INFO] Referenced from: /Users/user/.eslintrc.json [INFO] [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 34.069 s [INFO] Finished at: 2021-05-05T22:27:18+02:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.11.3:npm (webapp build dev) on project jhipster: Failed to run task: 'npm run webapp:build' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
As mentioned in the :
https://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Seems like maven is failing because because an issue caused by some npm build process.
I have tried to install eslint separately as advised in other stack over flow questions but it was not helpful.
my package.json and .eslintrc.json are automatically generated from the jhipster framework.
package.json looks like this:
{
"name": "jhipster",
"version": "0.0.1-SNAPSHOT",
"private": true,
"description": "Description for jhipster",
"license": "UNLICENSED",
"scripts": {
"prettier:check": "prettier --check \"{,src/**/,webpack/}*.{md,json,yml,html,js,ts,tsx,css,scss,java}\"",
"prettier:format": "prettier --write \"{,src/**/,webpack/}*.{md,json,yml,html,js,ts,tsx,css,scss,java}\"",
"lint": "eslint . --ext .js,.ts",
"lint:fix": "npm run lint -- --fix",
"cleanup": "rimraf target/classes/static/",
"clean-www": "rimraf target/classes/static/app/{src,target/}",
"jest": "jest --coverage --logHeapUsage --maxWorkers=2 --config jest.conf.js",
"start": "ng serve --hmr",
"start-tls": "npm run webapp:dev -- --env.tls",
"serve": "npm run start",
"build": "npm run webapp:prod",
"pretest": "npm run lint",
"test": "ng test --coverage --log-heap-usage -w=2",
"test:watch": "npm run test -- --watch",
"watch": "concurrently npm:start npm:backend:start",
"webapp:build": "npm run clean-www && npm run webapp:build:dev",
"webapp:build:dev": "ng build",
"webapp:build:prod": "ng build --prod",
"webapp:dev": "ng serve",
"webapp:dev-verbose": "ng serve --verbose",
"webapp:prod": "npm run clean-www && npm run webapp:build:prod",
"webapp:test": "npm run test",
"docker:db:up": "docker-compose -f src/main/docker/postgresql.yml up -d",
"docker:db:down": "docker-compose -f src/main/docker/postgresql.yml down -v --remove-orphans",
"docker:others:await": "",
"predocker:others:up": "",
"docker:others:up": "",
"docker:others:down": "",
"ci:e2e:prepare:docker": "npm run docker:db:up && npm run docker:others:up && docker ps -a",
"ci:e2e:prepare": "npm run ci:e2e:prepare:docker",
"ci:e2e:teardown:docker": "npm run docker:db:down --if-present && npm run docker:others:down && docker ps -a",
"ci:e2e:teardown": "npm run ci:e2e:teardown:docker",
"backend:info": "./mvnw -ntp enforcer:display-info --batch-mode",
"backend:doc:test": "./mvnw -ntp javadoc:javadoc --batch-mode",
"backend:nohttp:test": "./mvnw -ntp checkstyle:check --batch-mode",
"backend:start": "./mvnw -P-webapp",
"java:jar": "./mvnw -ntp verify -DskipTests --batch-mode",
"java:war": "./mvnw -ntp verify -DskipTests --batch-mode -Pwar",
"java:docker": "./mvnw -ntp verify -DskipTests jib:dockerBuild",
"backend:unit:test": "./mvnw -ntp -P-webapp verify --batch-mode -Dlogging.level.ROOT=OFF -Dlogging.level.org.zalando=OFF -Dlogging.level.tech.jhipster=OFF -Dlogging.level.com.mycompany.myapp=OFF -Dlogging.level.org.springframework=OFF -Dlogging.level.org.springframework.web=OFF -Dlogging.level.org.springframework.security=OFF",
"java:jar:dev": "npm run java:jar -- -Pdev,webapp",
"java:jar:prod": "npm run java:jar -- -Pprod",
"java:war:dev": "npm run java:war -- -Pdev,webapp",
"java:war:prod": "npm run java:war -- -Pprod",
"java:docker:dev": "npm run java:docker -- -Pdev,webapp",
"java:docker:prod": "npm run java:docker -- -Pprod",
"ci:backend:test": "npm run backend:info && npm run backend:doc:test && npm run backend:nohttp:test && npm run backend:unit:test",
"ci:server:package": "npm run java:$npm_package_config_packaging:$npm_package_config_default_environment",
"ci:e2e:package": "npm run java:$npm_package_config_packaging:$npm_package_config_default_environment -- -Pe2e -Denforcer.skip=true",
"preci:e2e:server:start": "npm run docker:db:await --if-present && npm run docker:others:await --if-present",
"ci:e2e:server:start": "java -jar target/e2e.$npm_package_config_packaging --spring.profiles.active=$npm_package_config_default_environment -Dlogging.level.ROOT=OFF -Dlogging.level.org.zalando=OFF -Dlogging.level.tech.jhipster=OFF -Dlogging.level.com.mycompany.myapp=OFF -Dlogging.level.org.springframework=OFF -Dlogging.level.org.springframework.web=OFF -Dlogging.level.org.springframework.security=OFF --logging.level.org.springframework.web=ERROR",
"ci:frontend:build": "npm run webapp:build:$npm_package_config_default_environment",
"ci:frontend:test": "npm run ci:frontend:build && npm test"
},
"config": {
"backend_port": "8080",
"default_environment": "prod",
"packaging": "jar"
},
"dependencies": {
"@angular/common": "11.2.7",
"@angular/compiler": "11.2.7",
"@angular/core": "11.2.7",
"@angular/forms": "11.2.7",
"@angular/localize": "11.2.7",
"@angular/platform-browser": "11.2.7",
"@angular/platform-browser-dynamic": "11.2.7",
"@angular/router": "11.2.7",
"@fortawesome/angular-fontawesome": "0.8.2",
"@fortawesome/fontawesome-svg-core": "1.2.35",
"@fortawesome/free-solid-svg-icons": "5.15.3",
"@ng-bootstrap/ng-bootstrap": "9.1.0",
"bootstrap": "4.6.0",
"dayjs": "1.10.4",
"ngx-infinite-scroll": "10.0.1",
"ngx-webstorage": "7.0.1",
"npm": "^7.11.2",
"rxjs": "6.6.7",
"swagger-ui-dist": "3.46.0",
"tslib": "2.1.0",
"zone.js": "0.11.3"
},
"devDependencies": {
"@angular-builders/custom-webpack": "11.1.1",
"@angular-builders/jest": "11.1.1",
"@angular-eslint/eslint-plugin": "2.0.2",
"@angular/cli": "11.2.6",
"@angular/compiler-cli": "11.2.7",
"@angular/service-worker": "11.2.7",
"@types/jest": "26.0.22",
"@types/node": "14.14.37",
"@typescript-eslint/eslint-plugin": "^4.22.1",
"@typescript-eslint/parser": "4.20.0",
"browser-sync": "2.26.14",
"browser-sync-webpack-plugin": "2.3.0",
"concurrently": "6.0.0",
"copy-webpack-plugin": "6.4.1",
"eslint": "7.23.0",
"eslint-config-prettier": "8.1.0",
"eslint-webpack-plugin": "2.5.3",
"friendly-errors-webpack-plugin": "1.7.0",
"generator-jhipster": "7.0.1",
"husky": "4.3.8",
"jest": "26.6.3",
"jest-date-mock": "1.0.8",
"jest-junit": "12.0.0",
"jest-sonar-reporter": "2.0.0",
"lint-staged": "10.5.4",
"prettier": "2.2.1",
"prettier-plugin-java": "1.0.2",
"prettier-plugin-packagejson": "2.2.10",
"rimraf": "3.0.2",
"simple-progress-webpack-plugin": "1.1.2",
"typescript": "4.1.5",
"wait-on": "5.3.0",
"webpack": "4.46.0",
"webpack-bundle-analyzer": "4.4.0",
"webpack-merge": "5.7.3",
"webpack-notifier": "1.13.0"
},
"engines": {
"node": ">=14.16.0"
},
"cacheDirectories": [
"node_modules"
],
"jestSonar": {
"reportPath": "target/test-results/jest",
"reportFile": "TESTS-results-sonar.xml"
}
}
and my eslintrc.json looks like this:
{
"parser": "@typescript-eslint/parser",
"plugins": ["@angular-eslint/eslint-plugin", "@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@angular-eslint/recommended",
"prettier",
"eslint-config-prettier"
],
"env": {
"browser": true,
"es6": true,
"commonjs": true
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "jhi",
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "jhi",
"style": "camelCase"
}
],
"@angular-eslint/relative-url-prefix": "error",
"@typescript-eslint/ban-types": [
"error",
{
"extendDefaults": true,
"types": {
"{}": false
}
}
],
"@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/member-ordering": [
"error",
{
"default": [
"public-static-field",
"protected-static-field",
"private-static-field",
"public-instance-field",
"protected-instance-field",
"private-instance-field",
"constructor",
"public-static-method",
"protected-static-method",
"private-static-method",
"public-instance-method",
"protected-instance-method",
"private-instance-method"
]
}
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-parameter-properties": ["warn", { "allows": ["public", "private", "protected"] }],
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"@typescript-eslint/unbound-method": "off",
"arrow-body-style": "error",
"curly": "error",
"eqeqeq": ["error", "always", { "null": "ignore" }],
"guard-for-in": "error",
"no-bitwise": "error",
"no-caller": "error",
"no-console": ["error", { "allow": ["warn", "error"] }],
"no-eval": "error",
"no-labels": "error",
"no-new": "error",
"no-new-wrappers": "error",
"object-shorthand": ["error", "always", { "avoidExplicitReturnArrows": true }],
"radix": "error",
"spaced-comment": ["warn", "always"]
}
}
any idea on what can I do to sort this?