From 4390039e953f82342f754db7533a9f58235233b4 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Tue, 15 Oct 2024 16:32:02 +0200 Subject: [PATCH 1/4] style: whitelist constant expression --- packages/dmn-js-decision-table/test/spec/ViewerSpec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/dmn-js-decision-table/test/spec/ViewerSpec.js b/packages/dmn-js-decision-table/test/spec/ViewerSpec.js index a91620818..8106a0d50 100644 --- a/packages/dmn-js-decision-table/test/spec/ViewerSpec.js +++ b/packages/dmn-js-decision-table/test/spec/ViewerSpec.js @@ -30,6 +30,7 @@ describe('DecisionTable', function() { let dmnJS; + // eslint-disable-next-line no-constant-binary-expression false && afterEach(function() { if (dmnJS) { dmnJS.destroy(); From 109b3e438f1967ed65a05d289115dc2a5824bae4 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Tue, 15 Oct 2024 16:32:26 +0200 Subject: [PATCH 2/4] style: adjust code style (apply eslint --fix) --- .../features/context-menu/ContextMenuCloseBehaviorSpec.js | 3 --- .../spec/features/context-menu/ContextMenuKeyboardSpec.js | 3 --- .../test/spec/features/context-menu/ContextMenuSpec.js | 3 --- .../test/spec/features/drag-and-drop/DragAndDropSpec.js | 3 --- .../spec/features/simple-date-edit/SimpleDateEditSpec.js | 6 +++--- .../test/spec/features/simple-date-edit/UtilsSpec.js | 2 +- .../simple-date-time-edit/SimpleDateTimeEditSpec.js | 2 +- .../spec/features/simple-time-edit/SimpleTimeEditSpec.js | 6 +++--- .../test/spec/features/simple-time-edit/UtilsSpec.js | 2 +- .../test/spec/components/ValidatedInputSpec.js | 2 +- 10 files changed, 10 insertions(+), 22 deletions(-) diff --git a/packages/dmn-js-decision-table/test/spec/features/context-menu/ContextMenuCloseBehaviorSpec.js b/packages/dmn-js-decision-table/test/spec/features/context-menu/ContextMenuCloseBehaviorSpec.js index 450b984a6..c4b846553 100644 --- a/packages/dmn-js-decision-table/test/spec/features/context-menu/ContextMenuCloseBehaviorSpec.js +++ b/packages/dmn-js-decision-table/test/spec/features/context-menu/ContextMenuCloseBehaviorSpec.js @@ -1,6 +1,3 @@ - -import Inferno from 'inferno'; - import { bootstrapModeler, inject } from 'test/helper'; import { diff --git a/packages/dmn-js-decision-table/test/spec/features/context-menu/ContextMenuKeyboardSpec.js b/packages/dmn-js-decision-table/test/spec/features/context-menu/ContextMenuKeyboardSpec.js index 8408697c1..aa39fec37 100644 --- a/packages/dmn-js-decision-table/test/spec/features/context-menu/ContextMenuKeyboardSpec.js +++ b/packages/dmn-js-decision-table/test/spec/features/context-menu/ContextMenuKeyboardSpec.js @@ -1,6 +1,3 @@ - -import Inferno from 'inferno'; - import { bootstrapModeler, inject } from 'test/helper'; import { diff --git a/packages/dmn-js-decision-table/test/spec/features/context-menu/ContextMenuSpec.js b/packages/dmn-js-decision-table/test/spec/features/context-menu/ContextMenuSpec.js index f80b5d3f1..8e1117c34 100644 --- a/packages/dmn-js-decision-table/test/spec/features/context-menu/ContextMenuSpec.js +++ b/packages/dmn-js-decision-table/test/spec/features/context-menu/ContextMenuSpec.js @@ -1,6 +1,3 @@ - -import Inferno from 'inferno'; - import { bootstrapModeler, inject } from 'test/helper'; import { diff --git a/packages/dmn-js-decision-table/test/spec/features/drag-and-drop/DragAndDropSpec.js b/packages/dmn-js-decision-table/test/spec/features/drag-and-drop/DragAndDropSpec.js index 8820b13d5..154b24f18 100644 --- a/packages/dmn-js-decision-table/test/spec/features/drag-and-drop/DragAndDropSpec.js +++ b/packages/dmn-js-decision-table/test/spec/features/drag-and-drop/DragAndDropSpec.js @@ -1,6 +1,3 @@ - -import Inferno from 'inferno'; - /* global sinon */ import { bootstrapModeler, inject } from 'test/helper'; diff --git a/packages/dmn-js-decision-table/test/spec/features/simple-date-edit/SimpleDateEditSpec.js b/packages/dmn-js-decision-table/test/spec/features/simple-date-edit/SimpleDateEditSpec.js index 7187a9836..a8358795f 100644 --- a/packages/dmn-js-decision-table/test/spec/features/simple-date-edit/SimpleDateEditSpec.js +++ b/packages/dmn-js-decision-table/test/spec/features/simple-date-edit/SimpleDateEditSpec.js @@ -155,7 +155,7 @@ describe('simple date edit', function() { // then expect(inputEntry7.businessObject.text).to - + .equal('[date("2018-01-25")..date("2000-01-01")]'); })); @@ -175,7 +175,7 @@ describe('simple date edit', function() { // then expect(inputEntry7.businessObject.text).to - + .equal('[date("2018-01-25")..date("foo")]'); })); @@ -195,7 +195,7 @@ describe('simple date edit', function() { // then expect(inputEntry7.businessObject.text).to - + .equal(`[date("2018-01-25")..date("${ getSampleDate() }")]`); })); }); diff --git a/packages/dmn-js-decision-table/test/spec/features/simple-date-edit/UtilsSpec.js b/packages/dmn-js-decision-table/test/spec/features/simple-date-edit/UtilsSpec.js index 283308308..e6192432f 100644 --- a/packages/dmn-js-decision-table/test/spec/features/simple-date-edit/UtilsSpec.js +++ b/packages/dmn-js-decision-table/test/spec/features/simple-date-edit/UtilsSpec.js @@ -96,7 +96,7 @@ describe('simple date edit - utils', function() { date: '2000-01-01' })); - + it('between', expectParsed('[date("2000-01-01")..date("2000-01-02")]', { type: 'between', dates: [ '2000-01-01', '2000-01-02' ] diff --git a/packages/dmn-js-decision-table/test/spec/features/simple-date-time-edit/SimpleDateTimeEditSpec.js b/packages/dmn-js-decision-table/test/spec/features/simple-date-time-edit/SimpleDateTimeEditSpec.js index 6f2029e23..ecec65dc6 100644 --- a/packages/dmn-js-decision-table/test/spec/features/simple-date-time-edit/SimpleDateTimeEditSpec.js +++ b/packages/dmn-js-decision-table/test/spec/features/simple-date-time-edit/SimpleDateTimeEditSpec.js @@ -175,7 +175,7 @@ describe('simple date time edit', function() { // then expect(inputEntry7.businessObject.text).to - + .equal('[date and time("2018-01-25T00:00:00Z")..date and time("foo")]'); })); diff --git a/packages/dmn-js-decision-table/test/spec/features/simple-time-edit/SimpleTimeEditSpec.js b/packages/dmn-js-decision-table/test/spec/features/simple-time-edit/SimpleTimeEditSpec.js index ad8b9ad30..7eef47ad2 100644 --- a/packages/dmn-js-decision-table/test/spec/features/simple-time-edit/SimpleTimeEditSpec.js +++ b/packages/dmn-js-decision-table/test/spec/features/simple-time-edit/SimpleTimeEditSpec.js @@ -155,7 +155,7 @@ describe('simple time edit', function() { // then expect(inputEntry7.businessObject.text).to - + .equal('[time("08:00:00Z")..time("18:00:00Z")]'); })); @@ -175,7 +175,7 @@ describe('simple time edit', function() { // then expect(inputEntry7.businessObject.text).to - + .equal('[time("08:00:00Z")..time("foo")]'); })); @@ -195,7 +195,7 @@ describe('simple time edit', function() { // then expect(inputEntry7.businessObject.text).to - + .equal(`[time("08:00:00Z")..time("${ getSampleTime() }")]`); })); }); diff --git a/packages/dmn-js-decision-table/test/spec/features/simple-time-edit/UtilsSpec.js b/packages/dmn-js-decision-table/test/spec/features/simple-time-edit/UtilsSpec.js index 52d8c3d2b..804bd3d24 100644 --- a/packages/dmn-js-decision-table/test/spec/features/simple-time-edit/UtilsSpec.js +++ b/packages/dmn-js-decision-table/test/spec/features/simple-time-edit/UtilsSpec.js @@ -124,7 +124,7 @@ describe('simple time edit - utils', function() { time: '08:00:00Z' })); - + it('between', expectParsed('[time("08:00:00Z")..time("08:00:00Z")]', { type: 'between', times: [ '08:00:00Z', '08:00:00Z' ] diff --git a/packages/dmn-js-shared/test/spec/components/ValidatedInputSpec.js b/packages/dmn-js-shared/test/spec/components/ValidatedInputSpec.js index c012dddb7..f1c03a37d 100644 --- a/packages/dmn-js-shared/test/spec/components/ValidatedInputSpec.js +++ b/packages/dmn-js-shared/test/spec/components/ValidatedInputSpec.js @@ -10,7 +10,7 @@ import { import { triggerInputEvent } from 'test/util/EventUtil'; - + import ValidatedInput from 'src/components/ValidatedInput'; From dab0e9481285994211245d741bc5cd855bb0c03f Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Tue, 15 Oct 2024 16:33:23 +0200 Subject: [PATCH 3/4] chore: refactor eslint config Ensures we properly lint _all_ assets, following the proposed structure: ``` build -> lib -> test ``` --- eslint.config.mjs | 67 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 18 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 474b4f069..d6aed4b4d 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,35 +1,49 @@ import bpmnIoPlugin from 'eslint-plugin-bpmn-io'; +const files = { + build: [ + '*.mjs', + '*.js', + 'packages/*/*.mjs', + 'packages/*/*.mjs', + 'packages/*/*.js', + 'tasks/*.mjs', + 'packages/*/tasks/*.mjs', + 'packages/dmn-js/test/distro/karma.conf.js' + ], + test: [ + '**/test/**/*.js' + ], + ignored: [ + '**/lib', + '**/dist' + ] +}; + export default [ { - ignores: [ - '**/lib', - '**/dist' - ] + ignores: files.ignored }, - ...bpmnIoPlugin.configs.browser.map(config => { + + // build + ...bpmnIoPlugin.configs.node.map(config => { return { ...config, - files: [ - '**/src/**/*.js' - ] + files: files.build }; }), - ...bpmnIoPlugin.configs.jsx.map(config => { + + // lib + test + ...bpmnIoPlugin.configs.browser.map(config => { return { ...config, - files: [ - '**/src/**/*.js', - '**/test/**/*.js' - ] + ignores: files.build }; }), - ...bpmnIoPlugin.configs.mocha.map(config => { + ...bpmnIoPlugin.configs.jsx.map(config => { return { ...config, - files: [ - '**/test/**/*.js' - ] + ignores: files.build }; }), { @@ -42,6 +56,23 @@ export default [ 'react/no-deprecated': 'off', 'react/jsx-key': 'off', // TODO(@barmac): reenable and fix problems 'react/no-unknown-property': 'off', - } + }, + ignores: files.build + }, + + // test + ...bpmnIoPlugin.configs.mocha.map(config => { + return { + ...config, + files: files.test + }; + }), + { + languageOptions: { + globals: { + require: true + } + }, + files: files.test } ]; From 2dce365fed2fa8c8c4e3ebdcadc3ddcd00171beb Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Tue, 15 Oct 2024 16:33:29 +0200 Subject: [PATCH 4/4] chore: lint all files --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8f12f7b26..c31b08645 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "build": "lerna run build --parallel --stream", "lerna-publish": "lerna publish -m \"chore(project): publish %s\"", "lint": "run-s lint:*", - "lint:js": "eslint packages", + "lint:js": "eslint .", "lint:style": "stylelint \"packages/**/*.css\"", "reinstall": "npm ci", "release": "run-s distro test \"lerna-publish -- {@}\" --",