@checkdigit/eslint-plugin 6.6.0-PR.75-edd9 → 6.6.0-PR.75-b19c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+ export declare const ruleId = "require-type-out-of-type-only-imports";
3
+ declare const rule: ESLintUtils.RuleModule<"moveTypeOutside", never[], ESLintUtils.RuleListener>;
4
+ export default rule;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@checkdigit/eslint-plugin","version":"6.6.0-PR.75-edd9","description":"Check Digit eslint plugins","keywords":["eslint","eslintplugin"],"homepage":"https://github.com/checkdigit/eslint-plugin#readme","bugs":{"url":"https://github.com/checkdigit/eslint-plugin/issues"},"repository":{"type":"git","url":"https://github.com/checkdigit/eslint-plugin"},"license":"MIT","author":"Check Digit, LLC","sideEffects":false,"type":"module","exports":{".":{"types":"./dist-types/index.d.ts","require":"./dist-cjs/index.cjs","import":"./dist-mjs/index.mjs","default":"./dist-mjs/index.mjs"}},"files":["src","dist-types","dist-cjs","dist-mjs","!src/**/*.test.ts","!src/**/*.spec.ts","!dist-types/**/*.test.d.ts","!dist-types/**/*.spec.d.ts","!dist-cjs/**/*.test.cjs","!dist-cjs/**/*.spec.cjs","!dist-mjs/**/*.test.mjs","!dist-mjs/**/*.spec.mjs","SECURITY.md"],"scripts":{"build:dist-cjs":"rimraf dist-cjs && npx builder --type=commonjs --sourceMap --entryPoint=index.ts --outDir=dist-cjs --outFile=index.cjs --external=espree && echo \"module.exports = module.exports.default;\" >> dist-cjs/index.cjs","build:dist-mjs":"rimraf dist-mjs && npx builder --type=module --sourceMap --outDir=dist-mjs && node dist-mjs/index.mjs","build:dist-types":"rimraf dist-types && npx builder --type=types --outDir=dist-types","ci:compile":"tsc --noEmit","ci:coverage":"NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=true","ci:lint":"npm run lint","ci:style":"npm run prettier","ci:test":"NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=false","lint":"eslint --max-warnings 0 --ignore-path .gitignore .","lint:fix":"eslint --ignore-path .gitignore . --fix","prepublishOnly":"npm run build:dist-types && npm run build:dist-cjs && npm run build:dist-mjs","prettier":"prettier --ignore-path .gitignore --list-different .","prettier:fix":"prettier --ignore-path .gitignore --write .","test":"npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style"},"prettier":"@checkdigit/prettier-config","jest":{"preset":"@checkdigit/jest-config"},"dependencies":{"@typescript-eslint/type-utils":"7.18.0","@typescript-eslint/utils":"7.18.0","ts-api-utils":"^1.3.0"},"devDependencies":{"@checkdigit/jest-config":"^6.0.2","@checkdigit/prettier-config":"^5.5.0","@checkdigit/typescript-config":"6.0.0","@types/eslint":"8.56.10","@typescript-eslint/eslint-plugin":"7.18.0","@typescript-eslint/parser":"7.18.0","@typescript-eslint/rule-tester":"7.18.0","eslint-config-prettier":"^9.1.0","eslint-plugin-eslint-plugin":"^6.2.0","eslint-plugin-import":"^2.29.1","eslint-plugin-no-only-tests":"^3.1.0","eslint-plugin-no-secrets":"^1.0.2","eslint-plugin-node":"^11.1.0","eslint-plugin-sonarjs":"0.24.0","http-status-codes":"^2.3.0"},"peerDependencies":{"eslint":">=8 <9"},"engines":{"node":">=20.14"}}
1
+ {"name":"@checkdigit/eslint-plugin","version":"6.6.0-PR.75-b19c","description":"Check Digit eslint plugins","keywords":["eslint","eslintplugin"],"homepage":"https://github.com/checkdigit/eslint-plugin#readme","bugs":{"url":"https://github.com/checkdigit/eslint-plugin/issues"},"repository":{"type":"git","url":"https://github.com/checkdigit/eslint-plugin"},"license":"MIT","author":"Check Digit, LLC","sideEffects":false,"type":"module","exports":{".":{"types":"./dist-types/index.d.ts","require":"./dist-cjs/index.cjs","import":"./dist-mjs/index.mjs","default":"./dist-mjs/index.mjs"}},"files":["src","dist-types","dist-cjs","dist-mjs","!src/**/*.test.ts","!src/**/*.spec.ts","!dist-types/**/*.test.d.ts","!dist-types/**/*.spec.d.ts","!dist-cjs/**/*.test.cjs","!dist-cjs/**/*.spec.cjs","!dist-mjs/**/*.test.mjs","!dist-mjs/**/*.spec.mjs","SECURITY.md"],"scripts":{"build:dist-cjs":"rimraf dist-cjs && npx builder --type=commonjs --sourceMap --entryPoint=index.ts --outDir=dist-cjs --outFile=index.cjs --external=espree && echo \"module.exports = module.exports.default;\" >> dist-cjs/index.cjs","build:dist-mjs":"rimraf dist-mjs && npx builder --type=module --sourceMap --outDir=dist-mjs && node dist-mjs/index.mjs","build:dist-types":"rimraf dist-types && npx builder --type=types --outDir=dist-types","ci:compile":"tsc --noEmit","ci:coverage":"NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=true","ci:lint":"npm run lint","ci:style":"npm run prettier","ci:test":"NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=false","lint":"eslint --max-warnings 0 --ignore-path .gitignore .","lint:fix":"eslint --ignore-path .gitignore . --fix","prepublishOnly":"npm run build:dist-types && npm run build:dist-cjs && npm run build:dist-mjs","prettier":"prettier --ignore-path .gitignore --list-different .","prettier:fix":"prettier --ignore-path .gitignore --write .","test":"npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style"},"prettier":"@checkdigit/prettier-config","jest":{"preset":"@checkdigit/jest-config"},"dependencies":{"@typescript-eslint/type-utils":"7.18.0","@typescript-eslint/utils":"7.18.0","ts-api-utils":"^1.3.0"},"devDependencies":{"@checkdigit/jest-config":"^6.0.2","@checkdigit/prettier-config":"^5.5.0","@checkdigit/typescript-config":"6.0.0","@types/eslint":"8.56.10","@typescript-eslint/eslint-plugin":"7.18.0","@typescript-eslint/parser":"7.18.0","@typescript-eslint/rule-tester":"7.18.0","eslint-config-prettier":"^9.1.0","eslint-plugin-eslint-plugin":"^6.2.0","eslint-plugin-import":"^2.29.1","eslint-plugin-no-only-tests":"^3.1.0","eslint-plugin-no-secrets":"^1.0.2","eslint-plugin-node":"^11.1.0","eslint-plugin-sonarjs":"0.24.0","http-status-codes":"^2.3.0"},"peerDependencies":{"eslint":">=8 <9"},"engines":{"node":">=20.14"}}
@@ -1,4 +1,4 @@
1
- // fixture/add-url-domain.ts
1
+ // agent/add-url-domain.ts
2
2
 
