Skip to content

Commit

Permalink
feat(typescript): Update type import specifier rules
Browse files Browse the repository at this point in the history
  • Loading branch information
rekmarks committed Oct 22, 2024
1 parent 733b9e2 commit 9205cac
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/typescript/rules-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/default-param-last": "error",
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/naming-convention": [
Expand Down Expand Up @@ -144,6 +143,7 @@
"constructor-super": "off",
"default-param-last": "off",
"getter-return": "off",
"import-x/consistent-type-specifier-style": ["error", "prefer-top-level"],
"import-x/named": "off",
"import-x/no-unresolved": "off",
"jsdoc/check-access": "error",
Expand Down
13 changes: 9 additions & 4 deletions packages/typescript/src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,10 @@ const config = createConfig({
},

rules: {
// Handled by TypeScript
'import-x/no-unresolved': 'off',

// Our rules
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-namespace': [
Expand Down Expand Up @@ -185,6 +181,15 @@ const config = createConfig({
'no-useless-constructor': 'off',
'@typescript-eslint/no-useless-constructor': 'error',

/* import-x plugin rules */

// Handled by TypeScript
'import-x/no-unresolved': 'off',

// Combined with the "verbatimModuleSyntax" tsconfig option, a better option than
// @typescript-eslint/consistent-type-imports
'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'],

/* jsdoc plugin rules */

'jsdoc/check-syntax': 'error',
Expand Down
3 changes: 2 additions & 1 deletion packages/typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"strictNullChecks": true
"strictNullChecks": true,
"verbatimModuleSyntax": true
},
"include": ["src"]
}
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"strict": true,
"target": "ES2022"
"target": "ES2022",
"verbatimModuleSyntax": true
},
"include": ["**/*.mjs", "**/*.mts"],
"exclude": ["./dist", "**/node_modules"]
Expand Down

0 comments on commit 9205cac

Please sign in to comment.