Repository: bpmn-io/bpmnlint
Pull request #102 (2023-03-24 15:18:15)

feat: support `info` type
Adds `info` type requested by various parties.


Patch:
diff --git a/lib/linter.js b/lib/linter.js
index 2fdb883..105413b 100644
--- a/lib/linter.js
+++ b/lib/linter.js
@@ -3,7 +3,8 @@ const testRule = require('./test-rule');
 const categoryMap = {
   0: 'off',
   1: 'warn',
-  2: 'error'
+  2: 'error',
+  3: 'info'
 };
 
 


Test patch:
diff --git a/test/spec/linter-spec.js b/test/spec/linter-spec.js
index 168b177..9502605 100644
--- a/test/spec/linter-spec.js
+++ b/test/spec/linter-spec.js
@@ -220,7 +220,7 @@ describe('linter', function() {
       });
 
 
-      it('should resolve and configure', async function() {
+      describe('should resolve and configure', function() {
 
         // given
         const resolver = {
@@ -233,19 +233,26 @@ describe('linter', function() {
           }
         };
 
-        const linter = new Linter({ resolver });
+        [ 'warn', 'error', 'info' ].forEach(category => {
 
-        // when
-        const lintResults = await linter.lint(moddleRoot, {
-          rules: {
-            testRule: [ 'error', { message: 'foo' } ]
-          }
-        });
+          it(category, async function() {
 
-        // then
-        expect(lintResults).to.eql({
-          testRule: buildFakeResults('error', 'foo')
+            const linter = new Linter({ resolver });
+
+            // when
+            const lintResults = await linter.lint(moddleRoot, {
+              rules: {
+                testRule: [ category, { message: 'foo' } ]
+              }
+            });
+
+            // then
+            expect(lintResults).to.eql({
+              testRule: buildFakeResults(category, 'foo')
+            });
+          });
         });
+
       });
 
 
@@ -362,6 +369,11 @@ describe('linter', function() {
         config: {}
       });
 
+      expect(linter.parseRuleValue(3)).to.eql({
+        category: 'info',
+        config: {}
+      });
+
     });
 
   });
@@ -440,7 +452,7 @@ describe('linter', function() {
                   extends: 'plugin:test/base',
                   rules: {
                     'test/bar': 'warn',
-                    'other': 'warn'
+                    'other': 'info'
                   }
                 };
               }
@@ -482,7 +494,7 @@ describe('linter', function() {
             'bar': 'error',
             'foo': 'warn',
             'test/bar': 'warn',
-            'test/other': 'warn'
+            'test/other': 'info'
           });
         });
 
@@ -512,7 +524,7 @@ describe('linter', function() {
             'bar': 'error',
             'foo': 'error',
             'test/bar': 'off',
-            'test/other': 'warn'
+            'test/other': 'info'
           });
         });
 
diff --git a/test/spec/support/compile-config-spec.js b/test/spec/support/compile-config-spec.js
index 3b5d440..338fb0a 100644
--- a/test/spec/support/compile-config-spec.js
+++ b/test/spec/support/compile-config-spec.js
@@ -13,7 +13,10 @@ describe('support/compile-config', function() {
     const code = await compileConfig({
       rules: {
         'conditional-flows': 'error',
-        'single-blank-start-event': 'off'
+        'single-blank-start-event': 'off',
+        'end-event-required': 'info',
+        'no-bpmndi': 1,
+        'no-implicit-split': 'warn'
       }
     });
 
@@ -22,13 +25,25 @@ describe('support/compile-config', function() {
     expect(code).to.contain('import rule_0 from \'bpmnlint/rules/conditional-flows\'');
     expect(code).to.contain('cache[\'bpmnlint/conditional-flows\'] = rule_0');
 
+    expect(code).to.contain('import rule_2 from \'bpmnlint/rules/end-event-required\'');
+    expect(code).to.contain('cache[\'bpmnlint/end-event-required\'] = rule_2');
+
+    expect(code).to.contain('import rule_3 from \'bpmnlint/rules/no-bpmndi\'');
+    expect(code).to.contain('cache[\'bpmnlint/no-bpmndi\'] = rule_3');
+
+    expect(code).to.contain('import rule_4 from \'bpmnlint/rules/no-implicit-split\'');
+    expect(code).to.contain('cache[\'bpmnlint/no-implicit-split\'] = rule_4');
+
     // does not import disabled rule
     expect(code).not.to.contain('cache[\'bpmnlint/single-blank-start-event\']');
     expect(code).not.to.contain('bpmnlint/rules/single-blank-start-event');
 
-    // configures both rules regardless
+    // configures all rules
     expect(code).to.contain('"conditional-flows": "error"');
     expect(code).to.contain('"single-blank-start-event": 0');
+    expect(code).to.contain('"end-event-required": "info"');
+    expect(code).to.contain('"no-bpmndi": 1');
+    expect(code).to.contain('"no-implicit-split": "warn"');
 
     // exports config and resolver
     expect(code).to.contain('export { resolver, config };');