@atlaskit/eslint-plugin-ui-styling-standard 0.11.5 → 0.12.0

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +11 -7
  3. package/constellation/atlaskit-theme/usage.mdx +113 -0
  4. package/constellation/convert-props-syntax/usage.mdx +32 -22
  5. package/constellation/enforce-style-prop/usage.mdx +21 -18
  6. package/constellation/index/overview.mdx +92 -76
  7. package/constellation/local-cx-xcss/usage.mdx +10 -6
  8. package/constellation/no-array-arguments/usage.mdx +10 -9
  9. package/constellation/no-classname-prop/usage.mdx +7 -4
  10. package/constellation/no-container-queries/usage.mdx +17 -15
  11. package/constellation/no-dynamic-styles/usage.mdx +26 -29
  12. package/constellation/no-exported-styles/usage.mdx +23 -18
  13. package/constellation/no-important-styles/usage.mdx +5 -3
  14. package/constellation/no-imported-style-values/usage.mdx +30 -22
  15. package/constellation/no-nested-selectors/usage.mdx +22 -20
  16. package/constellation/no-unsafe-values/usage.mdx +45 -51
  17. package/constellation/use-compiled/usage.mdx +51 -0
  18. package/dist/cjs/index.codegen.js +1 -1
  19. package/dist/cjs/presets/all.codegen.js +3 -1
  20. package/dist/cjs/presets/recommended.codegen.js +3 -1
  21. package/dist/cjs/rules/atlaskit-theme/index.js +95 -0
  22. package/dist/cjs/rules/index.codegen.js +6 -2
  23. package/dist/cjs/rules/use-compiled/index.js +257 -0
  24. package/dist/cjs/rules/use-compiled/is-safe.js +130 -0
  25. package/dist/cjs/rules/use-compiled/utils.js +26 -0
  26. package/dist/es2019/index.codegen.js +1 -1
  27. package/dist/es2019/presets/all.codegen.js +3 -1
  28. package/dist/es2019/presets/recommended.codegen.js +3 -1
  29. package/dist/es2019/rules/atlaskit-theme/index.js +85 -0
  30. package/dist/es2019/rules/index.codegen.js +6 -2
  31. package/dist/es2019/rules/use-compiled/index.js +182 -0
  32. package/dist/es2019/rules/use-compiled/is-safe.js +118 -0
  33. package/dist/es2019/rules/use-compiled/utils.js +15 -0
  34. package/dist/esm/index.codegen.js +1 -1
  35. package/dist/esm/presets/all.codegen.js +3 -1
  36. package/dist/esm/presets/recommended.codegen.js +3 -1
  37. package/dist/esm/rules/atlaskit-theme/index.js +89 -0
  38. package/dist/esm/rules/index.codegen.js +6 -2
  39. package/dist/esm/rules/use-compiled/index.js +250 -0
  40. package/dist/esm/rules/use-compiled/is-safe.js +121 -0
  41. package/dist/esm/rules/use-compiled/utils.js +17 -0
  42. package/dist/types/index.codegen.d.ts +4 -0
  43. package/dist/types/presets/all.codegen.d.ts +3 -1
  44. package/dist/types/presets/recommended.codegen.d.ts +3 -1
  45. package/dist/types/rules/atlaskit-theme/index.d.ts +3 -0
  46. package/dist/types/rules/index.codegen.d.ts +2 -0
  47. package/dist/types/rules/use-compiled/index.d.ts +3 -0
  48. package/dist/types/rules/use-compiled/is-safe.d.ts +10 -0
  49. package/dist/types/rules/use-compiled/utils.d.ts +6 -0
  50. package/dist/types-ts4.5/index.codegen.d.ts +4 -0
  51. package/dist/types-ts4.5/presets/all.codegen.d.ts +3 -1
  52. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +3 -1
  53. package/dist/types-ts4.5/rules/atlaskit-theme/index.d.ts +3 -0
  54. package/dist/types-ts4.5/rules/index.codegen.d.ts +2 -0
  55. package/dist/types-ts4.5/rules/use-compiled/index.d.ts +3 -0
  56. package/dist/types-ts4.5/rules/use-compiled/is-safe.d.ts +10 -0
  57. package/dist/types-ts4.5/rules/use-compiled/utils.d.ts +6 -0
  58. package/package.json +3 -2
  59. package/src/index.codegen.tsx +3 -3
  60. package/src/presets/all.codegen.tsx +67 -69
  61. package/src/presets/recommended.codegen.tsx +67 -69
  62. package/src/rules/atlaskit-theme/README.md +109 -0
  63. package/src/rules/atlaskit-theme/__tests__/test.ts +122 -0
  64. package/src/rules/atlaskit-theme/index.ts +136 -0
  65. package/src/rules/index.codegen.tsx +17 -13
  66. package/src/rules/use-compiled/README.md +49 -0
  67. package/src/rules/use-compiled/__tests__/can-auto-fix.test.tsx +73 -0
  68. package/src/rules/use-compiled/__tests__/css.test.tsx +126 -0
  69. package/src/rules/use-compiled/__tests__/imports.test.tsx +139 -0
  70. package/src/rules/use-compiled/__tests__/keyframes.test.tsx +140 -0
  71. package/src/rules/use-compiled/__tests__/pragma.test.tsx +108 -0
  72. package/src/rules/use-compiled/__tests__/styled.test.tsx +114 -0
  73. package/src/rules/use-compiled/__tests__/use-compiled.test.tsx +15 -0
  74. package/src/rules/use-compiled/index.tsx +275 -0
  75. package/src/rules/use-compiled/is-safe.tsx +163 -0
  76. package/src/rules/use-compiled/utils.tsx +37 -0
