|
| 1 | +import type { RuleConfig } from '../rule-config'; |
| 2 | + |
| 3 | +/** |
| 4 | + * Option. |
| 5 | + */ |
| 6 | +export type MaxLenOption = { |
| 7 | + /** |
| 8 | + * Enforces a maximum line length. |
| 9 | + * |
| 10 | + * @default 80 |
| 11 | + * |
| 12 | + * @see [code](https://eslint.org/docs/rules/max-len#code) |
| 13 | + */ |
| 14 | + code?: number; |
| 15 | + /** |
| 16 | + * Specifies the character width for tab characters. |
| 17 | + * |
| 18 | + * @default 4 |
| 19 | + * |
| 20 | + * @see [tabWidth](https://eslint.org/docs/rules/max-len#tabwidth) |
| 21 | + */ |
| 22 | + tabWidth?: number; |
| 23 | + /** |
| 24 | + * Enforces a maximum line length for comments. |
| 25 | + * |
| 26 | + * @default - to value of code. |
| 27 | + * |
| 28 | + * @see [comments](https://eslint.org/docs/rules/max-len#comments) |
| 29 | + */ |
| 30 | + comments?: number; |
| 31 | + /** |
| 32 | + * Ignores lines matching a regular expression |
| 33 | + * |
| 34 | + * Can only match a single line and need to be double escaped when written in YAML or JSON. |
| 35 | + * |
| 36 | + * @see [ignorePattern](https://eslint.org/docs/rules/max-len#ignorepattern) |
| 37 | + */ |
| 38 | + ignorePattern?: string; |
| 39 | + /** |
| 40 | + * Ignores all trailing comments and comments on their own line. |
| 41 | + * |
| 42 | + * @default true |
| 43 | + * |
| 44 | + * @see [ignoreComments](https://eslint.org/docs/rules/max-len#ignorecomments) |
| 45 | + */ |
| 46 | + ignoreComments?: boolean; |
| 47 | + /** |
| 48 | + * Ignores only trailing comments. |
| 49 | + * |
| 50 | + * @default true |
| 51 | + * |
| 52 | + * @see [ignoreTrailingComments](https://eslint.org/docs/rules/max-len#ignoretrailingcomments) |
| 53 | + */ |
| 54 | + ignoreTrailingComments?: boolean; |
| 55 | + /** |
| 56 | + * Ignores lines that contain a URL. |
| 57 | + * |
| 58 | + * @default true |
| 59 | + * |
| 60 | + * @see [ignoreUrls](https://eslint.org/docs/rules/max-len#ignoreurls) |
| 61 | + */ |
| 62 | + ignoreUrls?: boolean; |
| 63 | + /** |
| 64 | + * Ignores lines that contain a double-quoted or single-quoted string. |
| 65 | + * |
| 66 | + * @default true |
| 67 | + * |
| 68 | + * @see [ignoreStrings](https://eslint.org/docs/rules/max-len#ignorestrings) |
| 69 | + */ |
| 70 | + ignoreStrings?: boolean; |
| 71 | + /** |
| 72 | + * Ignores lines that contain a template literal. |
| 73 | + * |
| 74 | + * @default true |
| 75 | + * |
| 76 | + * @see [ignoreTemplateLiterals](https://eslint.org/docs/rules/max-len#ignoretemplateliterals) |
| 77 | + */ |
| 78 | + ignoreTemplateLiterals?: boolean; |
| 79 | + /** |
| 80 | + * Ignores lines that contain a RegExp literal. |
| 81 | + * |
| 82 | + * @default true |
| 83 | + * |
| 84 | + * @see [ignoreRegExpLiterals](https://eslint.org/docs/rules/max-len#ignoreregexpliterals) |
| 85 | + */ |
| 86 | + ignoreRegExpLiterals?: boolean; |
| 87 | +}; |
| 88 | + |
| 89 | +/** |
| 90 | + * Options. |
| 91 | + */ |
| 92 | +export type MaxLenOptions = [MaxLenOption?]; |
| 93 | + |
| 94 | +/** |
| 95 | + * Enforce a maximum line length. |
| 96 | + * |
| 97 | + * @see [max-len](https://eslint.org/docs/rules/max-len) |
| 98 | + */ |
| 99 | +export type MaxLenRuleConfig = RuleConfig<MaxLenOptions>; |
| 100 | + |
| 101 | +/** |
| 102 | + * Enforce a maximum line length. |
| 103 | + * |
| 104 | + * @see [max-len](https://eslint.org/docs/rules/max-len) |
| 105 | + */ |
| 106 | +export interface MaxLenRule { |
| 107 | + /** |
| 108 | + * Enforce a maximum line length. |
| 109 | + * |
| 110 | + * @see [max-len](https://eslint.org/docs/rules/max-len) |
| 111 | + */ |
| 112 | + 'max-len': MaxLenRuleConfig; |
| 113 | +} |
0 commit comments