Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat(typescript): Update type import specifier rules
  • Loading branch information
rekmarks committed Oct 22, 2024
commit 9205cac7fbaed9d5d2650d43f140fcbd537adc3f
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