Repository: eslint/eslint
File: tests/lib/rules/id-length.js (JavaScript)

Code before:
        },
        {
            code: "({ prop: o.𐌘 } = {});",
            options: [{ min: 1, max: 1 }],
            languageOptions: {
                ecmaVersion: 6
            }
        }
    ],
    invalid: [
        { code: "var x = 1;", errors: [tooShortError] },
        { code: "var x;", errors: [tooShortError] },
        { code: "obj.e = document.body;", errors: [tooShortError] },
        { code: "function x() {};", errors: [tooShortError] },
        { code: "function xyz(a) {};", errors: [tooShortError] },
        { code: "var obj = { a: 1, bc: 2 };", errors: [tooShortError] },
        { code: "try { blah(); } catch (e) { /* pass */ }", errors: [tooShortError] },
        { code: "var handler = function (e) {};", errors: [tooShortError] },
        { code: "for (var i=0; i < 10; i++) { console.log(i); }", errors: [tooShortError] },
        { code: "var j=0; while (j > -10) { console.log(--j); }", errors: [tooShortError] },
        { code: "var [i] = arr;", languageOptions: { ecmaVersion: 6 }, errors: [tooShortError] },
        { code: "var [,i,a] = arr;", languageOptions: { ecmaVersion: 6 }, errors: [tooShortError, tooShortError] },
        { code: "function foo([a]) {}", languageOptions: { ecmaVersion: 6 }, errors: [tooShortError] },
        { code: "import x from 'module';", languageOptions: { ecmaVersion: 6 }, errors: [tooShortError] },
        { code: "import * as x from 'module';", languageOptions: { ecmaVersion: 6 }, errors: [tooShortError] },
        { code: "import { x } from 'module';", languageOptions: { ecmaVersion: 6 }, errors: [tooShortError] },
        {
            code: "import longName from 'module';",
            options: [{ max: 5 }],
            languageOptions: { ecmaVersion: 6 },
            errors: [tooLongError]
        },
        {
            code: "import * as longName from 'module';",
            options: [{ max: 5 }],
            languageOptions: { ecmaVersion: 6 },
            errors: [tooLongError]
        },
        {
            code: "import { longName } from 'module';",
            options: [{ max: 5 }],
            languageOptions: { ecmaVersion: 6 },
            errors: [tooLongError]
        },
        {
            code: "var _$xt_$ = Foo(42)",
            options: [{ min: 2, max: 4 }],
            errors: [
                tooLongError
            ]
        },

Review comment (suggestion):
```suggestion
        { code: "import x from 'module';", languageOptions: { ecmaVersion: 6 }, errors: [tooShortError] },
        { code: "import * as x from 'module';", languageOptions: { ecmaVersion: 6 }, errors: [tooShortError] },
```

Code after:
            }
        },
        {
            code: "({ prop: o.𐌘 } = {});",
            options: [{ min: 1, max: 1 }],
            languageOptions: {
                ecmaVersion: 6
            }
        }
    ],
    invalid: [
        { code: "var x = 1;", errors: [tooShortError] },
        { code: "var x;", errors: [tooShortError] },
        { code: "obj.e = document.body;", errors: [tooShortError] },
        { code: "function x() {};", errors: [tooShortError] },
        { code: "function xyz(a) {};", errors: [tooShortError] },
        { code: "var obj = { a: 1, bc: 2 };", errors: [tooShortError] },
        { code: "try { blah(); } catch (e) { /* pass */ }", errors: [tooShortError] },
        { code: "var handler = function (e) {};", errors: [tooShortError] },
        { code: "for (var i=0; i < 10; i++) { console.log(i); }", errors: [tooShortError] },
        { code: "var j=0; while (j > -10) { console.log(--j); }", errors: [tooShortError] },
        { code: "var [i] = arr;", languageOptions: { ecmaVersion: 6 }, errors: [tooShortError] },
        { code: "var [,i,a] = arr;", languageOptions: { ecmaVersion: 6 }, errors: [tooShortError, tooShortError] },
        { code: "function foo([a]) {}", languageOptions: { ecmaVersion: 6 }, errors: [tooShortError] },
        { code: "import x from 'module';", languageOptions: { ecmaVersion: 6 }, errors: [tooShortError] },
        { code: "import * as x from 'module';", languageOptions: { ecmaVersion: 6 }, errors: [tooShortError] },
        {
            code: "import longName from 'module';",
            options: [{ max: 5 }],
            languageOptions: { ecmaVersion: 6 },
            errors: [tooLongError]
        },
        {
            code: "import * as longName from 'module';",
            options: [{ max: 5 }],
            languageOptions: { ecmaVersion: 6 },
            errors: [tooLongError]
        },
        {
            code: "var _$xt_$ = Foo(42)",
            options: [{ min: 2, max: 4 }],
            errors: [
                tooLongError
            ]
        },
        {
            code: "var _$x$_t$ = Foo(42)",
            options: [{ min: 2, max: 4 }],
            errors: [
                tooLongError
            ]