mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-26 13:02:50 +00:00
48 lines
1.5 KiB
JavaScript
48 lines
1.5 KiB
JavaScript
import { FlatCompat } from '@eslint/eslintrc';
|
|
import nxEslintPlugin from '@nx/eslint-plugin';
|
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
import js from '@eslint/js';
|
|
|
|
const compat = new FlatCompat({
|
|
baseDirectory: import.meta.dirname,
|
|
recommendedConfig: js.configs.recommended,
|
|
});
|
|
|
|
export default [
|
|
{ plugins: { '@nx': nxEslintPlugin } },
|
|
{
|
|
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
|
|
rules: {
|
|
'@nx/enforce-module-boundaries': [
|
|
'error',
|
|
{
|
|
enforceBuildableLibDependency: true,
|
|
allow: ['^.*/eslint(\\.base)?\\.config\\.[cm]?js$'],
|
|
depConstraints: [
|
|
{ sourceTag: '*', onlyDependOnLibsWithTags: ['*'] },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
// Source files carry `eslint-disable-next-line react-hooks/exhaustive-deps`
|
|
// comments, but the plugin was never registered — so every one of them was
|
|
// an error ("Definition for rule ... was not found") rather than a
|
|
// suppression, and no hook was ever actually checked.
|
|
{
|
|
files: ['**/*.tsx', '**/*.jsx'],
|
|
plugins: { 'react-hooks': reactHooks },
|
|
rules: {
|
|
'react-hooks/rules-of-hooks': 'error',
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
},
|
|
},
|
|
...compat.config({
|
|
extends: ['plugin:@nx/typescript'],
|
|
}).map((c) => ({ ...c, files: ['**/*.ts', '**/*.tsx'] })),
|
|
...compat.config({
|
|
extends: ['plugin:@nx/javascript'],
|
|
}).map((c) => ({ ...c, files: ['**/*.js', '**/*.jsx'] })),
|
|
{ ignores: ['**/dist/**', '**/build/**', '**/.react-router/**'] },
|
|
];
|