ecmascript-6.d.ts 11.7 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444
import { Linter } from '../index';

export interface ECMAScript6 extends Linter.RulesRecord {
    /**
     * Rule to require braces around arrow function bodies.
     *
     * @since 1.8.0
     * @see https://eslint.org/docs/rules/arrow-body-style
     */
    'arrow-body-style': Linter.RuleEntry<[
        'as-needed',
        Partial<{
            /**
             * @default false
             */
            requireReturnForObjectLiteral: boolean;
        }>
    ]> | Linter.RuleEntry<[
        'always' | 'never'
    ]>;

    /**
     * Rule to require parentheses around arrow function arguments.
     *
     * @since 1.0.0-rc-1
     * @see https://eslint.org/docs/rules/arrow-parens
     */
    'arrow-parens': Linter.RuleEntry<[
        'always'
    ]> | Linter.RuleEntry<[
        'as-needed',
        Partial<{
            /**
             * @default false
             */
            requireForBlockBody: boolean;
        }>
    ]>;

    /**
     * Rule to enforce consistent spacing before and after the arrow in arrow functions.
     *
     * @since 1.0.0-rc-1
     * @see https://eslint.org/docs/rules/arrow-spacing
     */
    'arrow-spacing': Linter.RuleEntry<[]>;

    /**
     * Rule to require `super()` calls in constructors.
     *
     * @remarks
     * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
     *
     * @since 0.24.0
     * @see https://eslint.org/docs/rules/constructor-super
     */
    'constructor-super': Linter.RuleEntry<[]>;

    /**
     * Rule to enforce consistent spacing around `*` operators in generator functions.
     *
     * @since 0.17.0
     * @see https://eslint.org/docs/rules/generator-star-spacing
     */
    'generator-star-spacing': Linter.RuleEntry<[
        Partial<{
            before: boolean;
            after: boolean;
            named: Partial<{
                before: boolean;
                after: boolean;
            }> | 'before' | 'after' | 'both' | 'neither';
            anonymous: Partial<{
                before: boolean;
                after: boolean;
            }> | 'before' | 'after' | 'both' | 'neither';
            method: Partial<{
                before: boolean;
                after: boolean;
            }> | 'before' | 'after' | 'both' | 'neither';
        }> | 'before' | 'after' | 'both' | 'neither'
    ]>;

    /**
     * Rule to disallow reassigning class members.
     *
     * @remarks
     * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
     *
     * @since 1.0.0-rc-1
     * @see https://eslint.org/docs/rules/no-class-assign
     */
    'no-class-assign': Linter.RuleEntry<[]>;

    /**
     * Rule to disallow arrow functions where they could be confused with comparisons.
     *
     * @since 2.0.0-alpha-2
     * @see https://eslint.org/docs/rules/no-confusing-arrow
     */
    'no-confusing-arrow': Linter.RuleEntry<[
        Partial<{
            /**
             * @default true
             */
            allowParens: boolean;
        }>
    ]>;

    /**
     * Rule to disallow reassigning `const` variables.
     *
     * @remarks
     * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
     *
     * @since 1.0.0-rc-1
     * @see https://eslint.org/docs/rules/no-const-assign
     */
    'no-const-assign': Linter.RuleEntry<[]>;

    /**
     * Rule to disallow duplicate class members.
     *
     * @remarks
     * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
     *
     * @since 1.2.0
     * @see https://eslint.org/docs/rules/no-dupe-class-members
     */
    'no-dupe-class-members': Linter.RuleEntry<[]>;

    /**
     * Rule to disallow duplicate module imports.
     *
     * @since 2.5.0
     * @see https://eslint.org/docs/rules/no-duplicate-import
     */
    'no-duplicate-import': Linter.RuleEntry<[
        Partial<{
            /**
             * @default false
             */
            includeExports: boolean;
        }>
    ]>;

    /**
     * Rule to disallow `new` operators with the `Symbol` object.
     *
     * @remarks
     * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
     *
     * @since 2.0.0-beta.1
     * @see https://eslint.org/docs/rules/no-new-symbol
     */
    'no-new-symbol': Linter.RuleEntry<[]>;

    /**
     * Rule to disallow specified modules when loaded by `import`.
     *
     * @since 2.0.0-alpha-1
     * @see https://eslint.org/docs/rules/no-restricted-imports
     */
    'no-restricted-imports': Linter.RuleEntry<[
        ...Array<string | {
            name: string;
            importNames?: string[];
            message?: string;
        } | Partial<{
            paths: Array<string | {
                name: string;
                importNames?: string[];
                message?: string;
            }>;
            patterns: string[];
        }>>
    ]>;

    /**
     * Rule to disallow `this`/`super` before calling `super()` in constructors.
     *
     * @remarks
     * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
     *
     * @since 0.24.0
     * @see https://eslint.org/docs/rules/no-this-before-super
     */
    'no-this-before-super': Linter.RuleEntry<[]>;

    /**
     * Rule to disallow unnecessary computed property keys in object literals.
     *
     * @since 2.9.0
     * @see https://eslint.org/docs/rules/no-useless-computed-key
     */
    'no-useless-computed-key': Linter.RuleEntry<[]>;

    /**
     * Rule to disallow unnecessary constructors.
     *
     * @since 2.0.0-beta.1
     * @see https://eslint.org/docs/rules/no-useless-constructor
     */
    'no-useless-constructor': Linter.RuleEntry<[]>;

    /**
     * Rule to disallow renaming import, export, and destructured assignments to the same name.
     *
     * @since 2.11.0
     * @see https://eslint.org/docs/rules/no-useless-rename
     */
    'no-useless-rename': Linter.RuleEntry<[
        Partial<{
            /**
             * @default false
             */
            ignoreImport: boolean;
            /**
             * @default false
             */
            ignoreExport: boolean;
            /**
             * @default false
             */
            ignoreDestructuring: boolean;
        }>
    ]>;

