Skip to content

Commit f71de90

Browse files
committed
chore: improve eslint@9 config (#908)
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
1 parent de04988 commit f71de90

File tree

13 files changed

+61
-41
lines changed

13 files changed

+61
-41
lines changed

eslint.config.mjs

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,49 @@
11
import bpmnIoPlugin from 'eslint-plugin-bpmn-io';
22

3+
const files = {
4+
build: [
5+
'*.mjs',
6+
'*.js',
7+
'packages/*/*.mjs',
8+
'packages/*/*.mjs',
9+
'packages/*/*.js',
10+
'tasks/*.mjs',
11+
'packages/*/tasks/*.mjs',
12+
'packages/dmn-js/test/distro/karma.conf.js'
13+
],
14+
test: [
15+
'**/test/**/*.js'
16+
],
17+
ignored: [
18+
'**/lib',
19+
'**/dist'
20+
]
21+
};
22+
323
export default [
424
{
5-
ignores: [
6-
'**/lib',
7-
'**/dist'
8-
]
25+
ignores: files.ignored
926
},
10-
...bpmnIoPlugin.configs.browser.map(config => {
27+
28+
// build
29+
...bpmnIoPlugin.configs.node.map(config => {
1130
return {
1231
...config,
13-
files: [
14-
'**/src/**/*.js'
15-
]
32+
files: files.build
1633
};
1734
}),
18-
...bpmnIoPlugin.configs.jsx.map(config => {
35+
36+
// lib + test
37+
...bpmnIoPlugin.configs.browser.map(config => {
1938
return {
2039
...config,
21-
files: [
22-
'**/src/**/*.js',
23-
'**/test/**/*.js'
24-
]
40+
ignores: files.build
2541
};
2642
}),
27-
...bpmnIoPlugin.configs.mocha.map(config => {
43+
...bpmnIoPlugin.configs.jsx.map(config => {
2844
return {
2945
...config,
30-
files: [
31-
'**/test/**/*.js'
32-
]
46+
ignores: files.build
3347
};
3448
}),
3549
{
@@ -42,6 +56,23 @@ export default [
4256
'react/no-deprecated': 'off',
4357
'react/jsx-key': 'off', // TODO(@barmac): reenable and fix problems
4458
'react/no-unknown-property': 'off',
45-
}
59+
},
60+
ignores: files.build
61+
},
62+
63+
// test
64+
...bpmnIoPlugin.configs.mocha.map(config => {
65+
return {
66+
...config,
67+
files: files.test
68+
};
69+
}),
70+
{
71+
languageOptions: {
72+
globals: {
73+
require: true
74+
}
75+
},
76+
files: files.test
4677
}
4778
];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"build": "lerna run build --parallel --stream",
1515
"lerna-publish": "lerna publish -m \"chore(project): publish %s\"",
1616
"lint": "run-s lint:*",
17-
"lint:js": "eslint packages",
17+
"lint:js": "eslint .",
1818
"lint:style": "stylelint \"packages/**/*.css\"",
1919
"reinstall": "npm ci",
2020
"release": "run-s distro test \"lerna-publish -- {@}\" --",

packages/dmn-js-decision-table/test/spec/ViewerSpec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ describe('DecisionTable', function() {
3030

3131
let dmnJS;
3232

33+
// eslint-disable-next-line no-constant-binary-expression
3334
false && afterEach(function() {
3435
if (dmnJS) {
3536
dmnJS.destroy();

packages/dmn-js-decision-table/test/spec/features/context-menu/ContextMenuCloseBehaviorSpec.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
import Inferno from 'inferno';
3-
41
import { bootstrapModeler, inject } from 'test/helper';
52

63
import {

packages/dmn-js-decision-table/test/spec/features/context-menu/ContextMenuKeyboardSpec.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
import Inferno from 'inferno';
3-
41
import { bootstrapModeler, inject } from 'test/helper';
52

63
import {

packages/dmn-js-decision-table/test/spec/features/context-menu/ContextMenuSpec.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
import Inferno from 'inferno';
3-
41
import { bootstrapModeler, inject } from 'test/helper';
52

63
import {

packages/dmn-js-decision-table/test/spec/features/drag-and-drop/DragAndDropSpec.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
import Inferno from 'inferno';
3-
41
/* global sinon */
52

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

packages/dmn-js-decision-table/test/spec/features/simple-date-edit/SimpleDateEditSpec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ describe('simple date edit', function() {
155155
// then
156156
expect(inputEntry7.businessObject.text).to
157157

158-
158+
159159
.equal('[date("2018-01-25")..date("2000-01-01")]');
160160
}));
161161

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

178-
178+
179179
.equal('[date("2018-01-25")..date("foo")]');
180180
}));
181181

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

198-
198+
199199
.equal(`[date("2018-01-25")..date("${ getSampleDate() }")]`);
200200
}));
201201
});

packages/dmn-js-decision-table/test/spec/features/simple-date-edit/UtilsSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe('simple date edit - utils', function() {
9696
date: '2000-01-01'
9797
}));
9898

99-
99+
100100
it('between', expectParsed('[date("2000-01-01")..date("2000-01-02")]', {
101101
type: 'between',
102102
dates: [ '2000-01-01', '2000-01-02' ]

packages/dmn-js-decision-table/test/spec/features/simple-date-time-edit/SimpleDateTimeEditSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ describe('simple date time edit', function() {
175175
// then
176176
expect(inputEntry7.businessObject.text).to
177177

178-
178+
179179
.equal('[date and time("2018-01-25T00:00:00Z")..date and time("foo")]');
180180
}));
181181

0 commit comments

Comments
 (0)