@@ -0,0 +1,114 @@
1
+ import { tester } from '../../__tests__/utils/_tester';
2
+ import rule from '../index';
3
+
4
+ tester.run('styled API - fixable', rule, {
5
+ valid: [],
6
+ invalid: ['@emotion/styled', 'styled-components'].flatMap((importSource) => [
7
+ {
8
+ name: `[${importSource}] styles are a plain object with literal values`,
9
+ code: `
10
+ import styled from '${importSource}';
11
+
12
+ const Component = styled.div({
13
+ color: 'red',
14
+ });
15
+ `,
16
+ output: `
17
+ import { styled } from '@compiled/react';
18
+
19
+ const Component = styled.div({
20
+ color: 'red',
21
+ });
22
+ `,
23
+ errors: [{ messageId: 'use-compiled' }],
24
+ options: [{ canAutoFix: true }],
25
+ },
26
+ ]),
27
+ });
28
+
29
+ /**
30
+ * These test cases have no auto-fix because we are considering
31
+ * them unsafe to automatically convert.
32
+ */
33
+ tester.run('styled API - not fixable', rule, {
34
+ valid: [],
35
+ invalid: ['@emotion/styled', 'styled-components'].flatMap((importSource) => [
36
+ {
37
+ name: `[${importSource}] function as style argument`,
38
+ code: `
39
+ import styled from '${importSource}';
40
+
41
+ const Component = styled.div(() => ({
42
+ color: 'red',
43
+ }));
44
+ `,
45
+ errors: [{ messageId: 'use-compiled' }],
46
+ options: [{ canAutoFix: true }],
47
+ },
48
+ {
49
+ name: `[${importSource}] function as style object value`,
50
+ code: `
51
+ import styled from '${importSource}';
52
+
53
+ const Component = styled.div({
54
+ color: () => 'red',
55
+ });
56
+ `,
57
+ errors: [{ messageId: 'use-compiled' }],
58
+ options: [{ canAutoFix: true }],
59
+ },
60
+ {
61
+ name: `[${importSource}] identifier as style object value`,
62
+ code: `
63
+ import styled from '${importSource}';
64
+
65
+ const textColor = 'red';
66
+ const Component = styled.div({
67
+ color: textColor,
68
+ });
69
+ `,
70
+ errors: [{ messageId: 'use-compiled' }],
71
+ options: [{ canAutoFix: true }],
72
+ },
73
+ {
74
+ /**
75
+ * We could auto-fix this safely but intentionally
76
+ * keeping this rule very simple for now.
77
+ */
78
+ name: `[${importSource}] function call as style object value`,
79
+ code: `
80
+ import styled from '${importSource}';
81
+ import { token } from '@atlaskit/tokens';
82
+
83
+ const Component = styled.div({
84
+ color: token('color.text'),
85
+ });
86
+ `,
87
+ errors: [{ messageId: 'use-compiled' }],
88
+ options: [{ canAutoFix: true }],
89
+ },
90
+ {
91
+ name: `[${importSource}] styled call extends component`,
92
+ code: `
93
+ import styled from '${importSource}';
94
+ import { BaseComponent } from './base-component';
95
+
96
+ const Component = styled(BaseComponent)({});
97
+ `,
98
+ errors: [{ messageId: 'use-compiled' }],
99
+ options: [{ canAutoFix: true }],
100
+ },
101
+ {
102
+ name: `[${importSource}] with unsupported named import`,
103
+ code: `
104
+ import styled, { type CSSObject } from '${importSource}';
105
+
106
+ const Component = styled.div({
107
+ color: 'red',
108
+ });
109
+ `,
110
+ errors: [{ messageId: 'use-compiled' }],
111
+ options: [{ canAutoFix: true }],
112
+ },
113
+ ]),
114
+ });
@@ -0,0 +1,15 @@
1
+ import { tester } from '../../__tests__/utils/_tester';
2
+ import rule from '../index';
3
+
4
+ tester.run('use-compiled', rule, {
5
+ valid: [
6
+ `import { styled } from '@compiled/react';`,
7
+ `import { css } from '@compiled/react';`,
8
+ `import { ClassNames } from '@compiled/react';`,
9
+ `import { css, ClassNames, styled } from '@compiled/react';`,
10
+ `import '@compiled/react'`,
11
+ `/** @jsx jsx */`,
12
+ `/** @jsxImportSource @compiled/react */`,
13
+ ],
14
+ invalid: [],
15
+ });
@@ -0,0 +1,275 @@
1
+ import type { Rule } from 'eslint';
2
+ import {
3
+ identifier,
4
+ importDeclaration,
5
+ importSpecifier,
6
+ literal,
7
+ } from 'eslint-codemod-utils';
8
+ import type * as ESTree from 'eslint-codemod-utils';
9
+ import type { FromSchema, JSONSchema } from 'json-schema-to-ts';
10
+
11
+ import { findVariable } from '@atlaskit/eslint-utils/find-variable';
12
+
13
+ import { createLintRule } from '../utils/create-rule';
14
+ import {
15
+ getFirstImportFromSource,
16
+ isImportDefaultSpecifier,
17
+ isImportNamespaceSpecifier,
18
+ isImportSpecifier,
19
+ } from './utils';
20
+ import { isSafeStyled, isSafeUsage } from './is-safe';
21
+
22
+ const SUPPORTED_EMOTION_IMPORTS = new Set([
23
+ 'css',
24
+ 'keyframes',
25
+ 'ClassNames',
26
+ 'jsx',
27
+ ]);
28
+
29
+ const SUPPORTED_IMPORT_MAP = {
30
+ '@emotion/core': SUPPORTED_EMOTION_IMPORTS,
31
+ '@emotion/react': SUPPORTED_EMOTION_IMPORTS,
32
+ '@emotion/styled': new Set(['default']),
33
+ 'styled-components': new Set(['default', 'css', 'keyframes']),
34
+ };
35
+
36
+ type SupportedImportSource = keyof typeof SUPPORTED_IMPORT_MAP;
37
+
38
+ function isSupportedImportSource(
39
+ importSource: string,
40
+ ): importSource is SupportedImportSource {
41
+ return importSource in SUPPORTED_IMPORT_MAP;
42
+ }
43
+
44
+ const schema = {
45
+ type: 'array',
46
+ items: [
47
+ {
48
+ type: 'object',
49
+ properties: {
50
+ canAutoFix: {
51
+ type: 'boolean',
52
+ },
53
+ },
54
+ additionalProperties: false,
55
+ },
56
+ ],
57
+ } as const satisfies JSONSchema;
58
+
59
+ type Config = {
60
+ canAutoFix: boolean;
61
+ };
62
+
63
+ const defaultConfig: Config = {
64
+ canAutoFix: false,
65
+ };
66
+
67
+ function readConfig(context: Rule.RuleContext): Config {
68
+ const [config] = context.options as FromSchema<typeof schema>;
69
+ return Object.assign({}, defaultConfig, config);
70
+ }
71
+
72
+ export const rule: Rule.RuleModule = createLintRule({
73
+ meta: {
74
+ name: 'use-compiled',
75
+ type: 'problem',
76
+ fixable: 'code',
77
+ docs: {
78
+ description:
79
+ 'Ensures usage of `@compiled/react` instead of other CSS-in-JS libraries',
80
+ recommended: true,
81
+ severity: 'warn',
82
+ },
83
+ messages: {
84
+ 'use-compiled': `Use '@compiled/react' instead of '{{importSource}}'`,
85
+ },
86
+ schema,
87
+ },
88
+ create(context) {
89
+ const config = readConfig(context);
90
+
91
+ return {
92
+ Program() {
93
+ const pragma = context
94
+ .getSourceCode()
95
+ .getAllComments()
96
+ .find((n) => n.value.includes('@jsxImportSource @emotion/react'));
97
+
98
+ if (!pragma) {
99
+ return;
100
+ }
101
+
102
+ context.report({
103
+ messageId: 'use-compiled',
104
+ data: {
105
+ importSource: '@emotion/react',
106
+ },
107
+ loc: pragma.loc!,
108
+ *fix(fixer) {
109
+ if (!config.canAutoFix) {
110
+ return;
111
+ }
112
+
113
+ const importDeclarations = context
114
+ .getSourceCode()
115
+ .ast.body.filter(
116
+ (node): node is ESTree.ImportDeclaration =>
117
+ node.type === 'ImportDeclaration',
118
+ );
119
+
120
+ const hasEmotionImport = importDeclarations.some(
121
+ (importDeclaration) => {
122
+ const importSource = importDeclaration.source.value as string;
123
+ return importSource.startsWith('@emotion/');
124
+ },
125
+ );
126
+ const hasCompiledImport = importDeclarations.some(
127
+ (importDeclaration) =>
128
+ importDeclaration.source.value === '@compiled/react',
129
+ );
130
+
131
+ if (hasEmotionImport || !hasCompiledImport) {
132
+ // Considering this unsafe to auto-fix
133
+ return;
134
+ }
135
+
136
+ yield fixer.replaceText(
137
+ // @ts-expect-error - types don't accept comment nodes
138
+ pragma,
139
+ `/** @jsxImportSource @compiled/react */`,
140
+ );
141
+ },
142
+ });
143
+ },
144
+ ImportDeclaration(node: ESTree.ImportDeclaration) {
145
+ const importSource = node.source.value as string;
146
+ if (!isSupportedImportSource(importSource)) {
147
+ return;
148
+ }
149
+
150
+ context.report({
151
+ node: node.source,
152
+ messageId: 'use-compiled',
153
+ data: {
154
+ importSource,
155
+ },
156
+ *fix(fixer) {
157
+ if (!config.canAutoFix) {
158
+ return;
159
+ }
160
+
161
+ const specifiers = getSpecifiers({ context, node, importSource });
162
+
163
+ if (!specifiers) {
164
+ // Cannot safely auto-fix
165
+ return;
166
+ }
167
+
168
+ yield* fixImport({
169
+ context,
170
+ fixer,
171
+ node,
172
+ specifiers,
173
+ });
174
+ },
175
+ });
176
+ },
177
+ };
178
+ },
179
+ });
180
+
181
+ export default rule;
182
+
183
+ function getSpecifiers({
184
+ context,
185
+ node,
186
+ importSource,
187
+ }: {
188
+ context: Rule.RuleContext;
189
+ node: ESTree.ImportDeclaration;
190
+ importSource: SupportedImportSource;
191
+ }) {
192
+ const supportedImports = SUPPORTED_IMPORT_MAP[importSource];
193
+
194
+ // We aren't supporting namespace imports
195
+ if (node.specifiers.some(isImportNamespaceSpecifier)) {
196
+ return;
197
+ }
198
+
199
+ const defaultSpecifier = node.specifiers.find(isImportDefaultSpecifier);
200
+ if (defaultSpecifier) {
201
+ if (!supportedImports.has('default')) {
202
+ return;
203
+ }
204
+ const styled = findVariable({
205
+ identifier: defaultSpecifier.local,
206
+ sourceCode: context.getSourceCode(),
207
+ });
208
+ if (!styled || !isSafeStyled(styled)) {
209
+ return;
210
+ }
211
+ }
212
+
213
+ const namedSpecifiers = node.specifiers.filter(isImportSpecifier);
214
+ if (
215
+ !namedSpecifiers.every((specifier) =>
216
+ isSafeUsage({
217
+ context,
218
+ specifier,
219
+ supportedImports,
220
+ }),
221
+ )
222
+ ) {
223
+ return;
224
+ }
225
+
226
+ if (defaultSpecifier) {
227
+ return [
228
+ ...namedSpecifiers,
229
+ // ASSUMPTION: the default import, if allowed, is for `styled`
230
+ importSpecifier({
231
+ imported: identifier('styled'),
232
+ local: node.specifiers[0].local,
233
+ }),
234
+ ];
235
+ }
236
+
237
+ return namedSpecifiers;
238
+ }
239
+
240
+ function* fixImport({
241
+ context,
242
+ fixer,
243
+ node,
244
+ specifiers,
245
+ }: {
246
+ context: Rule.RuleContext;
247
+ fixer: Rule.RuleFixer;
248
+ node: ESTree.ImportDeclaration;
249
+ specifiers: ESTree.ImportSpecifier[];
250
+ }): Generator<Rule.Fix> {
251
+ const compiledImport = getFirstImportFromSource(context, '@compiled/react');
252
+
253
+ if (compiledImport) {
254
+ yield fixer.remove(node);
255
+ yield fixer.replaceText(
256
+ compiledImport,
257
+ buildImportDeclaration(
258
+ compiledImport.specifiers.concat(specifiers),
259
+ '@compiled/react',
260
+ ),
261
+ );
262
+ } else {
263
+ yield fixer.replaceText(
264
+ node,
265
+ buildImportDeclaration(specifiers, '@compiled/react'),
266
+ );
267
+ }
268
+ }
269
+
270
+ function buildImportDeclaration(
271
+ specifiers: ESTree.ImportDeclaration['specifiers'],
272
+ source: string,
273
+ ) {
274
+ return `${importDeclaration({ specifiers, source: literal(source) })};`;
275
+ }
@@ -0,0 +1,163 @@
1
+ import type { Rule, Scope } from 'eslint';
2
+ import { closestOfType } from 'eslint-codemod-utils';
3
+ import type * as ESTree from 'eslint-codemod-utils';
4
+
5
+ import { findVariable } from '@atlaskit/eslint-utils/find-variable';
6
+
7
+ export function isSafeUsage({
8
+ context,
9
+ specifier,
10
+ supportedImports,
11
+ }: {
12
+ context: Rule.RuleContext;
13
+ specifier: ESTree.ImportSpecifier;
14
+ supportedImports: Set<string>;
15
+ }): boolean {
16
+ const importName = specifier.imported.name;
17
+
18
+ if (!supportedImports.has(importName)) {
19
+ return false;
20
+ }
21
+
22
+ if (importName === 'css') {
23
+ const css = findVariable({
24
+ identifier: specifier.local,
25
+ sourceCode: context.getSourceCode(),
26
+ });
27
+ return css !== null && isSafeCss(css);
28
+ }
29
+
30
+ if (importName === 'keyframes') {
31
+ const keyframes = findVariable({
32
+ identifier: specifier.local,
33
+ sourceCode: context.getSourceCode(),
34
+ });
35
+ return keyframes !== null && isSafeKeyframes(keyframes);
36
+ }
37
+
38
+ return true;
39
+ }
40
+
41
+ export function isSafeKeyframes(keyframes: Scope.Variable): boolean {
42
+ return keyframes.references.every((ref) => {
43
+ const callExpression = closestOfType(ref.identifier, 'CallExpression');
44
+ if (!callExpression) {
45
+ return false;
46
+ }
47
+
48
+ if (callExpression.callee !== ref.identifier) {
49
+ return false;
50
+ }
51
+
52
+ if (callExpression.arguments.length !== 1) {
53
+ return false;
54
+ }
55
+
56
+ const argument = callExpression.arguments[0];
57
+ if (argument.type !== 'ObjectExpression') {
58
+ return false;
59
+ }
60
+
61
+ return argument.properties.every((property) =>
62
+ isSafeProperty(property, isSafeKeyframePropertyValue),
63
+ );
64
+ });
65
+ }
66
+
67
+ function isSafeKeyframePropertyValue(value: ESTree.Property['value']): boolean {
68
+ if (value.type !== 'ObjectExpression') {
69
+ return false;
70
+ }
71
+ return isSafeStyleObject(value);
72
+ }
73
+
74
+ export function isSafeCss(css: Scope.Variable): boolean {
75
+ return css.references.every((ref) => {
76
+ const callExpression = closestOfType(ref.identifier, 'CallExpression');
77
+ if (!callExpression) {
78
+ return false;
79
+ }
80
+
81
+ if (callExpression.callee !== ref.identifier) {
82
+ return false;
83
+ }
84
+
85
+ return callExpression.arguments.every(isSafeStyleArgument);
86
+ });
87
+ }
88
+
89
+ export function isSafeStyled(styled: Scope.Variable): boolean {
90
+ return styled.references.every((ref) => {
91
+ const callExpression = closestOfType(ref.identifier, 'CallExpression');
92
+ if (!callExpression) {
93
+ return false;
94
+ }
95
+
96
+ /**
97
+ * If it's not in the form `styled.tagName()`
98
+ * then we consider it unsafe to auto-fix.
99
+ */
100
+ if (
101
+ callExpression.callee.type !== 'MemberExpression' ||
102
+ callExpression.callee.object !== ref.identifier
103
+ ) {
104
+ return false;
105
+ }
106
+
107
+ return callExpression.arguments.every(isSafeStyleArgument);
108
+ });
109
+ }
110
+
111
+ /**
112
+ * Determines if a style argument is safe for auto-fix conversion.
113
+ */
114
+ function isSafeStyleArgument(
115
+ arg: ESTree.Expression | ESTree.SpreadElement,
116
+ ): boolean {
117
+ if (arg.type === 'ObjectExpression') {
118
+ return isSafeStyleObject(arg);
119
+ }
120
+
121
+ return false;
122
+ }
123
+
124
+ function isSafeStyleObject(object: ESTree.ObjectExpression): boolean {
125
+ return object.properties.every((property) =>
126
+ isSafeProperty(property, isSafeStyleValue),
127
+ );
128
+ }
129
+
130
+ function isSafeStyleValue(value: ESTree.Expression | ESTree.Pattern): boolean {
131
+ if (value.type === 'Literal') {
132
+ return true;
133
+ }
134
+
135
+ return false;
136
+ }
137
+
138
+ function isSafeProperty(
139
+ property: ESTree.Property | ESTree.SpreadElement,
140
+ isSafePropertyValue: (value: ESTree.Property['value']) => boolean,
141
+ ): boolean {
142
+ if (property.type === 'SpreadElement') {
143
+ return false;
144
+ }
145
+
146
+ if (property.method || property.shorthand || property.kind !== 'init') {
147
+ return false;
148
+ }
149
+
150
+ if (!hasSafeKey(property)) {
151
+ return false;
152
+ }
153
+
154
+ return isSafePropertyValue(property.value);
155
+ }
156
+
157
+ function hasSafeKey(property: ESTree.Property): boolean {
158
+ if (property.computed) {
159
+ return property.key.type === 'Literal';
160
+ }
161
+
162
+ return true;
163
+ }
@@ -0,0 +1,37 @@
1
+ import type { Rule } from 'eslint';
2
+
3
+ import type * as ESTree from 'eslint-codemod-utils';
4
+
5
+ export function getFirstImportFromSource(
6
+ context: Rule.RuleContext,
7
+ source: string,
8
+ ): ESTree.ImportDeclaration | undefined {
9
+ return context
10
+ .getSourceCode()
11
+ .ast.body.filter(isImportDeclaration)
12
+ .find((node) => node.source.value === source);
13
+ }
14
+
15
+ function isImportDeclaration(
16
+ node: ESTree.Node,
17
+ ): node is ESTree.ImportDeclaration {
18
+ return node.type === 'ImportDeclaration';
19
+ }
20
+
21
+ export function isImportSpecifier(
22
+ specifier: ESTree.Node,
23
+ ): specifier is ESTree.ImportSpecifier {
24
+ return specifier.type === 'ImportSpecifier';
25
+ }
26
+
27
+ export function isImportDefaultSpecifier(
28
+ specifier: ESTree.Node,
29
+ ): specifier is ESTree.ImportDefaultSpecifier {
30
+ return specifier.type === 'ImportDefaultSpecifier';
31
+ }
32
+
33
+ export function isImportNamespaceSpecifier(
34
+ specifier: ESTree.Node,
35
+ ): specifier is ESTree.ImportNamespaceSpecifier {
36
+ return specifier.type === 'ImportNamespaceSpecifier';
37
+ }