eslint-plugin-crisp 1.0.70 → 1.0.72
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 +139 -115
- package/index.js +1 -0
- package/package.json +1 -1
- package/recommended-vue.js +1 -0
- package/rules/import-group-comment.js +17 -0
- package/rules/import-group-order.js +132 -0
package/README.md
CHANGED
|
@@ -36,138 +36,162 @@ Each item has emojis denoting:
|
|
|
36
36
|
* 🟢: enabled in `plugin:crisp/recommended-vue`
|
|
37
37
|
|
|
38
38
|
### Configurations
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
|
|
40
|
+
| Name | Description | 🟠 | 🟢 |
|
|
41
|
+
| :- | :- | :- | :- |
|
|
42
|
+
| [eslint:recommended](https://github.com/eslint/eslint) | Core ESLint rules | | 🟢 |
|
|
43
|
+
| [plugin:jsdoc/recommended](https://github.com/gajus/eslint-plugin-jsdoc) | JSDoc linting rules | 🟠 | 🟢 |
|
|
44
|
+
| [plugin:vue/vue3-recommended](https://github.com/vuejs/eslint-plugin-vue) | Vue.js 3 linting rules | | 🟢 |
|
|
45
|
+
| [plugin:vue-pug/vue3-recommended](https://github.com/gajus/eslint-plugin-jsdoc) | Pug templates support for Vue.js linting rules | | 🟢 |
|
|
43
46
|
|
|
44
47
|
### Plugins
|
|
45
|
-
|
|
48
|
+
|
|
49
|
+
| Name | Description | 🟠 | 🟢 |
|
|
50
|
+
| :- | :- | :- | :- |
|
|
51
|
+
| [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) | JSDoc linting rules for ESLint | 🟠 | 🟢 |
|
|
46
52
|
|
|
47
53
|
### Rules
|
|
48
54
|
|
|
49
55
|
#### General JS rules
|
|
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
|
-
|
|
56
|
+
|
|
57
|
+
| Name | Description | 🟠 | 🟢 |
|
|
58
|
+
| :- | :- | :- | :- |
|
|
59
|
+
| [arrow-parens](https://eslint.org/docs/latest/rules/arrow-parens) | Requires parentheses around arrow function arguments | 🟠 | 🟢 |
|
|
60
|
+
| [brace-style](https://eslint.org/docs/latest/rules/brace-style) | Enforces one true brace style for blocks | 🟠 | 🟢 |
|
|
61
|
+
| [comma-dangle](https://eslint.org/docs/latest/rules/comma-dangle) | Disallows trailing commas | 🟠 | 🟢 |
|
|
62
|
+
| [comma-style](https://eslint.org/docs/latest/rules/comma-style) | Requires a comma after and on the same line | 🟠 | 🟢 |
|
|
63
|
+
| [curly](https://eslint.org/docs/latest/rules/curly) | Ensures block statements are always wrapped in curly braces | 🟠 | 🟢 |
|
|
64
|
+
| [computed-property-spacing](https://eslint.org/docs/latest/rules/computed-property-spacing) | Disallows spaces inside computed property brackets | | 🟢 |
|
|
65
|
+
| [default-param-last](https://eslint.org/docs/latest/rules/default-param-last) | Enforces default parameters to be last | 🟠 | 🟢 |
|
|
66
|
+
| [default-case-last](https://eslint.org/docs/latest/rules/default-case-last) | Enforces default clauses in switch statements to be last | 🟠 | 🟢 |
|
|
67
|
+
| [dot-notation](https://eslint.org/docs/latest/rules/dot-notation) | Enforces dot notation instead of square-bracket notation | 🟠 | 🟢 |
|
|
68
|
+
| [eqeqeq](https://eslint.org/docs/latest/rules/eqeqeq) | Requires the use of `===` and `!==` | 🟠 | 🟢 |
|
|
69
|
+
| [eol-last](https://eslint.org/docs/latest/rules/eol-last) | Requires newline at the end of files | 🟠 | 🟢 |
|
|
70
|
+
| [indent](https://eslint.org/docs/latest/rules/indent) | Enforces 2-space indentation, and specific indentation levels for some nodes | 🟠 | 🟢 |
|
|
71
|
+
| [for-direction](https://eslint.org/docs/latest/rules/for-direction) | Prevents for-loops to have stop condition that can never be reached | 🟠 | 🟢 |
|
|
72
|
+
| [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) | | 🟢 |
|
|
73
|
+
| [linebreak-style](https://eslint.org/docs/latest/rules/linebreak-style) | Enforces Unix-style line endings | 🟠 | 🟢 |
|
|
74
|
+
| [max-len](https://eslint.org/docs/latest/rules/max-len) | Enforces a maximum line length of 80 characters | 🟠 |
|
|
75
|
+
| [newline-per-chained-call](https://eslint.org/docs/latest/rules/newline-per-chained-call) | Requires a newline after each call in a method chain | | 🟢 |
|
|
76
|
+
| [no-console](https://eslint.org/docs/latest/rules/no-console) | Disallows the use of `console` | 🟠 | 🟢 |
|
|
77
|
+
| [no-debugger](https://eslint.org/docs/latest/rules/no-debugger) | Disallows the use of `debugger` | 🟠 | 🟢 |
|
|
78
|
+
| [no-eval](https://eslint.org/docs/latest/rules/no-eval) | Disallows the use of `eval` | 🟠 | 🟢 |
|
|
79
|
+
| [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) | 🟠 |
|
|
80
|
+
| [no-multi-str](https://eslint.org/docs/latest/rules/no-multi-str) | Disallows multiline strings | 🟠 | 🟢 |
|
|
81
|
+
| [no-multiple-empty-lines](https://eslint.org/docs/latest/rules/no-multiple-empty-lines) | Allows a maximum of 1 consecutive empty lines | | 🟢 |
|
|
82
|
+
| [no-mixed-spaces-and-tabs](https://eslint.org/docs/latest/rules/no-mixed-spaces-and-tabs) | Disallows mixed spaces and tabs for indentation | 🟠 | 🟢 |
|
|
83
|
+
| [no-restricted-syntax](https://eslint.org/docs/latest/rules/no-restricted-syntax) | Enforces `switch` `case`'s content to be enclosed in braces | | 🟢 |
|
|
84
|
+
| [no-tabs](https://eslint.org/docs/latest/rules/no-tabs) | Disallows tabs | 🟠 | 🟢 |
|
|
85
|
+
| [no-trailing-spaces](https://eslint.org/docs/latest/rules/no-trailing-spaces) | Disallows trailing whitespace at the end of lines | 🟠 | 🟢 |
|
|
86
|
+
| [no-unused-vars](https://eslint.org/docs/latest/rules/no-unused-vars) | Disallows unused variables | 🟠 | 🟢 |
|
|
87
|
+
| [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 | 🟠 | 🟢 |
|
|
88
|
+
| [object-curly-newline](https://eslint.org/docs/latest/rules/object-curly-newline) | Requires line breaks after opening and before closing braces | 🟠 | 🟢 |
|
|
89
|
+
| [object-curly-spacing](https://eslint.org/docs/latest/rules/object-curly-spacing) | Requires spacing inside of braces | 🟠 | 🟢 |
|
|
90
|
+
| [padded-blocks](https://eslint.org/docs/latest/rules/padded-blocks) | Disallows empty lines at the beginning and ending of blocks | 🟠 | 🟢 |
|
|
91
|
+
| [padding-line-between-statements](https://eslint.org/docs/latest/rules/padding-line-between-statements) | Requires padding lines between various statements | 🟠 | 🟢 |
|
|
92
|
+
| [prefer-arrow-callback](https://eslint.org/docs/latest/rules/prefer-arrow-callback) | Requires using arrow functions for callbacks | | 🟢 |
|
|
93
|
+
| [quotes](https://eslint.org/docs/latest/rules/quotes) | Enforces the consistent use of double quotes (while allowing single quotes in order to avoid escape, and backticks for template literals) | 🟠 | 🟢 |
|
|
94
|
+
| [quote-props](https://eslint.org/docs/latest/rules/quote-props) | Disallows quotes around object literal property names that are not strictly required | 🟠 | 🟢 |
|
|
95
|
+
| [semi](https://eslint.org/docs/latest/rules/semi) | Requires semicolons at the end of statements | 🟠 | 🟢 |
|
|
96
|
+
| [semi-style](https://eslint.org/docs/latest/rules/semi-style) | Enforces that semicolons are at the end of statements | 🟠 | 🟢 |
|
|
97
|
+
| [semi-spacing](https://eslint.org/docs/latest/rules/semi-spacing) | Disallows space before semicolons, enforces spaces after | | 🟢 |
|
|
98
|
+
| [space-before-blocks](https://eslint.org/docs/latest/rules/space-before-blocks) | Enforces consistent spacing before blocks | 🟠 | 🟢 |
|
|
99
|
+
| [space-in-parens](https://eslint.org/docs/latest/rules/space-in-parens) | Enforces zero spaces inside of parentheses | 🟠 | 🟢 |
|
|
91
100
|
|
|
92
101
|
#### Crisp JS rules
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
102
|
+
|
|
103
|
+
| Name | Description | 🟠 | 🟢 |
|
|
104
|
+
| :- | :- | :- | :- |
|
|
105
|
+
| [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 | 🟠 |
|
|
106
|
+
| [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 | 🟠 |
|
|
107
|
+
| [crisp/align-requires](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/align-requires.js) | Enforces alignment of require statements | 🟠 |
|
|
108
|
+
| [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 | 🟠 |
|
|
109
|
+
| [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 `_` | 🟠 |
|
|
110
|
+
| [crisp/enforce-optional](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/enforce-optional.js) | Enforces use of optional chaining | 🟠 | 🟢 |
|
|
111
|
+
| [crisp/header-check](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/header-check.js) | Enforces files to start with Crisp header | 🟠 | 🟢 |
|
|
112
|
+
| [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, instances and exports) | 🟠 | 🟢 |
|
|
113
|
+
| [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 | | 🟢 |
|
|
114
|
+
| [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 | | 🟢 |
|
|
115
|
+
| [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`) | 🟠 | 🟢 |
|
|
116
|
+
| [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` | 🟠 | 🟢 |
|
|
117
|
+
| [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 | 🟠 | 🟢 |
|
|
118
|
+
| [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 | 🟠 | 🟢 |
|
|
119
|
+
| [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` | 🟠 | 🟢 |
|
|
120
|
+
| [crisp/no-short-parameters](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/no-short-parameters.js) | Disallow parameter names shorter than 3 characters | 🟠 | 🟢 |
|
|
121
|
+
| [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 | 🟠 |
|
|
122
|
+
| [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 | | 🟢 |
|
|
123
|
+
| [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 | 🟠 | 🟢 |
|
|
124
|
+
| [crisp/one-space-after-operator](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/one-space-after-operator.js) | Enforces at least one space before and one space after `=` and `:` operators | 🟠 | 🟢 |
|
|
125
|
+
| [crisp/regex-in-constructor](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/regex-in-constructor.js) | Ensures regular expressions are defined in the class constructor | 🟠 | 🟢 |
|
|
126
|
+
| [crisp/ternary-parenthesis](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/ternary-parenthesis.js) | Enforces parentheses around conditions with operators in ternary expressions | 🟠 | 🟢 |
|
|
127
|
+
| [crisp/two-lines-between-class-members](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/two-lines-between-class-members.js) | Requires exactly two line breaks between class methods | 🟠 |
|
|
128
|
+
| [crisp/variable-names](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/variable-names.js) | Requires variables defined within a method to start with `_` | 🟠 | 🟢 |
|
|
116
129
|
|
|
117
130
|
#### General JSDoc rules
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
131
|
+
|
|
132
|
+
| Name | Description | 🟠 | 🟢 |
|
|
133
|
+
| :- | :- | :- | :- |
|
|
134
|
+
| [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 | 🟠 |
|
|
135
|
+
| [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 | | 🟢 |
|
|
136
|
+
| [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 | 🟠 | 🟢 |
|
|
137
|
+
| [jsdoc/require-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-jsdoc.md) | Enforces JSDoc comments on functions and classes | 🟠 | 🟢 |
|
|
138
|
+
| [jsdoc/sort-tags](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/sort-tags.md) | Enforces specific order for tags | 🟠 | 🟢 |
|
|
123
139
|
|
|
124
140
|
#### Crisp JSDoc rules
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
141
|
+
|
|
142
|
+
| Name | Description | 🟠 | 🟢 |
|
|
143
|
+
| :- | :- | :- | :- |
|
|
144
|
+
| [crisp/jsdoc-align-params](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/jsdoc-align-params.js) | Enforces various alignments | 🟠 | 🟢 |
|
|
145
|
+
| [crisp/jsdoc-check-indentation](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/jsdoc-check-indentation.js) | Enforces consistent indentation | 🟠 | 🟢 |
|
|
146
|
+
| [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 | | 🟢 |
|
|
147
|
+
| [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 | | 🟢 |
|
|
148
|
+
| [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` | 🟠 | 🟢 |
|
|
130
149
|
|
|
131
150
|
#### General Vue rules
|
|
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
|
-
|
|
151
|
+
|
|
152
|
+
| Name | Description | 🟠 | 🟢 |
|
|
153
|
+
| :- | :- | :- | :- |
|
|
154
|
+
| [vue/attributes-order](https://eslint.vuejs.org/rules/attributes-order) | Enforces order of attributes | | 🟢 |
|
|
155
|
+
| [vue/block-lang](https://eslint.vuejs.org/rules/block-lang) | Allows `script` blocks to have no `lang` attribute | | 🟢 |
|
|
156
|
+
| [vue/block-order](https://eslint.vuejs.org/rules/block-order) | Enforces order of component top-level elements (`template`, then `script`, then `style`) | | 🟢 |
|
|
157
|
+
| [vue/block-tag-newline](https://eslint.vuejs.org/rules/block-tag-newline) | Requires one line break after opening and before closing block-level tags | | 🟢 |
|
|
158
|
+
| [vue/comma-dangle](https://eslint.vuejs.org/rules/comma-dangle) | Disallows trailing commas in `<template>` | | 🟢 |
|
|
159
|
+
| [vue/component-api-style](https://eslint.vuejs.org/rules/component-api-style) | Enforces Options API style | | 🟢 |
|
|
160
|
+
| [vue/component-name-in-template-casing](https://eslint.vuejs.org/rules/component-name-in-template-casing) | Enforces tag names to kebab case | | 🟢 |
|
|
161
|
+
| [vue/component-options-name-casing](https://eslint.vuejs.org/rules/component-options-name-casing) | Enforces component names in `components` options to pascal case | | 🟢 |
|
|
162
|
+
| [vue/custom-event-name-casing](https://eslint.vuejs.org/rules/custom-event-name-casing) | Enforces custom event names to camel case | | 🟢 |
|
|
163
|
+
| [vue/eqeqeq](https://eslint.vuejs.org/rules/eqeqeq) | Requires the use of `===` and `!==` in `<template>` | | 🟢 |
|
|
164
|
+
| [vue/html-comment-content-spacing](https://eslint.vuejs.org/rules/html-comment-content-spacing) | Requires one space before and after HTML comment tags | | 🟢 |
|
|
165
|
+
| [vue/html-quotes](https://eslint.vuejs.org/rules/html-quotes) | Rule is **disabled** in order to allow backticks in HTML attributes | | 🟢 |
|
|
166
|
+
| [vue/key-spacing](https://eslint.vuejs.org/rules/key-spacing) | Enforces consistent spacing in object literal properties in `<template>` (no space between the key and the colon, one space between the colon and the value) | | 🟢 |
|
|
167
|
+
| [vue/match-component-import-name](https://eslint.vuejs.org/rules/match-component-import-name) | Requires the registered component name to match the imported component name | | 🟢 |
|
|
168
|
+
| [vue/new-line-between-multi-line-property](https://eslint.vuejs.org/rules/new-line-between-multi-line-property) | Requires new lines between multi-line `props` | | 🟢 |
|
|
169
|
+
| [vue/no-bare-strings-in-template](https://eslint.vuejs.org/rules/no-bare-strings-in-template) | Disallows the use of bare strings in `<template>` | | 🟢 |
|
|
170
|
+
| [vue/no-irregular-whitespace](https://eslint.vuejs.org/rules/no-irregular-whitespace) | Disallows irregular / invalid whitespaces | | 🟢 |
|
|
171
|
+
| [vue/no-multiple-objects-in-class](https://eslint.vuejs.org/rules/no-multiple-objects-in-class) | Disallows to pass multiple objects into array to `class` HTML property | | 🟢 |
|
|
172
|
+
| [vue/no-mutating-props](https://eslint.vuejs.org/rules/no-mutating-props) | Disallows mutation of component props (except shallow mutation) | | 🟢 |
|
|
173
|
+
| [vue/no-static-inline-styles](https://eslint.vuejs.org/rules/no-static-inline-styles) | Disallows static inline style attributes | | 🟢 |
|
|
174
|
+
| [vue/no-use-v-else-with-v-for](https://eslint.vuejs.org/rules/no-use-v-else-with-v-for) | Disallows using `v-else-if/v-else` on the same element as `v-for` (works but confusing) | | 🟢 |
|
|
175
|
+
| [vue/no-useless-v-bind](https://eslint.vuejs.org/rules/no-useless-v-bind) | Disallows unnecessary `v-bind` directives | | 🟢 |
|
|
176
|
+
| [vue/no-v-html](https://eslint.vuejs.org/rules/no-v-html) | Rule is **disabled** in order to allow the use of `v-html` | | 🟢 |
|
|
177
|
+
| [vue/padding-line-between-blocks](https://eslint.vuejs.org/rules/padding-line-between-blocks) | Requires padding lines between blocks | | 🟢 |
|
|
178
|
+
| [vue/padding-lines-in-component-definition](https://eslint.vuejs.org/rules/padding-lines-in-component-definition) | Requires padding lines in component definition | | 🟢 |
|
|
179
|
+
| [vue/prefer-true-attribute-shorthand](https://eslint.vuejs.org/rules/prefer-true-attribute-shorthand) | Requires shorthand form attribute when `v-bind` value is `true` | | 🟢 |
|
|
180
|
+
| [vue/require-direct-export](https://eslint.vuejs.org/rules/require-direct-export) | Requires the component to be directly exported | | 🟢 |
|
|
181
|
+
| [vue/v-for-delimiter-style](https://eslint.vuejs.org/rules/v-for-delimiter-style) | Enforces the use of `in` delimiter in `v-for` directive | | 🟢 |
|
|
182
|
+
| [vue/v-slot-style](https://eslint.vuejs.org/rules/v-slot-style) | Disallows `v-slot` shorthand style | | 🟢 |
|
|
161
183
|
|
|
162
184
|
#### Crisp Vue rules
|
|
163
|
-
- [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
|
|
164
|
-
- [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
|
|
165
|
-
- [crisp/vue-header-check](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-header-check.js) (🟢): Ensures `script`, `template` and `style` tags start with corresponding comment block
|
|
166
|
-
- [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
|
|
167
|
-
- [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
|
|
168
|
-
- [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
|
|
169
|
-
- [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
|
|
170
185
|
|
|
186
|
+
| Name | Description | 🟠 | 🟢 |
|
|
187
|
+
| :- | :- | :- | :- |
|
|
188
|
+
| [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 | | 🟢 |
|
|
189
|
+
| [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 | | 🟢 |
|
|
190
|
+
| [crisp/vue-header-check](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-header-check.js) | Ensures `script`, `template` and `style` tags start with corresponding comment block | | 🟢 |
|
|
191
|
+
| [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 | | 🟢 |
|
|
192
|
+
| [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 | | 🟢 |
|
|
193
|
+
| [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 | | 🟢 |
|
|
194
|
+
| [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 | | 🟢 |
|
|
171
195
|
|
|
172
196
|
## License
|
|
173
197
|
|
package/index.js
CHANGED
|
@@ -12,6 +12,7 @@ module.exports = {
|
|
|
12
12
|
"header-check": require("./rules/header-check"),
|
|
13
13
|
"header-comments-check": require("./rules/header-comments-check"),
|
|
14
14
|
"import-group-comment": require("./rules/import-group-comment"),
|
|
15
|
+
"import-group-order": require("./rules/import-group-order"),
|
|
15
16
|
"jsdoc-align-params": require("./rules/jsdoc-align-params"),
|
|
16
17
|
"jsdoc-check-indentation": require("./rules/jsdoc-check-indentation"),
|
|
17
18
|
"jsdoc-check-optional-params": require("./rules/jsdoc-check-optional-params"),
|
package/package.json
CHANGED
package/recommended-vue.js
CHANGED
|
@@ -141,6 +141,7 @@ module.exports = {
|
|
|
141
141
|
"crisp/header-check": "error",
|
|
142
142
|
"crisp/header-comments-check": "error",
|
|
143
143
|
"crisp/import-group-comment": "error",
|
|
144
|
+
"crisp/import-group-order": "error",
|
|
144
145
|
"crisp/methods-naming": "error",
|
|
145
146
|
"crisp/methods-ordering": "error",
|
|
146
147
|
"crisp/multiline-comment-end-backslash": "error",
|
|
@@ -6,10 +6,20 @@ module.exports = {
|
|
|
6
6
|
category: "Best Practices",
|
|
7
7
|
recommended: false,
|
|
8
8
|
},
|
|
9
|
+
schema: [
|
|
10
|
+
{
|
|
11
|
+
type: "object",
|
|
12
|
+
additionalProperties: {
|
|
13
|
+
type: "string",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
],
|
|
9
17
|
fixable: null, // This rule is not auto-fixable
|
|
10
18
|
},
|
|
11
19
|
|
|
12
20
|
create(context) {
|
|
21
|
+
const customGroups = context.options[0] || {}; // Get custom groups from options
|
|
22
|
+
|
|
13
23
|
let currentGroupComment = null;
|
|
14
24
|
|
|
15
25
|
// Extract the directory name from the file path
|
|
@@ -19,6 +29,13 @@ module.exports = {
|
|
|
19
29
|
}
|
|
20
30
|
|
|
21
31
|
function extractGroupFromPath(path, filePath) {
|
|
32
|
+
// Check custom regexes first
|
|
33
|
+
for (const regexStr in customGroups) {
|
|
34
|
+
if (new RegExp(regexStr).test(path)) {
|
|
35
|
+
return customGroups[regexStr];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
22
39
|
// Relative path import?
|
|
23
40
|
if (path.startsWith("./")) {
|
|
24
41
|
return getDirectoryName(filePath);
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
meta: {
|
|
3
|
+
type: "suggestion",
|
|
4
|
+
docs: {
|
|
5
|
+
description: "Enforce order of import groups",
|
|
6
|
+
category: "Best Practices",
|
|
7
|
+
recommended: false,
|
|
8
|
+
},
|
|
9
|
+
fixable: null, // This rule is not auto-fixable
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
create(context) {
|
|
13
|
+
const groupOrder = [
|
|
14
|
+
"NPM",
|
|
15
|
+
"PROJECT: COMPONENTS",
|
|
16
|
+
"PROJECT: POPUPS",
|
|
17
|
+
"PROJECT: MIXINS",
|
|
18
|
+
"PROJECT: FACTORIES",
|
|
19
|
+
"PROJECT: HELPERS",
|
|
20
|
+
"PROJECT: PLATFORMS",
|
|
21
|
+
"PROJECT: LIBRARIES",
|
|
22
|
+
// Add any other known groups here
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
let lastKnownGroupIndex = -1;
|
|
26
|
+
const existingGroups = new Set();
|
|
27
|
+
const sourceCode = context.getSourceCode();
|
|
28
|
+
|
|
29
|
+
function findGroupIndex(comment) {
|
|
30
|
+
const group = comment.value.trim().toUpperCase();
|
|
31
|
+
return groupOrder.indexOf(group);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function getRelativePositionMessage(currentGroupIndex, groupName) {
|
|
35
|
+
for (let i = currentGroupIndex - 1; i >= 0; i--) {
|
|
36
|
+
if (existingGroups.has(groupOrder[i])) {
|
|
37
|
+
return `should be after '${groupOrder[i]}' group`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
for (let i = currentGroupIndex + 1; i < groupOrder.length; i++) {
|
|
41
|
+
if (existingGroups.has(groupOrder[i])) {
|
|
42
|
+
return `should be before '${groupOrder[i]}' group`;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return "is out of order";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function hasKnownGroupAfter(node) {
|
|
49
|
+
let followingNode = node;
|
|
50
|
+
while (followingNode = sourceCode.getTokenAfter(followingNode, { includeComments: true })) {
|
|
51
|
+
if (followingNode.type === 'Line') {
|
|
52
|
+
if (isGroupComment(followingNode)) {
|
|
53
|
+
const groupIndex = findGroupIndex(followingNode);
|
|
54
|
+
|
|
55
|
+
if (groupIndex !== -1) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (followingNode.type === 'ImportDeclaration') {
|
|
62
|
+
const commentsBefore = sourceCode.getCommentsBefore(followingNode);
|
|
63
|
+
for (let i = commentsBefore.length - 1; i >= 0; i--) {
|
|
64
|
+
const comment = commentsBefore[i];
|
|
65
|
+
if (isGroupComment(comment)) {
|
|
66
|
+
const groupIndex = findGroupIndex(comment);
|
|
67
|
+
if (groupIndex !== -1) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function checkGroupOrder(node, currentGroupIndex, groupName) {
|
|
79
|
+
if (currentGroupIndex === -1) { // Unknown group
|
|
80
|
+
if (hasKnownGroupAfter(node)) {
|
|
81
|
+
context.report({
|
|
82
|
+
node,
|
|
83
|
+
message: `Unknown import group '${groupName}' should be after all known groups.`,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
} else if (currentGroupIndex < lastKnownGroupIndex) {
|
|
87
|
+
const positionMessage = getRelativePositionMessage(currentGroupIndex, groupName);
|
|
88
|
+
context.report({
|
|
89
|
+
node,
|
|
90
|
+
message: `Import group '${groupName}' ${positionMessage}.`,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (currentGroupIndex !== -1) {
|
|
95
|
+
lastKnownGroupIndex = Math.max(lastKnownGroupIndex, currentGroupIndex);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
existingGroups.add(groupName);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function isGroupComment(comment) {
|
|
102
|
+
return (
|
|
103
|
+
comment.type === "Line" &&
|
|
104
|
+
(
|
|
105
|
+
comment.value.trim().startsWith("PROJECT:") ||
|
|
106
|
+
comment.value.trim().startsWith("NPM")
|
|
107
|
+
)
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function updateAndCheckGroup(node) {
|
|
112
|
+
const comments = context.getSourceCode().getCommentsBefore(node);
|
|
113
|
+
|
|
114
|
+
for (let i = comments.length - 1; i >= 0; i--) {
|
|
115
|
+
const comment = comments[i];
|
|
116
|
+
|
|
117
|
+
if (isGroupComment(comment)) {
|
|
118
|
+
const groupName = comment.value.trim().toUpperCase();
|
|
119
|
+
const groupIndex = findGroupIndex(comment);
|
|
120
|
+
|
|
121
|
+
checkGroupOrder(node, groupIndex, groupName);
|
|
122
|
+
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
ImportDeclaration: updateAndCheckGroup,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
};
|