3
3
  /*
4
4
  * Copyright (c) 2021-2024 Check Digit, LLC
@@ -1,4 +1,4 @@
1
- // fixture/fetch-response-body-json.ts
1
+ // agent/fetch-response-body-json.ts
2
2
 
3
3
  /*
4
4
  * Copyright (c) 2021-2024 Check Digit, LLC
@@ -1,4 +1,4 @@
1
- // fixture/fetch-response-header-getter-ts.ts
1
+ // agent/fetch-response-header-getter-ts.ts
2
2
 
3
3
  /*
4
4
  * Copyright (c) 2021-2024 Check Digit, LLC
@@ -1,4 +1,4 @@
1
- // fixture/fetch-then.ts
1
+ // agent/fetch-then.ts
2
2
 
3
3
  /*
4
4
  * Copyright (c) 2021-2024 Check Digit, LLC
@@ -1,4 +1,4 @@
1
- // fixture/fetch.ts
1
+ // agent/fetch.ts
2
2
 
3
3
  import { getParent, isBlockStatement } from '../library/tree';
4
4
  import type { Node } from 'estree';
@@ -1,4 +1,4 @@
1
- // fixture/no-fixture.ts
1
+ // agent/no-fixture.ts
2
2
 
3
3
  /*
4
4
  * Copyright (c) 2021-2024 Check Digit, LLC
@@ -1,4 +1,4 @@
1
- // fixture/no-full-response.ts
1
+ // agent/no-full-response.ts
2
2
 
3
3
  /*
4
4
  * Copyright (c) 2021-2024 Check Digit, LLC
@@ -1,4 +1,4 @@
1
- // fixture/no-mapped-response-type.ts
1
+ // agent/no-mapped-response-type.ts
2
2
 
3
3
  /*
4
4
  * Copyright (c) 2021-2024 Check Digit, LLC
@@ -1,4 +1,4 @@
1
- // fixture/no-service-wrapper.ts
1
+ // agent/no-service-wrapper.ts
2
2
 
3
3
  /*
4
4
  * Copyright (c) 2021-2024 Check Digit, LLC
@@ -1,4 +1,4 @@
1
- // fixture/no-status-code.ts
1
+ // agent/no-status-code.ts
2
2
 
3
3
  /*
4
4
  * Copyright (c) 2021-2024 Check Digit, LLC
@@ -1,4 +1,4 @@
1
- // fixture/response-reference.ts
1
+ // agent/response-reference.ts
2
2
 
3
3
  /*
4
4
  * Copyright (c) 2021-2024 Check Digit, LLC
package/src/agent/url.ts CHANGED
@@ -1,4 +1,4 @@
1
- // fixture/url.ts
1
+ // agent/url.ts
2
2
 
3
3
  export const PLAIN_URL_REGEXP = /^[`']\/\w+(?<serviceNamePart>-\w+)*\/v\d+\/(?<any>.|\r|\n)+[`']$/u;
4
4
  export const TOKENIZED_URL_REGEXP = /^`\$\{(?<serviceNamePart>[A-Z]+_)*BASE_PATH\}\/(?<any>.|\r|\n)+`$/u;
package/src/index.ts CHANGED
@@ -13,15 +13,22 @@ import fetchResponseHeaderGetter, {
13
13
  } from './agent/fetch-response-header-getter';
14
14
  import fetchThen, { ruleId as fetchThenRuleId } from './agent/fetch-then';
15
15
  import invalidJsonStringify, { ruleId as invalidJsonStringifyRuleId } from './invalid-json-stringify';
16
+ import noDuplicatedImports, { ruleId as noDuplicatedImportsRuleId } from './no-duplicated-imports';
16
17
  import noFixture, { ruleId as noFixtureRuleId } from './agent/no-fixture';
17
18
  import noFullResponse, { ruleId as noFullResponseRuleId } from './agent/no-full-response';
18
19
  import noMappedResponse, { ruleId as noMappedResponseRuleId } from './agent/no-mapped-response';
19
20
  import noPromiseInstanceMethod, { ruleId as noPromiseInstanceMethodRuleId } from './no-promise-instance-method';
20
21
  import noServiceWrapper, { ruleId as noServiceWrapperRuleId } from './agent/no-service-wrapper';
21
22
  import noStatusCode, { ruleId as noStatusCodeRuleId } from './agent/no-status-code';
23
+ import requireFixedServicesImport, {
24
+ ruleId as requireFixedServicesImportRuleId,
25
+ } from './require-fixed-services-import';
22
26
  import requireResolveFullResponse, {
23
27
  ruleId as requireResolveFullResponseRuleId,
24
28
  } from './require-resolve-full-response';
29
+ import requireTypeOutOfTypeOnlyImports, {
30
+ ruleId as requireTypeOutOfTypeOnlyImportsRuleId,
31
+ } from './require-type-out-of-type-only-imports';
25
32
  import filePathComment from './file-path-comment';
26
33
  import noCardNumbers from './no-card-numbers';
27
34
  import noTestImport from './no-test-import';
@@ -55,6 +62,9 @@ export default {
55
62
  [noFullResponseRuleId]: noFullResponse,
56
63
  [noMappedResponseRuleId]: noMappedResponse,
57
64
  [requireResolveFullResponseRuleId]: requireResolveFullResponse,
65
+ [noDuplicatedImportsRuleId]: noDuplicatedImports,
66
+ [requireFixedServicesImportRuleId]: requireFixedServicesImport,
67
+ [requireTypeOutOfTypeOnlyImportsRuleId]: requireTypeOutOfTypeOnlyImports,
58
68
  },
59
69
  configs: {
60
70
  all: {
@@ -72,13 +82,9 @@ export default {
72
82
  [`@checkdigit/${noPromiseInstanceMethodRuleId}`]: 'error',
73
83
  [`@checkdigit/${noFullResponseRuleId}`]: 'error',
74
84
  [`@checkdigit/${requireResolveFullResponseRuleId}`]: 'error',
75
- [`@checkdigit/${addUrlDomainRuleId}`]: 'off',
76
- [`@checkdigit/${noFixtureRuleId}`]: 'off',
77
- [`@checkdigit/${noServiceWrapperRuleId}`]: 'off',
78
- [`@checkdigit/${noStatusCodeRuleId}`]: 'off',
79
- [`@checkdigit/${fetchResponseBodyJsonRuleId}`]: 'off',
80
- [`@checkdigit/${fetchResponseHeaderGetterRuleId}`]: 'off',
81
- [`@checkdigit/${fetchThenRuleId}`]: 'off',
85
+ [`@checkdigit/${noDuplicatedImportsRuleId}`]: 'error',
86
+ [`@checkdigit/${requireFixedServicesImportRuleId}`]: 'error',
87
+ [`@checkdigit/${requireTypeOutOfTypeOnlyImportsRuleId}`]: 'error',
82
88
  },
83
89
  },
84
90
  recommended: {
@@ -103,8 +109,6 @@ export default {
103
109
  },
104
110
  ],
105
111
  rules: {
106
- [`@checkdigit/${noFullResponseRuleId}`]: 'error',
107
- [`@checkdigit/${requireResolveFullResponseRuleId}`]: 'error',
108
112
  [`@checkdigit/${noMappedResponseRuleId}`]: 'error',
109
113
  [`@checkdigit/${addUrlDomainRuleId}`]: 'error',
110
114
  [`@checkdigit/${noFixtureRuleId}`]: 'error',
@@ -118,8 +122,6 @@ export default {
118
122
  'agent-phase-2-production': {
119
123
  ignorePatterns: ['*.spec.ts', '*.test.ts'],
120
124
  rules: {
121
- [`@checkdigit/${noFullResponseRuleId}`]: 'error',
122
- [`@checkdigit/${requireResolveFullResponseRuleId}`]: 'error',
123
125
  [`@checkdigit/${noMappedResponseRuleId}`]: 'error',
124
126
  [`@checkdigit/${addUrlDomainRuleId}`]: 'error',
125
127
  [`@checkdigit/${noFixtureRuleId}`]: 'off',
@@ -1,4 +1,4 @@
1
- // format.ts
1
+ // library/format.ts
2
2
 
3
3
  /*
4
4
  * Copyright (c) 2021-2024 Check Digit, LLC
@@ -1,4 +1,4 @@
1
- // tree.ts
1
+ // library/tree.ts
2
2
 
3
3
  /*
4
4
  * Copyright (c) 2021-2024 Check Digit, LLC
@@ -1,4 +1,4 @@
1
- // tree.ts
1
+ // library/ts-tree.ts
2
2
 
3
3
  /*
4
4
  * Copyright (c) 2021-2024 Check Digit, LLC
@@ -1,4 +1,4 @@
1
- // fixture/variable.ts
1
+ // library/variable.ts
2
2
 
3
3
  export function isValidPropertyName(name: unknown) {
4
4
  return typeof name === 'string' && /^[a-zA-Z_$][a-zA-Z_$0-9]*$/u.test(name);
@@ -0,0 +1,116 @@
1
+ // no-duplicated-imports.ts
2
+
3
+ /*
4
+ * Copyright (c) 2021-2024 Check Digit, LLC
5
+ *
6
+ * This code is licensed under the MIT license (see LICENSE.txt for details).
7
+ */
8
+
9
+ import { ESLintUtils, TSESTree } from '@typescript-eslint/utils';
10
+ import { strict as assert } from 'node:assert';
11
+ import getDocumentationUrl from './get-documentation-url';
12
+
13
+ export const ruleId = 'no-duplicated-imports';
14
+
15
+ const createRule = ESLintUtils.RuleCreator((name) => getDocumentationUrl(name));
16
+
17
+ const rule = createRule({
18
+ name: ruleId,
19
+ meta: {
20
+ type: 'suggestion',
21
+ docs: {
22
+ description: 'Merge duplicated import statements with the same "from".',
23
+ },
24
+ messages: {
25
+ mergeDuplicatedImports: 'Merge duplicated import statements with the same "from".',
26
+ },
27
+ fixable: 'code',
28
+ schema: [],
29
+ },
30
+ defaultOptions: [],
31
+ create(context) {
32
+ const sourceCode = context.sourceCode;
33
+ const importDeclarations = new Map<string, TSESTree.ImportDeclaration[]>();
34
+
35
+ return {
36
+ ImportDeclaration(node) {
37
+ const moduleName = node.source.value;
38
+ let declarations = importDeclarations.get(moduleName);
39
+ if (declarations === undefined) {
40
+ declarations = [];
41
+ importDeclarations.set(moduleName, declarations);
42
+ }
43
+ declarations.push(node);
44
+ },
45
+ 'Program:exit'() {
46
+ for (const [moduleName, declarations] of importDeclarations.entries()) {
47
+ if (declarations.length <= 1) {
48
+ continue;
49
+ }
50
+
51
+ const firstDeclaration = declarations[0];
52
+ assert.ok(firstDeclaration);
53
+
54
+ const isAllTypeOnly = declarations.every(
55
+ (declaration) =>
56
+ declaration.importKind === 'type' ||
57
+ declaration.specifiers.every(
58
+ (specifier) =>
59
+ specifier.type === TSESTree.AST_NODE_TYPES.ImportSpecifier && specifier.importKind === 'type',
60
+ ),
61
+ );
62
+
63
+ context.report({
64
+ messageId: 'mergeDuplicatedImports',
65
+ node: firstDeclaration,
66
+ fix(fixer) {
67
+ const fixes = [];
68
+
69
+ const defaultSpecifier = declarations
70
+ .flatMap((declaration) =>
71
+ declaration.specifiers.map((specifier) =>
72
+ specifier.type === TSESTree.AST_NODE_TYPES.ImportDefaultSpecifier ? specifier : undefined,
73
+ ),
74
+ )
75
+ .filter(Boolean);
76
+ const defaultSpecifierText = defaultSpecifier[0] ? sourceCode.getText(defaultSpecifier[0]) : undefined;
77
+
78
+ const mergedSpecifiers = declarations.flatMap((declaration) => {
79
+ const isCurrentDeclarationTypeOnly =
80
+ declaration.importKind === 'type' ||
81
+ declaration.specifiers.every(
82
+ (specifier) =>
83
+ specifier.type === TSESTree.AST_NODE_TYPES.ImportSpecifier && specifier.importKind === 'type',
84
+ );
85
+ return declaration.specifiers
86
+ .filter((specifier) => specifier.type !== TSESTree.AST_NODE_TYPES.ImportDefaultSpecifier)
87
+ .map((specifier) =>
88
+ // eslint-disable-next-line no-nested-ternary
89
+ isAllTypeOnly
90
+ ? sourceCode.getText(specifier).replace('type ', '')
91
+ : isCurrentDeclarationTypeOnly
92
+ ? `type ${sourceCode.getText(specifier)}`
93
+ : sourceCode.getText(specifier),
94
+ );
95
+ });
96
+ const mergedSpecifiersText = `${isAllTypeOnly ? 'type ' : ''}{ ${mergedSpecifiers.join(', ')} }`;
97
+
98
+ // Replace the first import with the merged import
99
+ const mergedImport = `import ${[defaultSpecifierText, mergedSpecifiersText].filter(Boolean).join(', ')} from '${moduleName}';`;
100
+ fixes.push(fixer.replaceText(firstDeclaration, mergedImport));
101
+
102
+ // Remove the remaining imports
103
+ declarations.slice(1).forEach((declaration) => {
104
+ fixes.push(fixer.removeRange([declaration.range[0], declaration.range[1] + 1]));
105
+ });
106
+
107
+ return fixes;
108
+ },
109
+ });
110
+ }
111
+ },
112
+ };
113
+ },
114
+ });
115
+
116
+ export default rule;
@@ -0,0 +1,52 @@
1
+ // require-fixed-services-import.ts
2
+
3
+ /*
4
+ * Copyright (c) 2021-2024 Check Digit, LLC
5
+ *
6
+ * This code is licensed under the MIT license (see LICENSE.txt for details).
7
+ */
8
+
9
+ import { ESLintUtils } from '@typescript-eslint/utils';
10
+ import getDocumentationUrl from './get-documentation-url';
11
+
12
+ export const ruleId = 'require-fixed-services-import';
13
+
14
+ const createRule = ESLintUtils.RuleCreator((name) => getDocumentationUrl(name));
15
+ const SERVICE_TYPINGS_IMPORT_PATH_PREFIX = /(?<path>\.\.\/)+services\/.*/u;
16
+
17
+ const rule = createRule({
18
+ name: ruleId,
19
+ meta: {
20
+ type: 'suggestion',
21
+ docs: {
22
+ description: 'Require fixed "from" with service typing imports from "src/services".',
23
+ },
24
+ messages: {
25
+ updateServicesImportFrom: 'Update service typing imports to be from the fixed "src/services" path.',
26
+ },
27
+ fixable: 'code',
28
+ schema: [],
29
+ },
30
+ defaultOptions: [],
31
+ create(context) {
32
+ return {
33
+ ImportDeclaration(node) {
34
+ const moduleName = node.source.value;
35
+ if (SERVICE_TYPINGS_IMPORT_PATH_PREFIX.test(moduleName)) {
36
+ context.report({
37
+ messageId: 'updateServicesImportFrom',
38
+ node: node.source,
39
+ *fix(fixer) {
40
+ yield fixer.replaceText(
41
+ node.source,
42
+ `'${moduleName.slice(0, moduleName.indexOf('../services') + '../services'.length)}'`,
43
+ );
44
+ },
45
+ });
46
+ }
47
+ },
48
+ };
49
+ },
50
+ });
51
+
52
+ export default rule;
@@ -0,0 +1,63 @@
1
+ // require-type-out-of-type-only-imports.ts
2
+
3
+ /*
4
+ * Copyright (c) 2021-2024 Check Digit, LLC
5
+ *
6
+ * This code is licensed under the MIT license (see LICENSE.txt for details).
7
+ */
8
+
9
+ import { ESLintUtils, TSESTree } from '@typescript-eslint/utils';
10
+ import getDocumentationUrl from './get-documentation-url';
11
+
12
+ export const ruleId = 'require-type-out-of-type-only-imports';
13
+
14
+ const createRule = ESLintUtils.RuleCreator((name) => getDocumentationUrl(name));
15
+
16
+ const rule = createRule({
17
+ name: ruleId,
18
+ meta: {
19
+ type: 'suggestion',
20
+ docs: {
21
+ description: 'Require "type" to be out side of type-only imports.',
22
+ },
23
+ messages: {
24
+ moveTypeOutside: 'Update the type-only imports to use "tpe" outside of the curly braces.',
25
+ },
26
+ fixable: 'code',
27
+ schema: [],
28
+ },
29
+ defaultOptions: [],
30
+ create(context) {
31
+ const sourceCode = context.sourceCode;
32
+
33
+ return {
34
+ ImportDeclaration(declaration) {
35
+ if (
36
+ declaration.importKind === 'type' ||
37
+ !declaration.specifiers.every(
38
+ (specifier) =>
39
+ specifier.type === TSESTree.AST_NODE_TYPES.ImportSpecifier && specifier.importKind === 'type',
40
+ )
41
+ ) {
42
+ return;
43
+ }
44
+
45
+ context.report({
46
+ messageId: 'moveTypeOutside',
47
+ node: declaration,
48
+ *fix(fixer) {
49
+ const moduleName = declaration.source.value;
50
+ const mergedSpecifiers = declaration.specifiers
51
+ .filter((specifier) => specifier.type !== TSESTree.AST_NODE_TYPES.ImportDefaultSpecifier)
52
+ .map((specifier) => sourceCode.getText(specifier).replace('type ', ''));
53
+ const updatedImportDeclaration = `import type { ${mergedSpecifiers.join(', ')} } from '${moduleName}';`;
54
+
55
+ yield fixer.replaceText(declaration, updatedImportDeclaration);
56
+ },
57
+ });
58
+ },
59
+ };
60
+ },
61
+ });
62
+
63
+ export default rule;