eslint.config.mjs
· 1.3 KiB · JavaScript
Неформатований
// @ts-check
import eslint from '@eslint/js';
import { defineConfig } from 'eslint/config';
import tseslint from 'typescript-eslint';
export default defineConfig(
eslint.configs.recommended,
tseslint.configs.recommended,
{
rules: {
'no-console': 'error',
},
},
{
rules: {
'@typescript-eslint/no-unused-vars': ['off', { varsIgnorePattern: '^_' }],
},
},
{
rules: {
'@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }],
},
},
{
files: ['src/1_domain/**/*.ts'],
rules: {
'@typescript-eslint/no-restricted-imports': [
'error',
{
patterns: [
{
regex: '2_app',
message: 'The domain layer should not depend on the app layer.',
},
{
regex: '3_infra',
message: 'The domain layer should not depend on the infra layer.',
},
],
},
],
},
},
{
files: ['src/2_app/**/*.ts'],
rules: {
'@typescript-eslint/no-restricted-imports': [
'error',
{
patterns: [
{
regex: '3_infra',
message: 'The app layer should not depend on the infra layer.',
},
],
},
],
},
},
);
| 1 | // @ts-check |
| 2 | |
| 3 | import eslint from '@eslint/js'; |
| 4 | import { defineConfig } from 'eslint/config'; |
| 5 | import tseslint from 'typescript-eslint'; |
| 6 | |
| 7 | export default defineConfig( |
| 8 | eslint.configs.recommended, |
| 9 | tseslint.configs.recommended, |
| 10 | { |
| 11 | rules: { |
| 12 | 'no-console': 'error', |
| 13 | }, |
| 14 | }, |
| 15 | { |
| 16 | rules: { |
| 17 | '@typescript-eslint/no-unused-vars': ['off', { varsIgnorePattern: '^_' }], |
| 18 | }, |
| 19 | }, |
| 20 | { |
| 21 | rules: { |
| 22 | '@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }], |
| 23 | }, |
| 24 | }, |
| 25 | { |
| 26 | files: ['src/1_domain/**/*.ts'], |
| 27 | rules: { |
| 28 | '@typescript-eslint/no-restricted-imports': [ |
| 29 | 'error', |
| 30 | { |
| 31 | patterns: [ |
| 32 | { |
| 33 | regex: '2_app', |
| 34 | message: 'The domain layer should not depend on the app layer.', |
| 35 | }, |
| 36 | { |
| 37 | regex: '3_infra', |
| 38 | message: 'The domain layer should not depend on the infra layer.', |
| 39 | }, |
| 40 | ], |
| 41 | }, |
| 42 | ], |
| 43 | }, |
| 44 | }, |
| 45 | { |
| 46 | files: ['src/2_app/**/*.ts'], |
| 47 | rules: { |
| 48 | '@typescript-eslint/no-restricted-imports': [ |
| 49 | 'error', |
| 50 | { |
| 51 | patterns: [ |
| 52 | { |
| 53 | regex: '3_infra', |
| 54 | message: 'The app layer should not depend on the infra layer.', |
| 55 | }, |
| 56 | ], |
| 57 | }, |
| 58 | ], |
| 59 | }, |
| 60 | }, |
| 61 | ); |
| 62 |