1 | const {docsUrl} = require('../utilities');
|
2 |
|
3 | module.exports = {
|
4 | meta: {
|
5 | docs: {
|
6 | description: 'Prefer Twine over Bindings as the name for twine imports.',
|
7 | category: 'Best Practices',
|
8 | recommended: false,
|
9 | uri: docsUrl('prefer-twine'),
|
10 | },
|
11 | },
|
12 |
|
13 | create(context) {
|
14 | return {
|
15 | ImportDeclaration(node) {
|
16 | if (node.source.value !== 'twine') {
|
17 | return;
|
18 | }
|
19 | node.specifiers.forEach((specifier) => {
|
20 | if (specifier.type !== 'ImportDefaultSpecifier') {
|
21 | return;
|
22 | }
|
23 | if (specifier.local.name !== 'Twine') {
|
24 | context.report(
|
25 | node,
|
26 | 'You should use "Twine" as the reference name when importing twine.',
|
27 | );
|
28 | }
|
29 | });
|
30 | },
|
31 | };
|
32 | },
|
33 | };
|