Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions tests/src/rules/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,55 @@ ruleTester.run('order', rule, {
],
}),
]),

// Internal modules
test({
code: `
var path = require('path');
var async = require('async');
var internalMod = require('internalMods/myMod');
var secondInternalMod = require('~/myMod2');
var parent = require('../parent');
var sibling = require('./foo');
var index = require('./');
`,
options: [{ groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
] }],
}),
// Internal modules with newlines
test({
code: `
var path = require('path');

var async = require('async');

var internalMod = require('internalMods/myMod');
var secondInternalMod = require('~/myMod2');

var parent = require('../parent');

var sibling = require('./foo');

var index = require('./');
`,
options: [{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
],
'newlines-between': 'always',
}],
}),
],
invalid: [
// builtin before external module (require)
Expand Down Expand Up @@ -2706,6 +2755,36 @@ context('TypeScript', function () {
},
],
}),

// Internal modules
test({
code: `
var path = require('path');
var async = require('async');
var internalMod = require('internalMods/myMod');
var parent = require('../parent');
var secondInternalMod = require('~/myMod2');
var sibling = require('./foo');
var index = require('./');
`,
options: [
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
],
},
],
errors: [
{
message: '`~/myMod2` import should occur before import of `../parent`',
},
],
}),
],
});
});
Expand Down