Skip to content

Commit

Permalink
chore: improve eslint@9 config (#908)
Browse files Browse the repository at this point in the history
style: whitelist constant expression

style: adjust code style (apply eslint --fix)

chore: refactor eslint config

  Ensures we properly lint _all_ assets, following the proposed structure:

  ```
  build -> lib -> test
  ```

* chore: lint all files
  • Loading branch information
nikku committed Oct 16, 2024
1 parent de04988 commit f71de90
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 41 deletions.
67 changes: 49 additions & 18 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -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
};
}),
{
Expand All @@ -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
}
];
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 -- {@}\" --",
Expand Down
1 change: 1 addition & 0 deletions packages/dmn-js-decision-table/test/spec/ViewerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('DecisionTable', function() {

let dmnJS;

// eslint-disable-next-line no-constant-binary-expression
false && afterEach(function() {
if (dmnJS) {
dmnJS.destroy();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

import Inferno from 'inferno';

import { bootstrapModeler, inject } from 'test/helper';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

import Inferno from 'inferno';

import { bootstrapModeler, inject } from 'test/helper';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

import Inferno from 'inferno';

import { bootstrapModeler, inject } from 'test/helper';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

import Inferno from 'inferno';

/* global sinon */

import { bootstrapModeler, inject } from 'test/helper';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe('simple date edit', function() {
// then
expect(inputEntry7.businessObject.text).to


.equal('[date("2018-01-25")..date("2000-01-01")]');
}));

Expand All @@ -175,7 +175,7 @@ describe('simple date edit', function() {
// then
expect(inputEntry7.businessObject.text).to


.equal('[date("2018-01-25")..date("foo")]');
}));

Expand All @@ -195,7 +195,7 @@ describe('simple date edit', function() {
// then
expect(inputEntry7.businessObject.text).to


.equal(`[date("2018-01-25")..date("${ getSampleDate() }")]`);
}));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")]');
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe('simple time edit', function() {
// then
expect(inputEntry7.businessObject.text).to


.equal('[time("08:00:00Z")..time("18:00:00Z")]');
}));

Expand All @@ -175,7 +175,7 @@ describe('simple time edit', function() {
// then
expect(inputEntry7.businessObject.text).to


.equal('[time("08:00:00Z")..time("foo")]');
}));

Expand All @@ -195,7 +195,7 @@ describe('simple time edit', function() {
// then
expect(inputEntry7.businessObject.text).to


.equal(`[time("08:00:00Z")..time("${ getSampleTime() }")]`);
}));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {

import { triggerInputEvent } from 'test/util/EventUtil';


import ValidatedInput from 'src/components/ValidatedInput';


Expand Down

0 comments on commit f71de90

Please sign in to comment.