Skip to content

Commit

Permalink
fix: πŸ› ignore SVGs in some imports rules (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmy-guzman authored Nov 5, 2024
1 parent c071453 commit 542d009
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/rules/__snapshots__/imports.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ exports[`should create imports rules 1`] = `
"never",
{
"checkTypedImports": true,
"svg": "always",
},
],
"import-x/first": "error",
Expand All @@ -25,7 +26,14 @@ exports[`should create imports rules 1`] = `
"import-x/no-named-as-default": "error",
"import-x/no-named-as-default-member": "error",
"import-x/no-self-import": "error",
"import-x/no-unresolved": "error",
"import-x/no-unresolved": [
"error",
{
"ignore": [
"\\.svg$",
],
},
],
"import-x/no-useless-path-segments": "error",
}
`;
7 changes: 6 additions & 1 deletion src/rules/imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import type { Rules } from "../types";
export const importsRules = {
...importX.configs.recommended.rules,
"import-x/consistent-type-specifier-style": ["error", "prefer-top-level"],
"import-x/extensions": ["error", "never", { checkTypedImports: true }],
"import-x/extensions": [
"error",
"never",
{ checkTypedImports: true, svg: "always" },
],
"import-x/first": "error",
// ! can't get this rule to work
"import-x/namespace": "off",
Expand All @@ -16,5 +20,6 @@ export const importsRules = {
"import-x/no-named-as-default": "error",
"import-x/no-named-as-default-member": "error",
"import-x/no-self-import": "error",
"import-x/no-unresolved": ["error", { ignore: [String.raw`\.svg$`] }],
"import-x/no-useless-path-segments": "error",
} satisfies Rules;

0 comments on commit 542d009

Please sign in to comment.