Skip to content

Commit 563af92

Browse files
committed
type fixes
1 parent 23cfe8e commit 563af92

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

eslint-rules/lib/rules/no-direct-import.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ module.exports = {
3131
try {
3232
const origin = context.options[0].origin;
3333
const destination = context.options[0].destination;
34-
const msg = `Do not import directly from '${origin}'. Please use '${destination}' (autofix available).`;
34+
const message = `Do not import directly from '${origin}'. Please use '${destination}' (autofix available).`;
3535
context.report({
3636
node,
37-
message: `${msg}`,
37+
message,
3838
fix(fixer) {
3939
if (node && destination) {
4040
return fixer.replaceText(node.source, `'${destination}'`);
@@ -46,7 +46,7 @@ module.exports = {
4646
}
4747
}
4848

49-
function checkImportDeclaretion(node) {
49+
function checkImportDeclaration(node) {
5050
const origin = context.options[0].origin;
5151
const source = node.source.value;
5252
if (source && origin && source === origin) {
@@ -55,7 +55,7 @@ module.exports = {
5555
}
5656

5757
return {
58-
ImportDeclaration: node => checkImportDeclaretion(node),
58+
ImportDeclaration: checkImportDeclaration
5959
};
6060
},
6161
};

eslint-rules/tests/lib/rules/no-direct-import.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,21 @@ RuleTester.setDefaultConfig({
1010

1111
const ruleTester = new RuleTester();
1212

13-
const valideExample = `import {Component} from 'another-module';`;
14-
const invalideExample = `import {Component} from 'some-module';`;
13+
const validExample = `import {Component} from 'another-module';`;
14+
const invalidExample = `import {Component} from 'some-module';`;
1515

1616
ruleTester.run('no-direct-import', rule, {
1717
valid: [
1818
{
1919
options: ruleOptions,
20-
code: valideExample,
20+
code: validExample,
2121
},
2222
],
2323
invalid: [
2424
{
2525
options: ruleOptions,
26-
code: invalideExample,
26+
code: invalidExample,
27+
output: `import {Component} from 'another-module';`,
2728
errors: [
2829
{ message: `Do not import directly from 'some-module'. Please use 'another-module' (autofix available).` },
2930
],

0 commit comments

Comments
 (0)