    /**
     * Rule to require `let` or `const` instead of `var`.
     *
     * @since 0.12.0
     * @see https://eslint.org/docs/rules/no-var
     */
    'no-var': Linter.RuleEntry<[]>;

    /**
     * Rule to require or disallow method and property shorthand syntax for object literals.
     *
     * @since 0.20.0
     * @see https://eslint.org/docs/rules/object-shorthand
     */
    'object-shorthand': Linter.RuleEntry<[
        'always' | 'methods',
        Partial<{
            /**
             * @default false
             */
            avoidQuotes: boolean;
            /**
             * @default false
             */
            ignoreConstructors: boolean;
            /**
             * @default false
             */
            avoidExplicitReturnArrows: boolean;
        }>
    ]> | Linter.RuleEntry<[
        'properties',
        Partial<{
            /**
             * @default false
             */
            avoidQuotes: boolean;
        }>
    ]> | Linter.RuleEntry<[
        'never' | 'consistent' | 'consistent-as-needed'
    ]>;

    /**
     * Rule to require using arrow functions for callbacks.
     *
     * @since 1.2.0
     * @see https://eslint.org/docs/rules/prefer-arrow-callback
     */
    'prefer-arrow-callback': Linter.RuleEntry<[
        Partial<{
            /**
             * @default false
             */
            allowNamedFunctions: boolean;
            /**
             * @default true
             */
            allowUnboundThis: boolean;
        }>
    ]>;

    /**
     * Rule to require `const` declarations for variables that are never reassigned after declared.
     *
     * @since 0.23.0
     * @see https://eslint.org/docs/rules/prefer-const
     */
    'prefer-const': Linter.RuleEntry<[
        Partial<{
            /**
             * @default 'any'
             */
            destructuring: 'any' | 'all';
            /**
             * @default false
             */
            ignoreReadBeforeAssign: boolean;
        }>
    ]>;

    /**
     * Rule to require destructuring from arrays and/or objects.
     *
     * @since 3.13.0
     * @see https://eslint.org/docs/rules/prefer-destructuring
     */
    'prefer-destructuring': Linter.RuleEntry<[
        Partial<{
            VariableDeclarator: Partial<{
                array: boolean;
                object: boolean;
            }>;
            AssignmentExpression: Partial<{
                array: boolean;
                object: boolean;
            }>;
        } | {
            array: boolean;
            object: boolean;
        }>,
        Partial<{
            enforceForRenamedProperties: boolean;
        }>
    ]>;

    /**
     * Rule to disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals.
     *
     * @since 3.5.0
     * @see https://eslint.org/docs/rules/prefer-numeric-literals
     */
    'prefer-numeric-literals': Linter.RuleEntry<[]>;

    /**
     * Rule to require rest parameters instead of `arguments`.
     *
     * @since 2.0.0-alpha-1
     * @see https://eslint.org/docs/rules/prefer-rest-params
     */
    'prefer-rest-params': Linter.RuleEntry<[]>;

    /**
     * Rule to require spread operators instead of `.apply()`.
     *
     * @since 1.0.0-rc-1
     * @see https://eslint.org/docs/rules/prefer-spread
     */
    'prefer-spread': Linter.RuleEntry<[]>;

    /**
     * Rule to require template literals instead of string concatenation.
     *
     * @since 1.2.0
     * @see https://eslint.org/docs/rules/prefer-template
     */
    'prefer-template': Linter.RuleEntry<[]>;

    /**
     * Rule to require generator functions to contain `yield`.
     *
     * @remarks
     * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
     *
     * @since 1.0.0-rc-1
     * @see https://eslint.org/docs/rules/require-yield
     */
    'require-yield': Linter.RuleEntry<[]>;

    /**
     * Rule to enforce spacing between rest and spread operators and their expressions.
     *
     * @since 2.12.0
     * @see https://eslint.org/docs/rules/rest-spread-spacing
     */
    'rest-spread-spacing': Linter.RuleEntry<[
        'never' | 'always'
    ]>;

    /**
     * Rule to enforce sorted import declarations within modules.
     *
     * @since 2.0.0-beta.1
     * @see https://eslint.org/docs/rules/sort-imports
     */
    'sort-imports': Linter.RuleEntry<[
        Partial<{
            /**
             * @default false
             */
            ignoreCase: boolean;
            /**
             * @default false
             */
            ignoreDeclarationSort: boolean;
            /**
             * @default false
             */
            ignoreMemberSort: boolean;
            /**
             * @default ['none', 'all', 'multiple', 'single']
             */
            memberSyntaxSortOrder: Array<'none' | 'all' | 'multiple' | 'single'>;
        }>
    ]>;

    /**
     * Rule to require symbol descriptions.
     *
     * @since 3.4.0
     * @see https://eslint.org/docs/rules/symbol-description
     */
    'symbol-description': Linter.RuleEntry<[]>;

    /**
     * Rule to require or disallow spacing around embedded expressions of template strings.
     *
     * @since 2.0.0-rc.0
     * @see https://eslint.org/docs/rules/template-curly-spacing
     */
    'template-curly-spacing': Linter.RuleEntry<[
        'never' | 'always'
    ]>;

    /**
     * Rule to require or disallow spacing around the `*` in `yield*` expressions.
     *
     * @since 2.0.0-alpha-1
     * @see https://eslint.org/docs/rules/yield-star-spacing
     */
    'yield-star-spacing': Linter.RuleEntry<[
        Partial<{
            before: boolean;
            after: boolean;
        }> | 'before' | 'after' | 'both' | 'neither'
    ]>;
}