Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
epidemian
GitHub Repository: epidemian/eslint-plugin-import
Path: blob/main/src/rules/no-named-default.js
829 views
1
import docsUrl from '../docsUrl';
2
3
module.exports = {
4
meta: {
5
type: 'suggestion',
6
docs: {
7
url: docsUrl('no-named-default'),
8
},
9
schema: [],
10
},
11
12
create(context) {
13
return {
14
'ImportDeclaration': function (node) {
15
node.specifiers.forEach(function (im) {
16
if (im.importKind === 'type' || im.importKind === 'typeof') {
17
return;
18
}
19
20
if (im.type === 'ImportSpecifier' && im.imported.name === 'default') {
21
context.report({
22
node: im.local,
23
message: `Use default import syntax to import '${im.local.name}'.` });
24
}
25
});
26
},
27
};
28
},
29
};
30
31