travisshears 已修改 . 還原成這個修訂版本
1 file changed, 61 insertions
eslint.config.mjs(檔案已創建)
| @@ -0,0 +1,61 @@ | |||
| 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 | + | ); | |
上一頁
下一頁