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

Code before:
        { 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 { x as z } 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: "import { foo 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
            ]
        },
        {
            code: "var toString;",
            options: [{ max: 5 }],
            errors: [
                tooLongError
            ]
        },
        {
            code: "(a) => { a * a };",
            languageOptions: { ecmaVersion: 6 },

Review comment (suggestion):
```suggestion
            errors: [{ ...tooLongError, column: 17 }]
```

Code after:
        { 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 { x as z } from 'module';", languageOptions: { ecmaVersion: 6 }, errors: [{ ...tooShortError, column: 15 }] },
        { code: "import { foo as z } from 'module';", languageOptions: { ecmaVersion: 6 }, errors: [{ ...tooShortError, column: 17 }] },
        { code: "import { 'foo' as z } from 'module';", languageOptions: { ecmaVersion: 2022 }, errors: [{ ...tooShortError, column: 19 }] },
        { 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: "import { foo as longName } from 'module';",
            options: [{ max: 5 }],
            languageOptions: { ecmaVersion: 6 },
            errors: [{ ...tooLongError, column: 17 }]
        },
        {
            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
            ]
        },
        {
            code: "var toString;",
            options: [{ max: 5 }],
            errors: [
                tooLongError
            ]
        },