Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Pearce-Ropion committed Jan 13, 2023
1 parent 7d3c615 commit 804dc0e
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tests/src/rules/order.js
Expand Up @@ -2351,6 +2351,47 @@ ruleTester.run('order', rule, {
errors: Array.from({ length: 11 }, () => 'There should be at least one empty line between import groups'),
}),

// rankings that overflow to double-digit ranks
test({
code: `
import external from 'external';
import a from '@namespace/a';
import b from '@namespace/b';
import { parent } from '../../parent';
import local from './local';
import './side-effect';`,
output: `
import external from 'external';
import a from '@namespace/a';
import b from '@namespace/b';
import { parent } from '../../parent';
import local from './local';
import './side-effect';`,
options: [
{
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
groups: ['external', 'internal', 'parent', 'sibling'],
'newlines-between': 'always',
pathGroups: [
{ pattern: '@namespace', group: 'external', position: 'after' },
{ pattern: '@namespace/**', group: 'external', position: 'after' },
],
pathGroupsExcludedImportTypes: ['@namespace'],
},
],
errors: [
'There should be at least one empty line between import groups',
'There should be at least one empty line between import groups',
'There should be at least one empty line between import groups',
],
}),

// reorder fix cannot cross non import or require
test(withoutAutofixOutput({
code: `
Expand Down

0 comments on commit 804dc0e

Please sign in to comment.