From c783168841d89ab4d39b6a43fc4e2b4fda90686f Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Wed, 9 Nov 2022 14:32:10 +0100 Subject: [PATCH] feat: add bpmnlint recommended rules built-in --- client/package.json | 1 + client/src/index.js | 2 ++ .../bpmnlint-recommended-rules/.bpmnlintrc | 22 +++++++++++++++++++ .../bpmnlint-recommended-rules/index.js | 18 +++++++++++++++ client/webpack.config.js | 4 ++++ package-lock.json | 14 +++++++++++- 6 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 client/src/plugins/linting/bpmnlint-recommended-rules/.bpmnlintrc create mode 100644 client/src/plugins/linting/bpmnlint-recommended-rules/index.js diff --git a/client/package.json b/client/package.json index a447db1784..668d30e529 100644 --- a/client/package.json +++ b/client/package.json @@ -33,6 +33,7 @@ "camunda-cmmn-moddle": "^1.0.0", "camunda-dmn-js": "^0.7.0", "camunda-dmn-moddle": "^1.1.0", + "camunda-modeler-plugin-helpers": "^5.1.0", "canvg-browser": "^1.0.0", "classnames": "^2.2.6", "cmmn-js": "^0.20.0", diff --git a/client/src/index.js b/client/src/index.js index 0d770c5488..07d386dc7f 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -10,6 +10,8 @@ import './styles/style.less'; +import './plugins/linting/bpmnlint-recommended-rules'; + import { backend, config, diff --git a/client/src/plugins/linting/bpmnlint-recommended-rules/.bpmnlintrc b/client/src/plugins/linting/bpmnlint-recommended-rules/.bpmnlintrc new file mode 100644 index 0000000000..1dd97c0bd0 --- /dev/null +++ b/client/src/plugins/linting/bpmnlint-recommended-rules/.bpmnlintrc @@ -0,0 +1,22 @@ +{ + "extends": "bpmnlint:recommended", + "rules": { + "conditional-flows": "warn", + "end-event-required": "warn", + "event-sub-process-typed-start-event": "warn", + "fake-join": "warn", + "label-required": "warn", + "no-bpmndi": "warn", + "no-complex-gateway": "warn", + "no-disconnected": "warn", + "no-duplicate-sequence-flows": "warn", + "no-gateway-join-fork": "warn", + "no-implicit-split": "warn", + "no-inclusive-gateway": "warn", + "single-blank-start-event": "warn", + "single-event-definition": "warn", + "start-event-required": "warn", + "sub-process-blank-start-event": "warn", + "superfluous-gateway": "warn" + } +} diff --git a/client/src/plugins/linting/bpmnlint-recommended-rules/index.js b/client/src/plugins/linting/bpmnlint-recommended-rules/index.js new file mode 100644 index 0000000000..e5d9677204 --- /dev/null +++ b/client/src/plugins/linting/bpmnlint-recommended-rules/index.js @@ -0,0 +1,18 @@ +/** + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. + * + * Camunda licenses this file to you under the MIT; you may not use this file + * except in compliance with the MIT License. + */ + +import { + registerClientPlugin +} from 'camunda-modeler-plugin-helpers'; + +import recommendedRules from './.bpmnlintrc'; + +registerClientPlugin(recommendedRules, 'lintRules.bpmn'); +registerClientPlugin(recommendedRules, 'lintRules.cloud-bpmn'); diff --git a/client/webpack.config.js b/client/webpack.config.js index af9ca2e229..1d1138438a 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -65,6 +65,10 @@ module.exports = { }, module: { rules: [ + { + test: /\.bpmnlintrc$/i, + use: 'bpmnlint-loader', + }, { test: /\.js$/, exclude: /node_modules/, diff --git a/package-lock.json b/package-lock.json index 07486bb188..f8db09e9b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -411,6 +411,7 @@ "camunda-cmmn-moddle": "^1.0.0", "camunda-dmn-js": "^0.7.0", "camunda-dmn-moddle": "^1.1.0", + "camunda-modeler-plugin-helpers": "^5.1.0", "canvg-browser": "^1.0.0", "classnames": "^2.2.6", "cmmn-js": "^0.20.0", @@ -10047,6 +10048,11 @@ "resolved": "client", "link": true }, + "node_modules/camunda-modeler-plugin-helpers": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/camunda-modeler-plugin-helpers/-/camunda-modeler-plugin-helpers-5.1.0.tgz", + "integrity": "sha512-QwUMNUBWDQlWtOY76sFEsG26IpVt9Xo+Vyg/NiFi22/5KfiKgxqS93LeJ/BsM2cq00setWM3QSzILyQieyNyTQ==" + }, "node_modules/caniuse-lite": { "version": "1.0.30001384", "dev": true, @@ -30552,7 +30558,7 @@ "@camunda/execution-platform": "^0.3.2", "@camunda/form-linting": "^0.1.2", "@camunda/form-playground": "^0.2.0", - "@camunda/linting": "0.9.1", + "@camunda/linting": "^0.9.1", "@codemirror/commands": "^6.1.0", "@codemirror/lang-json": "^6.0.0", "@codemirror/lang-xml": "^6.0.0", @@ -30573,6 +30579,7 @@ "camunda-cmmn-moddle": "^1.0.0", "camunda-dmn-js": "^0.7.0", "camunda-dmn-moddle": "^1.1.0", + "camunda-modeler-plugin-helpers": "^5.1.0", "canvg-browser": "^1.0.0", "case-sensitive-paths-webpack-plugin": "^2.1.2", "chai": "^4.2.0", @@ -33345,6 +33352,11 @@ } } }, + "camunda-modeler-plugin-helpers": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/camunda-modeler-plugin-helpers/-/camunda-modeler-plugin-helpers-5.1.0.tgz", + "integrity": "sha512-QwUMNUBWDQlWtOY76sFEsG26IpVt9Xo+Vyg/NiFi22/5KfiKgxqS93LeJ/BsM2cq00setWM3QSzILyQieyNyTQ==" + }, "caniuse-lite": { "version": "1.0.30001384", "dev": true