Skip to content

Commit

Permalink
fix: handle aliased re-exports
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Jul 11, 2023
1 parent bb2998b commit 37ea66a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
18 changes: 18 additions & 0 deletions .README/rules/no-barrel-import.md
Original file line number Diff line number Diff line change
Expand Up @@ -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',
),
},
},
},
```

<!-- assertions noBarrelImport -->
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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',
),
},
},
},
```


<a name="user-content-eslint-plugin-canonical-rules-no-restricted-strings"></a>
<a name="eslint-plugin-canonical-rules-no-restricted-strings"></a>
Expand Down
4 changes: 0 additions & 4 deletions tests/rules/noBarrelImport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
},
Expand Down Expand Up @@ -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'],
},
Expand Down

0 comments on commit 37ea66a

Please sign in to comment.