Skip to content

Commit

Permalink
deps: migrate to eslint@9
Browse files Browse the repository at this point in the history
  • Loading branch information
vsgoulart committed Jan 14, 2025
1 parent 8ecc1a6 commit 4d45733
Show file tree
Hide file tree
Showing 58 changed files with 867 additions and 756 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

66 changes: 0 additions & 66 deletions .eslintrc

This file was deleted.

125 changes: 125 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
import bpmnIoPlugin from 'eslint-plugin-bpmn-io';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import eslintConfigPrettier from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import globals from 'globals';

const files = {
ignored: ['packages/**/dist/*', 'node_modules', 'packages/**/types/*', 'coverage'],
browser: ['packages/**/src/**/*.js'],
test: ['packages/**/test/**/*'],
node: [
'e2e/visual/**/*',
'tasks/**/*',
'packages/**/tasks/**/*',
'packages/**/karma.conf.js',
'packages/**/rollup.config.js',
'vite.config.js',
],
};

export default [
{
ignores: files.ignored,
},

// Base configuration for all files
{
languageOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
},

// Browser + JSX configuration
...bpmnIoPlugin.configs.browser.map((config) => ({
...config,
files: files.browser,
})),
...bpmnIoPlugin.configs.jsx.map((config) => ({
...config,
files: [...files.browser, ...files.test],
})),

// Node configuration
...bpmnIoPlugin.configs.node.map((config) => ({
...config,
files: [...files.node, ...files.test],
})),

// React Hooks configuration
{
plugins: {
'react-hooks': reactHooksPlugin,
},
rules: {
...reactHooksPlugin.configs.recommended.rules,
},
files: files.browser,
},

// Import rules
{
plugins: {
import: importPlugin,
},
rules: {
'import/first': 'error',
'import/no-amd': 'error',
'import/no-webpack-loader-syntax': 'error',
'import/no-restricted-paths': [
'error',
{
basePath: './packages',
zones: [
{
target: 'form-js/src',
from: '.',
except: ['form-js'],
},
{
target: 'form-js-editor/src',
from: '.',
except: ['form-js-editor'],
},
{
target: 'form-js-playground/src',
from: '.',
except: ['form-js-playground'],
},
{
target: 'form-js-viewer/src',
from: '.',
except: ['form-js-viewer'],
},
],
},
],
},
},

...bpmnIoPlugin.configs.mocha.map((config) => {
return {
...config,
files: files.test,
};
}),
{
languageOptions: {
globals: {
sinon: true,
require: true,
...globals.browser,
...globals.mocha,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
files: files.test,
},

eslintConfigPrettier,
];
Loading

0 comments on commit 4d45733

Please sign in to comment.