Skip to content

Commit 901a426

Browse files
committed
chore: simplify eslint config
1 parent e166a4a commit 901a426

File tree

2 files changed

+54
-28
lines changed

2 files changed

+54
-28
lines changed

eslint.config.mjs

Lines changed: 53 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,50 @@ import bpmnIoPlugin from 'eslint-plugin-bpmn-io';
22
import reactHooksPlugin from 'eslint-plugin-react-hooks';
33
import importPlugin from 'eslint-plugin-import';
44

5-
const buildScripts = [ '*.js', '*.mjs' ];
5+
const files = {
6+
build: [
7+
'*.js',
8+
'*.mjs',
9+
'test/distro/distroSpec.js'
10+
],
11+
test: [
12+
'test/**/*.js'
13+
],
14+
ignored: [
15+
'dist',
16+
'preact'
17+
]
18+
};
19+
620

721
export default [
822
{
9-
ignores: [
10-
'dist'
11-
]
23+
ignores: files.ignored
1224
},
13-
...bpmnIoPlugin.configs.browser,
14-
...bpmnIoPlugin.configs.jsx,
25+
26+
// build
27+
...bpmnIoPlugin.configs.node.map(config => {
28+
return {
29+
...config,
30+
files: files.build
31+
};
32+
}),
33+
34+
// lib + test
35+
...bpmnIoPlugin.configs.browser.map(config => {
36+
return {
37+
...config,
38+
ignores: files.build
39+
};
40+
}),
41+
...bpmnIoPlugin.configs.jsx.map(config => {
42+
return {
43+
...config,
44+
ignores: files.build
45+
};
46+
}),
47+
48+
// misc
1549
{
1650
plugins: {
1751
'react-hooks': reactHooksPlugin,
@@ -23,39 +57,30 @@ export default [
2357
'import/no-amd': 'error',
2458
'import/no-webpack-loader-syntax': 'error',
2559
'react-hooks/exhaustive-deps': 'off'
60+
},
61+
ignores: files.build
62+
},
63+
{
64+
rules: {
65+
'react/display-name': 'off',
66+
'react/no-unescaped-entities': 'off'
2667
}
2768
},
28-
...bpmnIoPlugin.configs.node.map(config => {
29-
return {
30-
...config,
31-
files: [
32-
...buildScripts,
33-
'**/test/**/*.js'
34-
]
35-
};
36-
}),
69+
70+
// test
3771
...bpmnIoPlugin.configs.mocha.map(config => {
3872
return {
3973
...config,
40-
files: [
41-
'**/test/**/*.js'
42-
]
74+
files: files.test
4375
};
4476
}),
4577
{
4678
languageOptions: {
4779
globals: {
48-
sinon: true
80+
sinon: true,
81+
require: true
4982
},
5083
},
51-
files: [
52-
'**/test/**/*.js'
53-
]
54-
},
55-
{
56-
rules: {
57-
'react/display-name': 'off',
58-
'react/no-unescaped-entities': 'off'
59-
}
84+
files: files.test
6085
}
6186
];

test/TestHelper.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const DEFAULT_AXE_RULES = [
3434

3535
let PROPERTIES_PANEL_CONTAINER;
3636

37+
// eslint-disable-next-line no-undef
3738
global.chai.use(function(chai, utils) {
3839

3940
utils.addMethod(chai.Assertion.prototype, 'jsonEqual', function(comparison) {

0 commit comments

Comments
 (0)