eslint-plugin-crisp 1.7.16 → 1.7.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -56,6 +56,13 @@ Each item has emojis denoting:
56
56
 
57
57
  ### Rules
58
58
 
59
+ #### General TS rules
60
+
61
+ | Name | Description | 🟠 | 🟢 | 🟣 |
62
+ | :- | :- | :- | :- | :- |
63
+ | [@typescript-eslint/await-thenable](https://typescript-eslint.io/rules/await-thenable) | Disallows awaiting a value that is not thenable | | | 🟣 |
64
+ | [@typescript-eslint/no-unused-vars](https://typescript-eslint.io/rules/no-unused-vars) | Disallows unused variables | | | 🟣 |
65
+
59
66
  #### General JS rules
60
67
 
61
68
  | Name | Description | 🟠 | 🟢 | 🟣 |
@@ -76,10 +83,10 @@ Each item has emojis denoting:
76
83
  | [eol-last](https://eslint.org/docs/latest/rules/eol-last) | Requires newline at the end of files | 🟠 | 🟢 | 🟣 |
77
84
  | [for-direction](https://eslint.org/docs/latest/rules/for-direction) | Prevents for-loops to have stop condition that can never be reached | 🟠 | 🟢 | 🟣 |
78
85
  | [indent](https://eslint.org/docs/latest/rules/indent) | Enforces 2-space indentation, and specific indentation levels for some nodes | 🟠 | 🟢 | 🟣 |
79
- | [key-spacing](https://eslint.org/docs/latest/rules/key-spacing) | Enforces consistent spacing in object literal properties (no space between the key and the colon, one space between the colon and the value) | | 🟢 | 🟣 |
86
+ | [key-spacing](https://eslint.org/docs/latest/rules/key-spacing) | Enforces consistent spacing in object literal properties (no space between the key and the colon, one space between the colon and the value) | 🟠 | 🟢 | 🟣 |
80
87
  | [keyword-spacing](https://eslint.org/docs/latest/rules/keyword-spacing) | Enforces consistent spacing before and after keywords | 🟠 | 🟢 | 🟣 |
81
88
  | [linebreak-style](https://eslint.org/docs/latest/rules/linebreak-style) | Enforces Unix-style line endings | 🟠 | 🟢 | 🟣 |
82
- | [max-len](https://eslint.org/docs/latest/rules/max-len) | Enforces a maximum line length of 80 / 100 characters (`@import`, `@typedef` and `@property` lines are ignored) | 🟠 | 🟢 | 🟣 |
89
+ | [max-len](https://eslint.org/docs/latest/rules/max-len) | Enforces a maximum line length of 100 characters (`@import`, `@typedef` and `@property` lines are ignored) | 🟠 | | 🟣 |
83
90
  | [newline-per-chained-call](https://eslint.org/docs/latest/rules/newline-per-chained-call) | Requires a newline after each call in a method chain | | 🟢 | 🟣 |
84
91
  | [no-console](https://eslint.org/docs/latest/rules/no-console) | Disallows the use of `console` | 🟠 | 🟢 | 🟣 |
85
92
  | [no-debugger](https://eslint.org/docs/latest/rules/no-debugger) | Disallows the use of `debugger` | 🟠 | 🟢 | 🟣 |
@@ -87,14 +94,14 @@ Each item has emojis denoting:
87
94
  | [no-implicit-coercion](https://eslint.org/docs/latest/rules/no-implicit-coercion) | Disallows short notations for type conversion | | 🟢 | 🟣 |
88
95
  | [no-magic-numbers](https://eslint.org/docs/latest/rules/no-magic-numbers) | Disallows magic numbers (except the ones in the context of array indexes and in default value assignments) | 🟠 |
89
96
  | [no-multi-str](https://eslint.org/docs/latest/rules/no-multi-str) | Disallows multiline strings | 🟠 | 🟢 | 🟣 |
97
+ | [no-multi-spaces](https://eslint.org/docs/latest/rules/no-multi-spaces) | Disallows multiple consecutive spaces except for indentation | 🟠 | | |
90
98
  | [no-multiple-empty-lines](https://eslint.org/docs/latest/rules/no-multiple-empty-lines) | Allows a maximum of 1 consecutive empty lines | | 🟢 | 🟣 |
91
99
  | [no-mixed-spaces-and-tabs](https://eslint.org/docs/latest/rules/no-mixed-spaces-and-tabs) | Disallows mixed spaces and tabs for indentation | 🟠 | 🟢 | 🟣 |
92
100
  | [no-restricted-syntax](https://eslint.org/docs/latest/rules/no-restricted-syntax) | Enforces `switch` `case`'s content to be enclosed in braces | | 🟢 | 🟣 |
93
- | [no-restricted-syntax](https://eslint.org/docs/latest/rules/no-restricted-syntax) | Enforces `watch` watchers to use the object form with a `handler` function | | 🟢 | |
94
101
  | [no-tabs](https://eslint.org/docs/latest/rules/no-tabs) | Disallows tabs | 🟠 | 🟢 | 🟣 |
95
102
  | [no-trailing-spaces](https://eslint.org/docs/latest/rules/no-trailing-spaces) | Disallows trailing whitespace at the end of lines | 🟠 | 🟢 | 🟣 |
96
103
  | [no-undef](https://eslint.org/docs/latest/rules/no-undef) | Disallows use of undeclared variables | 🟠 | 🟢 | 🟣 |
97
- | [no-unused-vars](https://eslint.org/docs/latest/rules/no-unused-vars) | Disallows unused variables | 🟠 | 🟢 | 🟣 |
104
+ | [no-unused-vars](https://eslint.org/docs/latest/rules/no-unused-vars) | Disallows unused variables | 🟠 | 🟢 | |
98
105
  | [no-unsafe-optional-chaining](https://eslint.org/docs/latest/rules/no-unsafe-optional-chaining) | Disallows use of optional chaining in contexts where the `undefined` value is not allowed | 🟠 | 🟢 | 🟣 |
99
106
  | [object-curly-newline](https://eslint.org/docs/latest/rules/object-curly-newline) | Requires line breaks after opening and before closing braces | 🟠 | 🟢 | 🟣 |
100
107
  | [object-curly-spacing](https://eslint.org/docs/latest/rules/object-curly-spacing) | Requires spacing inside of braces | 🟠 | 🟢 | 🟣 |
@@ -117,25 +124,24 @@ Each item has emojis denoting:
117
124
  | :- | :- | :- | :- | :- |
118
125
  | [crisp/align-comments](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/align-comments.js) | Enforces alignment of comments compared to the previous line (the `indent` rule doesn't check this case) | 🟠 | 🟢 | 🟣 |
119
126
  | [crisp/consecutive-line-comments](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/consecutive-line-comments.js) | Enforces consecutive single-line comments to form a single multi-line continuation block | 🟠 | 🟢 | 🟣 |
120
- | [crisp/align-consecutive-class-assignements](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/align-consecutive-class-assignements.js) | Enforces alignment of consecutive assignment statements in a class constructor | 🟠 |
121
- | [crisp/align-one-var](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/align-one-var.js) | Enforces alignment of variables in 'one-var' statements | 🟠 |
122
- | [crisp/align-requires](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/align-requires.js) | Enforces alignment of require statements | 🟠 |
123
127
  | [crisp/arrow-block-newline](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/arrow-block-newline.js) | Requires a newline after `{` in arrow function blocks | 🟠 | 🟢 | 🟣 |
124
- | [crisp/const](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/const.js) | Enforces that `const` variables start with `__` or are all uppercase | 🟠 |
128
+ | [crisp/const](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/const.js) | Enforces that `const` variables start with `__` or are all uppercase | 🟠 | 🟢 | |
125
129
  | [crisp/constructor-variables](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/constructor-variables.js) | Ensures all class properties in the constructor start with `_` | 🟠 |
126
130
  | [crisp/enforce-optional](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/enforce-optional.js) | Enforces use of optional chaining | 🟠 | 🟢 | 🟣 |
127
131
  | [crisp/header-check](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/header-check.js) | Enforces files to start with Crisp header | 🟠 | 🟢 | 🟣 |
128
132
  | [crisp/header-comments-check](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/header-comments-check.js) | Enforces different comment blocks before different groups (imports, constants and instances) | 🟠 | 🟢 | 🟣 |
129
133
  | [crisp/import-group-comment](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/import-group-comment.js) | Ensures `import` statements are preceded by a comment stating their type | | 🟢 | 🟣 |
130
134
  | [crisp/import-group-order](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/import-group-order.js) | Ensures `import` statements are correctly ordered | | 🟢 | 🟣 |
131
- | [crisp/logger-arguments](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/logger-arguments.js) | Requires static logger messages and reference-only interpolation arguments | 🟠 | 🟢 | 🟣 |
135
+ | [crisp/logger-arguments](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/logger-arguments.js) | Requires static logger messages and reference-only interpolation arguments | 🟠 | | 🟣 |
132
136
  | [crisp/methods-naming](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/methods-naming.js) | Ensures methods are named according to their access (`public`, `private`, `protected`) | 🟠 | 🟢 | 🟣 |
133
137
  | [crisp/methods-ordering](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/methods-ordering.js) | Ensures methods order according to their access: `public` then `protected` then `private` | 🟠 | 🟢 | 🟣 |
134
138
  | [crisp/multiline-comment-end-backslash](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/multiline-comment-end-backslash.js) | Enforces multiline comments to end with a backslash | 🟠 | 🟢 | 🟣 |
135
139
  | [crisp/newline-after-switch-case](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/newline-after-switch-case.js) | Requires newline between switch cases | 🟠 | 🟢 | 🟣 |
136
140
  | [crisp/no-async](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/no-async.js) | Disallows the use of `async/syntax`, in favor of `Promise` | 🟠 | 🟢 |
141
+ | [crisp/no-extra-line-within-function](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/no-extra-line-within-function.js) | Allows at most one empty line between declarations within functions | 🟠 | 🟢 | 🟣 |
142
+ | [crisp/no-inline-function-in-ternary](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/no-inline-function-in-ternary.js) | Disallows inline functions in ternary branches | 🟠 | 🟢 | 🟣 |
137
143
  | [crisp/no-short-parameters](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/no-short-parameters.js) | Disallows one-character parameter names | 🟠 | 🟢 | 🟣 |
138
- | [crisp/no-space-in-optional-arguments](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/no-space-in-optional-arguments.js) | Disallows space before or after `=` in optional parameters | 🟠 |
144
+ | [crisp/no-space-in-default-parameters](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/no-space-in-default-parameters.js) | Disallows space before or after `=` in default parameters | 🟠 |
139
145
  | [crisp/no-snake-case](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/no-snake-case.js) | Disallows snake_case | | 🟢 | 🟣 |
140
146
  | [crisp/no-useless-template-literals](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/no-useless-template-literals.js) | Disallows unnecessary use of template literals | | 🟢 | 🟣 |
141
147
  | [crisp/no-var-in-blocks](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/no-var-in-blocks.js) | Disallows `var` declarations inside function, method, or class block | 🟠 | 🟢 | 🟣 |
@@ -151,6 +157,8 @@ Each item has emojis denoting:
151
157
  | Name | Description | 🟠 | 🟢 | 🟣 |
152
158
  | :- | :- | :- | :- | :- |
153
159
  | [jsdoc/no-undefined-types](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-undefined-types.md) | Rule is **disabled** to allow some undefined types | 🟠 |
160
+ | [jsdoc/reject-any-type](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/reject-any-type.md) | Rule is **disabled** to allow the `any` type | 🟠 | 🟢 | |
161
+ | [jsdoc/reject-function-type](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/reject-function-type.md) | Rule is **disabled** to allow the `Function` type | 🟠 | 🟢 | |
154
162
  | [jsdoc/no-types](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-types.md) | Disallows types in JSDoc tags, relying on the TypeScript signature instead | | | 🟣 |
155
163
  | [jsdoc/require-description](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-description.md) | Requires all functions to have a description in their JSDoc | | 🟢 | 🟣 |
156
164
  | [jsdoc/require-param](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-param.md) | Rule is **disabled** as TS functions are self documented | | | 🟣 |
@@ -158,13 +166,13 @@ Each item has emojis denoting:
158
166
  | [jsdoc/require-param-description](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-param-description.md) | Rule is **disabled** as we don't write any description for `@param` tags | 🟠 | 🟢 | 🟣 |
159
167
  | [jsdoc/check-param-names](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-param-names.md) | Rule is **disabled** as TS functions are self documented | | | 🟣 |
160
168
  | [jsdoc/require-property-description](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-property-description.md) | Rule is **disabled** as we don't write any description for `@property` tags | 🟠 | 🟢 | 🟣 |
161
- | [jsdoc/require-returns](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns.md) | Rule is **disabled** as TS functions are self documented | | | 🟣 |
169
+ | [jsdoc/require-returns](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns.md) | Rule is **disabled** to allow functions without a `@return` tag | 🟠 | 🟢 | 🟣 |
162
170
  | [jsdoc/require-returns-type](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-type.md) | Rule is **disabled** as types come from the TypeScript signature | | | 🟣 |
163
171
  | [jsdoc/require-returns-check](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-check.md) | Rule is **disabled** as we don't write `@returns` tags | | | 🟣 |
164
172
  | [jsdoc/require-yields](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-yields.md) | Rule is **disabled** as TS functions are self documented | | | 🟣 |
165
173
  | [jsdoc/require-yields-check](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-yields-check.md) | Rule is **disabled** as we don't write `@yields` tags | | | 🟣 |
166
174
  | [jsdoc/require-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-jsdoc.md) | Enforces JSDoc comments on functions and classes | 🟠 | 🟢 | 🟣 |
167
- | [jsdoc/sort-tags](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/sort-tags.md) | Enforces specific order for tags | 🟠 | 🟢 | 🟣 |
175
+ | [jsdoc/sort-tags](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/sort-tags.md) | Enforces specific order for tags | 🟠 | 🟢 | |
168
176
 
169
177
  #### Crisp JSDoc rules
170
178
 
@@ -173,6 +181,7 @@ Each item has emojis denoting:
173
181
  | [crisp/jsdoc-align-params](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/jsdoc-align-params.js) | Enforces various alignments | 🟠 | 🟢 |
174
182
  | [crisp/jsdoc-check-indentation](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/jsdoc-check-indentation.js) | Enforces consistent indentation | 🟠 | 🟢 |
175
183
  | [crisp/jsdoc-check-optional-params](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/jsdoc-check-optional-params.js) | Requires optional parameters to be surrounded by brackets | | 🟢 |
184
+ | [crisp/jsdoc-description-multiline](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/jsdoc-description-multiline.js) | Enforces multiline formatting for function JSDoc descriptions | | | 🟣 |
176
185
  | [crisp/jsdoc-enforce-access](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/jsdoc-enforce-access.js) | Requires one of `@public`, `@private`, or `@protected` for functions | | 🟢 |
177
186
  | [crisp/jsdoc-enforce-classdesc](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/jsdoc-enforce-classdesc.js) | Ensures JSDoc for class headers to include a non-empty `@classdesc` | 🟠 | 🟢 |
178
187
  | [crisp/jsdoc-require-description-uppercase](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/jsdoc-require-description-uppercase.js) | Requires descriptions to start with an uppercase character | 🟠 | 🟢 |
@@ -225,6 +234,7 @@ Each item has emojis denoting:
225
234
  | [crisp/vue-class-attribute-last](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-class-attribute-last.js) | Enforces `class` to be the last attribute holding a value, and `:class` to be the last bound attribute | | 🟢 |
226
235
  | [crisp/vue-class-shorthand-max-len](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-class-shorthand-max-len.js) | Requires a multiline `:class` array when Pug class shorthand exceeds 100 characters | | 🟢 |
227
236
  | [crisp/vue-computed-order](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-computed-order.js) | Ensures computed properties are alphabetically ordered | | 🟢 |
237
+ | [crisp/vue-data-comment](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-data-comment.js) | Requires a comment as the first line of a Vue `data()` return object | | 🟢 | |
228
238
  | [crisp/vue-define-component](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-define-component.js) | Enforces mixins and components to use the `defineComponent` wrapper | | 🟢 |
229
239
  | [crisp/vue-emits-order](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-emits-order.js) | Ensures emits properties are alphabetically ordered | | 🟢 |
230
240
  | [crisp/vue-event-listener-jsdoc](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-event-listener-jsdoc.js) | Requires event listener method JSDoc descriptions to start with `Triggers on` | | 🟢 |
@@ -233,14 +243,17 @@ Each item has emojis denoting:
233
243
  | [crisp/vue-html-indent](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-html-indent.js) | Enforces consistent indentation in `template` (supports for Pug) | | 🟢 |
234
244
  | [crisp/vue-html-quotes](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-html-quotes.js) | Enforces HTML attributes to be enclosed with double quotes | | 🟢 |
235
245
  | [crisp/vue-methods-separator](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-methods-separator.js) | Requires method section comments to be ordered as actions, helpers, then event listeners | | 🟢 |
246
+ | [crisp/vue-name-prop](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-name-prop.js) | Requires form component `name` props to be lowercase snake case | | 🟢 | |
236
247
  | [crisp/vue-no-component-class-shorthand](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-no-component-class-shorthand.js) | Disallows Pug class shorthand on Vue components | | 🟢 |
237
248
  | [crisp/vue-no-mixed-class](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-no-mixed-class.js) | Disallows using both `class` and `:class` on the same element | | 🟢 |
249
+ | [crisp/vue-no-mixed-class-shorthand](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-no-mixed-class-shorthand.js) | Disallows mixing Pug class shorthand and class attributes | | 🟢 | |
238
250
  | [crisp/vue-no-name-option](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-no-name-option.js) | Disallows explicit component names in Vue single-file components | | 🟢 |
239
251
  | [crisp/vue-no-regex-data](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-no-regex-data.js) | Disallows regular expressions to be declared in Vue data object | | 🟢 |
240
252
  | [crisp/vue-props-declaration-line-break](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-props-declaration-line-break.js) | Enforces line break between type and default function in prop definition | | 🟢 |
241
253
  | [crisp/vue-props-declaration-multiline](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-props-declaration-multiline.js) | Enforces props declarations to be multiline | | 🟢 |
242
254
  | [crisp/vue-props-declaration-order](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-props-declaration-order.js) | Ensures props declarations are alphabetically ordered | | 🟢 |
243
255
  | [crisp/vue-ref-case](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-ref-case.js) | Enforces `ref` attributes to snake case | | 🟢 |
256
+ | [crisp/vue-watch-handler](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-watch-handler.js) | Requires Vue watchers to use the object form with a valid `handler` function | | 🟢 | |
244
257
 
245
258
  ## License
246
259
 
package/index.js CHANGED
@@ -3,9 +3,6 @@ import configRecommendedVue from "./recommended-vue.js";
3
3
  import configRecommendedTS from "./recommended-ts.js";
4
4
 
5
5
  import ruleAlignComments from "./rules/align-comments.js";
6
- import ruleAlignConsecutiveClassAssignements from "./rules/align-consecutive-class-assignements.js";
7
- import ruleAlignOneVar from "./rules/align-one-var.js";
8
- import ruleAlignRequires from "./rules/align-requires.js";
9
6
  import ruleArrowBlockNewline from "./rules/arrow-block-newline.js";
10
7
  import ruleConsecutiveLineComments from "./rules/consecutive-line-comments.js";
11
8
  import ruleConst from "./rules/const.js";
@@ -32,7 +29,7 @@ import ruleNewlineAfterSwitchCase from "./rules/newline-after-switch-case.js";
32
29
  import ruleNoAsync from "./rules/no-async.js";
33
30
  import ruleNoExtraLineWithinFunction from "./rules/no-extra-line-within-function.js";
34
31
  import ruleNoInlineFunctionInTernary from "./rules/no-inline-function-in-ternary.js";
35
- import ruleNoSpaceInOptionalArguments from "./rules/no-space-in-optional-arguments.js";
32
+ import ruleNoSpaceInDefaultParameters from "./rules/no-space-in-default-parameters.js";
36
33
  import ruleNoUselessTemplateLiterals from "./rules/no-useless-template-literals.js";
37
34
  import ruleNoVarInBlocks from "./rules/no-var-in-blocks.js";
38
35
  import ruleNoShortParameters from "./rules/no-short-parameters.js";
@@ -84,9 +81,6 @@ const plugin = {
84
81
 
85
82
  rules: {
86
83
  "align-comments": ruleAlignComments,
87
- "align-consecutive-class-assignements": ruleAlignConsecutiveClassAssignements,
88
- "align-one-var": ruleAlignOneVar,
89
- "align-requires": ruleAlignRequires,
90
84
  "arrow-block-newline": ruleArrowBlockNewline,
91
85
  "consecutive-line-comments": ruleConsecutiveLineComments,
92
86
  "const": ruleConst,
@@ -113,7 +107,7 @@ const plugin = {
113
107
  "no-async": ruleNoAsync,
114
108
  "no-extra-line-within-function": ruleNoExtraLineWithinFunction,
115
109
  "no-inline-function-in-ternary": ruleNoInlineFunctionInTernary,
116
- "no-space-in-optional-arguments": ruleNoSpaceInOptionalArguments,
110
+ "no-space-in-default-parameters": ruleNoSpaceInDefaultParameters,
117
111
  "no-var-in-blocks": ruleNoVarInBlocks,
118
112
  "no-useless-template-literals": ruleNoUselessTemplateLiterals,
119
113
  "no-short-parameters": ruleNoShortParameters,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-crisp",
3
- "version": "1.7.16",
3
+ "version": "1.7.17",
4
4
  "description": "Custom ESLint Rules for Crisp",
5
5
  "author": "Crisp IM SAS",
6
6
  "main": "index.js",
package/recommended-ts.js CHANGED
@@ -96,6 +96,7 @@ export default function configRecommendedTS(pluginCrisp) {
96
96
  "no-eval": "error",
97
97
  "no-implicit-coercion": "error",
98
98
  "no-multi-str": "error",
99
+ "no-multi-spaces": "error",
99
100
  "no-multiple-empty-lines": ["error", { max: 1 }],
100
101
  "no-mixed-spaces-and-tabs": "error",
101
102
  "no-restricted-syntax": [
@@ -102,6 +102,7 @@ export default function configRecommendedVue(pluginCrisp) {
102
102
  "no-eval": "error",
103
103
  "no-implicit-coercion": "error",
104
104
  "no-multi-str": "error",
105
+ "no-multi-spaces": "error",
105
106
  "no-multiple-empty-lines": ["error", { max: 1 }],
106
107
  "no-mixed-spaces-and-tabs": "error",
107
108
  "no-restricted-syntax": [
package/recommended.js CHANGED
@@ -89,6 +89,7 @@ export default function configRecommended(pluginCrisp) {
89
89
  ]
90
90
  }
91
91
  ],
92
+ "key-spacing": ["error", { "beforeColon": false, "afterColon": true }],
92
93
  "keyword-spacing": "error",
93
94
  "linebreak-style": ["error", "unix"],
94
95
  "max-len": ["error", {
@@ -108,6 +109,7 @@ export default function configRecommended(pluginCrisp) {
108
109
  }
109
110
  ],
110
111
  "no-multi-str": "error",
112
+ "no-multi-spaces": "error",
111
113
  "no-mixed-spaces-and-tabs": "error",
112
114
  "no-tabs": "error",
113
115
  "no-trailing-spaces": "error",
@@ -156,9 +158,6 @@ export default function configRecommended(pluginCrisp) {
156
158
  // Crisp JS rules
157
159
  "crisp/align-comments": "error",
158
160
  "crisp/consecutive-line-comments": "error",
159
- "crisp/align-consecutive-class-assignements": "error",
160
- "crisp/align-one-var": "error",
161
- "crisp/align-requires": "error",
162
161
  "crisp/arrow-block-newline": "error",
163
162
  "crisp/const": "error",
164
163
  "crisp/constructor-variables": "error",
@@ -181,8 +180,14 @@ export default function configRecommended(pluginCrisp) {
181
180
  "exceptions": ["_", "$"]
182
181
  }
183
182
  ],
184
- "crisp/no-space-in-optional-arguments": "error",
185
- "crisp/one-space-after-operator": "error",
183
+ "crisp/no-space-in-default-parameters": "error",
184
+ "crisp/one-space-after-operator": [
185
+ "error",
186
+
187
+ {
188
+ "checkColon": false
189
+ }
190
+ ],
186
191
  "crisp/regex-in-constructor": "error",
187
192
  "crisp/ternary-parenthesis": "error",
188
193
  "crisp/two-lines-between-class-members": "error",
@@ -13,7 +13,7 @@ export default {
13
13
  ) {
14
14
  context.report({
15
15
  node,
16
- message: "There should be no space before or after = in optional parameters"
16
+ message: "There should be no space before or after = in default parameters"
17
17
  });
18
18
  }
19
19
  }
@@ -1,9 +1,9 @@
1
- import rule from "../../rules/no-space-in-optional-arguments.js";
1
+ import rule from "../../rules/no-space-in-default-parameters.js";
2
2
  import createRuleTester from "../rule-tester.js";
3
3
 
4
4
  const ruleTester = createRuleTester();
5
5
 
6
- ruleTester.run("no-space-in-optional-arguments", rule, {
6
+ ruleTester.run("no-space-in-default-parameters", rule, {
7
7
  valid: [
8
8
  "function greet(name=\"World\") {}",
9
9
  "const greet = (name=\"World\") => name;",
@@ -16,7 +16,7 @@ ruleTester.run("no-space-in-optional-arguments", rule, {
16
16
  code: "function greet(name =\"World\") {}",
17
17
  errors: [
18
18
  {
19
- message: "There should be no space before or after = in optional parameters"
19
+ message: "There should be no space before or after = in default parameters"
20
20
  }
21
21
  ]
22
22
  },
@@ -24,7 +24,7 @@ ruleTester.run("no-space-in-optional-arguments", rule, {
24
24
  code: "const greet = (name= \"World\") => name;",
25
25
  errors: [
26
26
  {
27
- message: "There should be no space before or after = in optional parameters"
27
+ message: "There should be no space before or after = in default parameters"
28
28
  }
29
29
  ]
30
30
  },
@@ -32,7 +32,7 @@ ruleTester.run("no-space-in-optional-arguments", rule, {
32
32
  code: "class Greeter { greet(name = \"World\") {} }",
33
33
  errors: [
34
34
  {
35
- message: "There should be no space before or after = in optional parameters"
35
+ message: "There should be no space before or after = in default parameters"
36
36
  }
37
37
  ]
38
38
  }
@@ -1,76 +0,0 @@
1
- export default {
2
- meta: {
3
- type: "problem",
4
- docs: {
5
- description: "align consecutive assignment statements in a class",
6
- category: "Stylistic Issues",
7
- recommended: false,
8
- },
9
- fixable: null,
10
- schema: [],
11
- },
12
-
13
- create: function (context) {
14
- let sourceCode = context.sourceCode;
15
- let currentBlock = [];
16
- let maxColumn = 0;
17
-
18
- function reportMisalignedAssignments(assignments, maxColumn) {
19
- assignments.forEach(node => {
20
- let alignmentColumn = sourceCode.getText(node).indexOf("=") + node.loc.start.column;
21
- if (alignmentColumn < maxColumn) {
22
- context.report({
23
- node: node,
24
- message: `Assignment of '${sourceCode.getText(node.left).trim()}' at line ${node.loc.start.line} column ${alignmentColumn + 1} should be aligned at column ${maxColumn + 1}`,
25
- });
26
- }
27
- });
28
- }
29
-
30
- function handleAssignmentExpression(node) {
31
- // Ensure we're only dealing with assignments directly in constructors
32
- if (!node.parent || node.parent.type !== "ExpressionStatement" ||
33
- !node.parent.parent || node.parent.parent.type !== "BlockStatement" ||
34
- !node.parent.parent.parent || node.parent.parent.parent.type !== "FunctionExpression" ||
35
- !node.parent.parent.parent.parent || node.parent.parent.parent.parent.type !== "MethodDefinition" ||
36
- node.parent.parent.parent.parent.kind !== "constructor") {
37
- return;
38
- }
39
-
40
- if (currentBlock.length > 0) {
41
- const prevNode = currentBlock[currentBlock.length - 1];
42
-
43
- if (prevNode.loc.end.line !== node.loc.start.line - 1) {
44
- if (currentBlock.length > 1) {
45
- reportMisalignedAssignments(currentBlock, maxColumn);
46
- }
47
-
48
- currentBlock = [];
49
- maxColumn = 0;
50
- }
51
- }
52
-
53
- currentBlock.push(node);
54
- let currentAssignmentColumn = sourceCode.getText(node).indexOf("=") + node.loc.start.column;
55
- maxColumn = Math.max(maxColumn, currentAssignmentColumn);
56
- }
57
-
58
-
59
- return {
60
- AssignmentExpression: handleAssignmentExpression,
61
- "MethodDefinition:exit": function () {
62
- if (currentBlock.length > 1) {
63
- reportMisalignedAssignments(currentBlock, maxColumn);
64
- }
65
-
66
- currentBlock = [];
67
- maxColumn = 0;
68
- },
69
- "Program:exit": function () {
70
- if (currentBlock.length > 1) {
71
- reportMisalignedAssignments(currentBlock, maxColumn);
72
- }
73
- }
74
- };
75
- },
76
- };
@@ -1,70 +0,0 @@
1
- export default {
2
- meta: {
3
- type: "layout",
4
- docs: {
5
- description: "enforce alignment of variables in consecutive 'one-var' statements",
6
- category: "Stylistic Issues",
7
- recommended: false,
8
- },
9
- },
10
- create(context) {
11
- const sourceCode = context.sourceCode;
12
-
13
- return {
14
- VariableDeclaration(node) {
15
- if (node.declarations.length <= 1) {
16
- return;
17
- }
18
-
19
- let assignmentOperatorColumn = null;
20
- let variableNameColumn = null;
21
- let lastDeclarationLine = null;
22
-
23
- for (let i = 0; i < node.declarations.length; i++) {
24
- const declaration = node.declarations[i];
25
-
26
- // If the current declaration is on the same line as the last one, \
27
- // skip it
28
- if (lastDeclarationLine === declaration.loc.start.line) {
29
- continue;
30
- }
31
-
32
- lastDeclarationLine = declaration.loc.start.line;
33
-
34
- const variableNameToken = sourceCode.getFirstToken(declaration);
35
- const variableNameColumnCurrent = variableNameToken.loc.start.column;
36
-
37
- if (variableNameColumn === null) {
38
- variableNameColumn = variableNameColumnCurrent;
39
- } else if (variableNameColumnCurrent !== variableNameColumn) {
40
- context.report({
41
- node: declaration,
42
- message: "Misaligned variable declaration."
43
- });
44
- }
45
-
46
- if (!declaration.init) {
47
- continue; // Skip if there's no assignment
48
- }
49
-
50
- const equalsSignToken = sourceCode.getTokenBefore(declaration.init);
51
-
52
- if (equalsSignToken.value !== "=") {
53
- continue; // Skip if it's not an assignment
54
- }
55
-
56
- const equalsSignColumn = equalsSignToken.loc.start.column;
57
-
58
- if (assignmentOperatorColumn === null) {
59
- assignmentOperatorColumn = equalsSignColumn;
60
- } else if (equalsSignColumn !== assignmentOperatorColumn) {
61
- context.report({
62
- node: declaration,
63
- message: "Misaligned assignment operator."
64
- });
65
- }
66
- }
67
- },
68
- };
69
- },
70
- };
@@ -1,36 +0,0 @@
1
- export default {
2
- meta: {
3
- type: "layout",
4
- docs: {
5
- description: "enforce alignment of require statements",
6
- category: "Stylistic Issues",
7
- recommended: false,
8
- },
9
- fixable: null, // not auto-fixable
10
- },
11
- create(context) {
12
- return {
13
- VariableDeclaration(node) {
14
- const declarations = node.declarations;
15
-
16
- // We only check consecutive VariableDeclarator nodes with 'require' init
17
- let lastColumn = null;
18
-
19
- for (const declaration of declarations) {
20
- if (declaration.init && declaration.init.callee && declaration.init.callee.name === "require") {
21
- if (lastColumn === null) {
22
- lastColumn = declaration.loc.start.column;
23
- } else if (declaration.loc.start.column !== lastColumn) {
24
- context.report({
25
- node: declaration,
26
- message: "Misaligned require statement.",
27
- });
28
- }
29
- } else {
30
- lastColumn = null; // reset for non-require declarations
31
- }
32
- }
33
- },
34
- };
35
- },
36
- };
@@ -1,24 +0,0 @@
1
- import rule from "../../rules/align-consecutive-class-assignements.js";
2
- import createRuleTester from "../rule-tester.js";
3
-
4
- const ruleTester = createRuleTester();
5
-
6
- ruleTester.run("align-consecutive-class-assignements", rule, {
7
- valid: [
8
- "class Example {\n constructor() {\n this.a = 1;\n this.long = 2;\n }\n}",
9
- "class Example {\n constructor() {\n this.a = 1;\n\n this.long = 2;\n }\n}",
10
- "class Example {\n method() {\n this.a = 1;\n this.long = 2;\n }\n}"
11
- ],
12
-
13
- invalid: [
14
- {
15
- code: "class Example {\n constructor() {\n this.a = 1;\n this.long = 2;\n }\n}",
16
- errors: [
17
- {
18
- message:
19
- "Assignment of 'this.a' at line 3 column 12 should be aligned at column 15"
20
- }
21
- ]
22
- }
23
- ]
24
- });
@@ -1,31 +0,0 @@
1
- import rule from "../../rules/align-one-var.js";
2
- import createRuleTester from "../rule-tester.js";
3
-
4
- const ruleTester = createRuleTester();
5
-
6
- ruleTester.run("align-one-var", rule, {
7
- valid: [
8
- "const first = 1,\n next = 2;",
9
- "const first = 1, next = 2;",
10
- "let first,\n next;"
11
- ],
12
-
13
- invalid: [
14
- {
15
- code: "const first = 1,\n next = 2;",
16
- errors: [
17
- {
18
- message: "Misaligned variable declaration."
19
- }
20
- ]
21
- },
22
- {
23
- code: "const first = 1,\n next = 2;",
24
- errors: [
25
- {
26
- message: "Misaligned assignment operator."
27
- }
28
- ]
29
- }
30
- ]
31
- });
@@ -1,27 +0,0 @@
1
- import rule from "../../rules/align-requires.js";
2
- import createRuleTester from "../rule-tester.js";
3
-
4
- const ruleTester = createRuleTester({
5
- languageOptions: {
6
- sourceType: "commonjs"
7
- }
8
- });
9
-
10
- ruleTester.run("align-requires", rule, {
11
- valid: [
12
- "const alpha = require(\"alpha\"),\n beta = require(\"beta\");",
13
- "const alpha = require(\"alpha\");\nconst beta = require(\"beta\");",
14
- "const alpha = require(\"alpha\"), value = 1,\n beta = require(\"beta\");"
15
- ],
16
-
17
- invalid: [
18
- {
19
- code: "const alpha = require(\"alpha\"),\n beta = require(\"beta\");",
20
- errors: [
21
- {
22
- message: "Misaligned require statement."
23
- }
24
- ]
25
- }
26
- ]
27
- });