@@ -66,7 +66,11 @@ ruleTester.run("id-length", rule, {
6666{ code :"export var num = 0;" , languageOptions :{ ecmaVersion :6 , sourceType :"module" } } ,
6767{ code :"import * as something from 'y';" , languageOptions :{ ecmaVersion :6 , sourceType :"module" } } ,
6868{ code :"import { x } from 'y';" , languageOptions :{ ecmaVersion :6 , sourceType :"module" } } ,
69+ { code :"import { x as x } from 'y';" , languageOptions :{ ecmaVersion :6 , sourceType :"module" } } ,
70+ { code :"import { 'x' as x } from 'y';" , languageOptions :{ ecmaVersion :2022 , sourceType :"module" } } ,
71+ { code :"import { x as foo } from 'y';" , languageOptions :{ ecmaVersion :6 , sourceType :"module" } } ,
6972{ code :"import { longName } from 'y';" , options :[ { max :5 } ] , languageOptions :{ ecmaVersion :6 , sourceType :"module" } } ,
73+ { code :"import { x as bar } from 'y';" , options :[ { max :5 } ] , languageOptions :{ ecmaVersion :6 , sourceType :"module" } } ,
7074{ code :"({ prop: obj.x.y.something } = {});" , languageOptions :{ ecmaVersion :6 } } ,
7175{ code :"({ prop: obj.longName } = {});" , languageOptions :{ ecmaVersion :6 } } ,
7276{ code :"var obj = { a: 1, bc: 2 };" , options :[ { properties :"never" } ] } ,
@@ -250,6 +254,9 @@ ruleTester.run("id-length", rule, {
250254{ code :"var [,i,a] = arr;" , languageOptions :{ ecmaVersion :6 } , errors :[ tooShortError , tooShortError ] } ,
251255{ code :"function foo([a]) {}" , languageOptions :{ ecmaVersion :6 } , errors :[ tooShortError ] } ,
252256{ code :"import x from 'module';" , languageOptions :{ ecmaVersion :6 } , errors :[ tooShortError ] } ,
257+ { code :"import { x as z } from 'module';" , languageOptions :{ ecmaVersion :6 } , errors :[ { ...tooShortError , column :15 } ] } ,
258+ { code :"import { foo as z } from 'module';" , languageOptions :{ ecmaVersion :6 } , errors :[ { ...tooShortError , column :17 } ] } ,
259+ { code :"import { 'foo' as z } from 'module';" , languageOptions :{ ecmaVersion :2022 } , errors :[ { ...tooShortError , column :19 } ] } ,
253260{ code :"import * as x from 'module';" , languageOptions :{ ecmaVersion :6 } , errors :[ tooShortError ] } ,
254261{
255262code :"import longName from 'module';" ,
@@ -263,6 +270,12 @@ ruleTester.run("id-length", rule, {
263270languageOptions :{ ecmaVersion :6 } ,
264271errors :[ tooLongError ]
265272} ,
273+ {
274+ code :"import { foo as longName } from 'module';" ,
275+ options :[ { max :5 } ] ,
276+ languageOptions :{ ecmaVersion :6 } ,
277+ errors :[ { ...tooLongError , column :17 } ]
278+ } ,
266279{
267280code :"var _$xt_$ = Foo(42)" ,
268281options :[ { min :2 , max :4 } ] ,