diff --git a/.README/rules/no-barrel-import.md b/.README/rules/no-barrel-import.md index f92d5d4..dfca89c 100644 --- a/.README/rules/no-barrel-import.md +++ b/.README/rules/no-barrel-import.md @@ -30,4 +30,22 @@ This rule handles * default imports * aliased imports +You must configure `import/parsers` and `import/resolver` for this rule to work, e.g. + +```ts +settings: { + 'import/parsers': { + '@typescript-eslint/parser': ['.ts', '.tsx'], + }, + 'import/resolver': { + typescript: { + project: path.resolve( + __dirname, + 'tsconfig.json', + ), + }, + }, +}, +``` + \ No newline at end of file diff --git a/README.md b/README.md index 5215b61..f73e6aa 100644 --- a/README.md +++ b/README.md @@ -326,6 +326,24 @@ This rule handles * default imports * aliased imports +You must configure `import/parsers` and `import/resolver` for this rule to work, e.g. + +```ts +settings: { + 'import/parsers': { + '@typescript-eslint/parser': ['.ts', '.tsx'], + }, + 'import/resolver': { + typescript: { + project: path.resolve( + __dirname, + 'tsconfig.json', + ), + }, + }, +}, +``` + diff --git a/tests/rules/noBarrelImport.ts b/tests/rules/noBarrelImport.ts index 500170e..d5af6af 100644 --- a/tests/rules/noBarrelImport.ts +++ b/tests/rules/noBarrelImport.ts @@ -34,8 +34,6 @@ const invalidTest = (name: string, only: boolean = false) => { 'utf8', ), settings: { - 'import/extensions': ['.ts', '.tsx', '.js', '.jsx'], - 'import/external-module-folders': ['node_modules', 'node_modules/@types'], 'import/parsers': { '@typescript-eslint/parser': ['.ts', '.tsx'], }, @@ -64,8 +62,6 @@ const validTest = (name: string, only: boolean = false) => { name, only, settings: { - 'import/extensions': ['.ts', '.tsx', '.js', '.jsx'], - 'import/external-module-folders': ['node_modules', 'node_modules/@types'], 'import/parsers': { '@typescript-eslint/parser': ['.ts', '.tsx'], },