Skip to content

Commit

Permalink
refactor: use reference to eslint enum instead of string
Browse files Browse the repository at this point in the history
  • Loading branch information
idoros committed Feb 17, 2024
1 parent 9f1d323 commit dce5ada
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
7 changes: 4 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/eslint-plugin-stylable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@file-services/node": "^8.3.3",
"@stylable/core": "^5.16.0",
"@typescript-eslint/utils": "^7.0.1",
"@typescript-eslint/scope-manager": "^7.0.1",
"postcss-safe-parser": "^7.0.0"
},
"keywords": [
Expand Down
6 changes: 4 additions & 2 deletions packages/eslint-plugin-stylable/src/stylable-es-lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ASTUtils,
TSESTree as esTree,
} from '@typescript-eslint/utils';
import { DefinitionType } from '@typescript-eslint/scope-manager';
import { createRequire } from 'node:module';
import { pathToFileURL } from 'node:url';

Expand Down Expand Up @@ -78,8 +79,9 @@ export default createRule({
return;
}
const { type } = varDefs.defs[varDefs.defs.length - 1];
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
return local.name === varDefs.name && type === 'ImportBinding';
return (
local.name === varDefs.name && type === DefinitionType.ImportBinding
);
});

if (!variable) {
Expand Down

0 comments on commit dce5ada

Please sign in to comment.