mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 19:53:48 +08:00
style: use typescript resolver for eslint import plugin (#9662)
This commit is contained in:
+42
-1
@@ -20,6 +20,11 @@ const ignoreList = readFileSync('.prettierignore', 'utf-8')
|
||||
.split('\n')
|
||||
.filter(line => line.trim() && !line.startsWith('#'));
|
||||
|
||||
// Omit `.d.ts` because 1) TypeScript compilation already confirms that
|
||||
// types are resolved, and 2) it would mask an unresolved
|
||||
// `.ts`/`.tsx`/`.js`/`.jsx` implementation.
|
||||
const typeScriptExtensions = ['.ts', '.tsx', '.cts', '.mts'];
|
||||
|
||||
export default tseslint.config(
|
||||
{
|
||||
ignores: ignoreList,
|
||||
@@ -29,6 +34,12 @@ export default tseslint.config(
|
||||
react: {
|
||||
version: 'detect',
|
||||
},
|
||||
'import-x/parsers': {
|
||||
'@typescript-eslint/parser': typeScriptExtensions,
|
||||
},
|
||||
'import-x/resolver': {
|
||||
typescript: true,
|
||||
},
|
||||
},
|
||||
languageOptions: {
|
||||
parser: tsParser,
|
||||
@@ -224,7 +235,10 @@ export default tseslint.config(
|
||||
'@typescript-eslint/require-array-sort-compare': 'error',
|
||||
'@typescript-eslint/no-misused-promises': ['error'],
|
||||
'@typescript-eslint/prefer-readonly': 'error',
|
||||
'import-x/no-extraneous-dependencies': ['error'],
|
||||
'import-x/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{ includeInternal: true },
|
||||
],
|
||||
'react-hooks/exhaustive-deps': [
|
||||
'warn',
|
||||
{
|
||||
@@ -249,6 +263,33 @@ export default tseslint.config(
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['packages/frontend/admin/**/*'],
|
||||
rules: {
|
||||
'import-x/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{ includeInternal: true, whitelist: ['@affine/admin'] },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['packages/frontend/core/**/*'],
|
||||
rules: {
|
||||
'import-x/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{ includeInternal: true, whitelist: ['@affine/core'] },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['packages/frontend/component/**/*'],
|
||||
rules: {
|
||||
'import-x/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{ includeInternal: true, whitelist: ['@affine/component'] },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'**/__tests__/**/*',
|
||||
|
||||
Reference in New Issue
Block a user