91 lines
1.9 KiB
JavaScript
91 lines
1.9 KiB
JavaScript
import eslint from "@eslint/js";
|
|
import tseslint from "typescript-eslint";
|
|
|
|
const layerImports = {
|
|
application: ["**/application/**"],
|
|
infrastructure: ["**/infrastructure/**"],
|
|
ui: ["**/ui/**"],
|
|
integrations: ["**/integrations/**"],
|
|
ports: ["**/ports/**"],
|
|
};
|
|
|
|
export default tseslint.config(
|
|
{
|
|
ignores: ["dist/**", "node_modules/**", "docs/**", "coverage/**"],
|
|
},
|
|
eslint.configs.recommended,
|
|
...tseslint.configs.recommended,
|
|
{
|
|
files: ["src/domain/**/*.ts"],
|
|
rules: {
|
|
"no-restricted-imports": [
|
|
"error",
|
|
{
|
|
patterns: [
|
|
...layerImports.application,
|
|
...layerImports.infrastructure,
|
|
...layerImports.ui,
|
|
...layerImports.integrations,
|
|
...layerImports.ports,
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
files: ["src/ports/**/*.ts"],
|
|
rules: {
|
|
"no-restricted-imports": [
|
|
"error",
|
|
{
|
|
patterns: [
|
|
...layerImports.application,
|
|
...layerImports.infrastructure,
|
|
...layerImports.ui,
|
|
...layerImports.integrations,
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
files: ["src/application/**/*.ts"],
|
|
ignores: ["src/**/*.test.ts"],
|
|
rules: {
|
|
"no-restricted-imports": [
|
|
"error",
|
|
{
|
|
patterns: [...layerImports.infrastructure, ...layerImports.ui],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
files: ["src/infrastructure/**/*.ts"],
|
|
ignores: ["src/**/*.test.ts"],
|
|
rules: {
|
|
"no-restricted-imports": [
|
|
"error",
|
|
{
|
|
patterns: [...layerImports.application, ...layerImports.ui],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
files: ["src/integrations/**/*.ts"],
|
|
rules: {
|
|
"no-restricted-imports": [
|
|
"error",
|
|
{
|
|
patterns: [
|
|
...layerImports.application,
|
|
...layerImports.infrastructure,
|
|
...layerImports.ui,
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
);
|