Skip to content

Commit

Permalink
chore: simplify eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Oct 16, 2024
1 parent e166a4a commit 901a426
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 28 deletions.
81 changes: 53 additions & 28 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,50 @@ import bpmnIoPlugin from 'eslint-plugin-bpmn-io';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import importPlugin from 'eslint-plugin-import';

const buildScripts = [ '*.js', '*.mjs' ];
const files = {
build: [
'*.js',
'*.mjs',
'test/distro/distroSpec.js'
],
test: [
'test/**/*.js'
],
ignored: [
'dist',
'preact'
]
};


export default [
{
ignores: [
'dist'
]
ignores: files.ignored
},
...bpmnIoPlugin.configs.browser,
...bpmnIoPlugin.configs.jsx,

// build
...bpmnIoPlugin.configs.node.map(config => {
return {
...config,
files: files.build
};
}),

// lib + test
...bpmnIoPlugin.configs.browser.map(config => {
return {
...config,
ignores: files.build
};
}),
...bpmnIoPlugin.configs.jsx.map(config => {
return {
...config,
ignores: files.build
};
}),

// misc
{
plugins: {
'react-hooks': reactHooksPlugin,
Expand All @@ -23,39 +57,30 @@ export default [
'import/no-amd': 'error',
'import/no-webpack-loader-syntax': 'error',
'react-hooks/exhaustive-deps': 'off'
},
ignores: files.build
},
{
rules: {
'react/display-name': 'off',
'react/no-unescaped-entities': 'off'
}
},
...bpmnIoPlugin.configs.node.map(config => {
return {
...config,
files: [
...buildScripts,
'**/test/**/*.js'
]
};
}),

// test
...bpmnIoPlugin.configs.mocha.map(config => {
return {
...config,
files: [
'**/test/**/*.js'
]
files: files.test
};
}),
{
languageOptions: {
globals: {
sinon: true
sinon: true,
require: true
},
},
files: [
'**/test/**/*.js'
]
},
{
rules: {
'react/display-name': 'off',
'react/no-unescaped-entities': 'off'
}
files: files.test
}
];
1 change: 1 addition & 0 deletions test/TestHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const DEFAULT_AXE_RULES = [

let PROPERTIES_PANEL_CONTAINER;

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

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

0 comments on commit 901a426

Please sign in to comment.