-
-
Save amstiel/de0309fe627ea8076d1577aa2f67fe37 to your computer and use it in GitHub Desktop.
Feature-Sliced Design - typersctipt + eslint + vite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"plugins": ["boundaries"], | |
"extends": [ | |
"eslint:recommended", | |
"plugin:import/errors", | |
"plugin:import/warnings", | |
"plugin:import/typescript", | |
"plugin:boundaries/recommended", | |
"plugin:@typescript-eslint/recommended", | |
"plugin:@typescript-eslint/recommended-requiring-type-checking" | |
], | |
"parser": "@typescript-eslint/parser", | |
"parserOptions": { | |
"project": "./tsconfig.json", | |
"tsconfigRootDir": "./" | |
}, | |
"settings": { | |
"import/resolver": { | |
"typescript": {} | |
}, | |
"boundaries/elements": [ | |
{ "type": "app", "pattern": "src/app/*" }, | |
{ "type": "processes", "pattern": "src/processes/*" }, | |
{ "type": "pages", "pattern": "src/pages/*" }, | |
{ "type": "widgets", "pattern": "src/widgets/*" }, | |
{ "type": "features", "pattern": "src/features/*" }, | |
{ "type": "entities", "pattern": "src/entities/*" }, | |
{ "type": "shared", "pattern": "src/shared/*" } | |
], | |
"boundaries/ignore": ["**/*.test.*"] | |
}, | |
"rules": { | |
"import/order": [ | |
"error", | |
{ | |
"alphabetize": { "order": "asc", "caseInsensitive": true }, | |
"newlines-between": "always", | |
"pathGroups": [ | |
{ | |
"pattern": "~/**", | |
"group": "external" | |
}, | |
{ | |
"group": "internal", | |
"position": "after", | |
"pattern": "@processes/**" | |
}, | |
{ "group": "internal", "position": "after", "pattern": "@pages/**" }, | |
{ | |
"group": "internal", | |
"position": "after", | |
"pattern": "@widgets/**" | |
}, | |
{ | |
"group": "internal", | |
"position": "after", | |
"pattern": "@features/**" | |
}, | |
{ | |
"group": "internal", | |
"position": "after", | |
"pattern": "@entities/**" | |
}, | |
{ "group": "internal", "position": "after", "pattern": "@shared/**" } | |
], | |
"pathGroupsExcludedImportTypes": ["builtin"], | |
"groups": [ | |
"builtin", | |
"external", | |
"internal", | |
"parent", | |
"sibling", | |
"index" | |
] | |
} | |
], | |
"no-restricted-imports": [ | |
"error", | |
{ | |
"patterns": [ | |
{ | |
"message": "Private imports are prohibited, use public imports instead", | |
"group": ["@app/**"] | |
}, | |
{ | |
"message": "Private imports are prohibited, use public imports instead", | |
"group": ["@processes/*/**"] | |
}, | |
{ | |
"message": "Private imports are prohibited, use public imports instead", | |
"group": ["@pages/*/**"] | |
}, | |
{ | |
"message": "Private imports are prohibited, use public imports instead", | |
"group": ["@widgets/*/**"] | |
}, | |
{ | |
"message": "Private imports are prohibited, use public imports instead", | |
"group": ["@features/*/**"] | |
}, | |
{ | |
"message": "Private imports are prohibited, use public imports instead", | |
"group": ["@entities/*/**"] | |
}, | |
{ | |
"message": "Private imports are prohibited, use public imports instead", | |
"group": ["@shared/*/*/**"] | |
}, | |
{ | |
"message": "Prefer absolute imports instead of relatives (for root modules)", | |
"group": ["../**/app"] | |
}, | |
{ | |
"message": "Prefer absolute imports instead of relatives (for root modules)", | |
"group": ["../**/processes"] | |
}, | |
{ | |
"message": "Prefer absolute imports instead of relatives (for root modules)", | |
"group": ["../**/pages"] | |
}, | |
{ | |
"message": "Prefer absolute imports instead of relatives (for root modules)", | |
"group": ["../**/widgets"] | |
}, | |
{ | |
"message": "Prefer absolute imports instead of relatives (for root modules)", | |
"group": ["../**/features"] | |
}, | |
{ | |
"message": "Prefer absolute imports instead of relatives (for root modules)", | |
"group": ["../**/entities"] | |
}, | |
{ | |
"message": "Prefer absolute imports instead of relatives (for root modules)", | |
"group": ["../**/shared"] | |
} | |
] | |
} | |
], | |
"boundaries/element-types": [ | |
"warn", | |
{ | |
"default": "disallow", | |
"rules": [ | |
{ | |
"from": "app", | |
"allow": [ | |
"processes", | |
"pages", | |
"widgets", | |
"features", | |
"entities", | |
"shared" | |
] | |
}, | |
{ | |
"from": "processes", | |
"allow": ["pages", "widgets", "features", "entities", "shared"] | |
}, | |
{ | |
"from": "pages", | |
"allow": ["widgets", "features", "entities", "shared"] | |
}, | |
{ "from": "widgets", "allow": ["features", "entities", "shared"] }, | |
{ "from": "features", "allow": ["entities", "shared"] }, | |
{ "from": "entities", "allow": ["shared"] }, | |
{ "from": "shared", "allow": ["shared"] } | |
] | |
} | |
], | |
"@typescript-eslint/no-misused-promises": "off" | |
}, | |
"overrides": [ | |
{ "files": ["**/*.test.*"], "rules": { "boundaries/element-types": "off" } } | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"compilerOptions": { | |
"baseUrl": ".", | |
"target": "es5", | |
"lib": [ | |
"dom", | |
"dom.iterable", | |
"esnext", | |
], | |
"types": ["vite/client"], | |
"allowJs": true, | |
"skipLibCheck": true, | |
"esModuleInterop": true, | |
"allowSyntheticDefaultImports": true, | |
"strict": true, | |
"forceConsistentCasingInFileNames": true, | |
"noFallthroughCasesInSwitch": true, | |
"module": "esnext", | |
"moduleResolution": "node", | |
"resolveJsonModule": true, | |
"isolatedModules": true, | |
"noEmit": true, | |
"jsx": "react-jsx", | |
"paths": { | |
"@app/*": ["src/app/*"], | |
"@processes/*": ["src/processes/*"], | |
"@pages": ["src/pages/index.tsx"], | |
"@pages/*": ["src/pages/*"], | |
"@widgets/*": ["src/widgets/*"], | |
"@features/*": ["src/features/*"], | |
"@entities/*": ["src/entities/*"], | |
"@shared/*": ["src/shared/*"] | |
} | |
}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import react from '@vitejs/plugin-react'; | |
import { defineConfig } from 'vite'; | |
import eslint from 'vite-plugin-eslint'; | |
import tsconfigPaths from 'vite-tsconfig-paths'; | |
// https://vitejs.dev/config/ | |
export default defineConfig({ | |
build: { | |
outDir: './dist/project', | |
}, | |
server: { | |
port: 3000, | |
open: false, | |
}, | |
plugins: [ | |
react({ | |
jsxImportSource: '@emotion/react', | |
}), | |
tsconfigPaths(), | |
eslint({ cache: false, exclude: ['**/node_modules/**'] }), | |
], | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment