Can't use bpmnlint

When I try to introduce bpmnlint into my project, I always report the following error

Module parse failed: D:\workspace\bpmn-project\node_modules\bpmnlint\lib\linter.js Unexpected token (62:8)
You may need an appropriate loader to handle this file type.
|     return reports.map(function(report) {
|       return {
|         ...report,
|         category
|       };

No matter which version of bpmnlint I use, I always report this error,This is a vue project, the complete dependencies are as follows

"dependencies": {
    "bpmn-js": "^6.4.2",
    "bpmn-js-bpmnlint": "^0.13.0",
    "bpmn-js-properties-panel": "^0.33.2",
    "bpmnlint": "^6.2.0",
    "bpmnlint-loader": "^0.1.4",
    "diagram-js-minimap": "^2.0.3",
    "es6-promise": "^4.2.8",
    "vue": "^2.5.2",
    "vue-router": "^3.0.1",
    "vuedraggable": "^2.23.2"
  },
  "devDependencies": {
    "autoprefixer": "^7.1.2",
    "babel-core": "^6.22.1",
    "babel-eslint": "^8.2.1",
    "babel-helper-vue-jsx-merge-props": "^2.0.3",
    "babel-loader": "^7.1.1",
    "babel-plugin-syntax-jsx": "^6.18.0",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-plugin-transform-vue-jsx": "^3.5.0",
    "babel-preset-env": "^1.3.2",
    "babel-preset-stage-2": "^6.22.0",
    "chalk": "^2.0.1",
    "copy-webpack-plugin": "^4.0.1",
    "css-loader": "^0.28.0",
    "eslint": "^4.15.0",
    "eslint-config-standard": "^10.2.1",
    "eslint-friendly-formatter": "^3.0.0",
    "eslint-loader": "^1.7.1",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-node": "^5.2.0",
    "eslint-plugin-promise": "^3.4.0",
    "eslint-plugin-standard": "^3.0.1",
    "eslint-plugin-vue": "^4.0.0",
    "extract-text-webpack-plugin": "^3.0.0",
    "file-loader": "^1.1.4",
    "friendly-errors-webpack-plugin": "^1.6.1",
    "html-webpack-plugin": "^2.30.1",
    "node-notifier": "^5.1.2",
    "optimize-css-assets-webpack-plugin": "^3.2.0",
    "ora": "^1.2.0",
    "portfinder": "^1.0.13",
    "postcss-import": "^11.0.0",
    "postcss-loader": "^2.0.8",
    "postcss-url": "^7.2.1",
    "rimraf": "^2.6.0",
    "semver": "^5.3.0",
    "shelljs": "^0.7.6",
    "uglifyjs-webpack-plugin": "^1.1.1",
    "url-loader": "^0.5.8",
    "vue-loader": "^13.3.0",
    "vue-style-loader": "^3.0.1",
    "vue-template-compiler": "^2.5.2",
    "webpack": "^3.6.0",
    "webpack-bundle-analyzer": "^2.9.0",
    "webpack-dev-server": "^2.9.1",
    "webpack-merge": "^4.1.0"
  }

It’s hard to tell you what’s wrong with your setup without knowing your setup. If I would guess I would say that you forgot to properly include the bpmnlint-loader.

We’d really appreciate it if you could share your full project setup inside a CodeSandbox. Especially your webpack.config.js would be interesting to see.

1 Like

Thank you, but it doesn’t seem to be the reason. When I used the .bpmnlintrc file before, the configuration of webpack.base.conf.js was as follows

module: {
    rules: [
      ...(config.dev.useEslint ? [createLintingRule()] : []),
      {
        test: /\.vue$/,
        loader: 'vue-loader',
        options: vueLoaderConfig
      },
      {
        test: /\.js$/,
        loader: 'babel-loader',
        include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
      },
      {
        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: utils.assetsPath('img/[name].[hash:7].[ext]')
        }
      },
      {
        test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: utils.assetsPath('media/[name].[hash:7].[ext]')
        }
      },
      {
        test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
        }
      },
      {
        test: /\.bpmnlintrc$/,
        use: {
          loader: 'bpmnlint-loader'
        }
      }
    ]
  }

Later, I used bpmnlint-pack-config to generate packed-config.js, but it still got the same error. I suspect this error is caused by the wrong version of webpack

Is it the problem of ES6 (…)?????

1 Like

Not sure, but es6 code can be written in my project

For further assistance, please share a CodeSandbox that reproduces your issue in a way that we can inspect it.