@perfective/eslint-config 0.29.2 → 0.30.0

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.
Files changed (77) hide show
  1. package/LICENSE +1 -1
  2. package/README.adoc +24 -18
  3. package/README.md +20 -16
  4. package/config/node.d.ts +7 -0
  5. package/config/node.js +7 -11
  6. package/config/plugin.d.ts +9 -0
  7. package/config/plugin.js +22 -26
  8. package/config.js +1 -6
  9. package/cypress.d.ts +5 -0
  10. package/cypress.js +31 -56
  11. package/index.d.ts +46 -12
  12. package/index.js +100 -144
  13. package/jest-dom.js +8 -11
  14. package/jest.d.ts +6 -0
  15. package/jest.js +29 -24
  16. package/package.json +18 -17
  17. package/rules/array-func/index.d.ts +1 -2
  18. package/rules/array-func/index.js +14 -50
  19. package/rules/cypress/index.d.ts +11 -3
  20. package/rules/cypress/index.js +23 -57
  21. package/rules/eslint/index.js +6 -9
  22. package/rules/eslint/layout-formatting.js +64 -67
  23. package/rules/eslint/possible-problems.js +96 -99
  24. package/rules/eslint/suggestions.js +181 -182
  25. package/rules/eslint-comments/best-practices.js +8 -11
  26. package/rules/eslint-comments/index.d.ts +1 -2
  27. package/rules/eslint-comments/index.js +9 -45
  28. package/rules/eslint-comments/stylistic-issues.js +9 -18
  29. package/rules/import/helpful-warnings.js +11 -14
  30. package/rules/import/index.js +11 -14
  31. package/rules/import/module-systems.js +10 -13
  32. package/rules/import/rules/no-extraneous-dependencies.d.ts +3 -0
  33. package/rules/import/rules/no-extraneous-dependencies.js +20 -21
  34. package/rules/import/static-analysis.js +26 -29
  35. package/rules/import/style-guide.js +33 -36
  36. package/rules/jest/index.js +98 -72
  37. package/rules/jest/typescript-eslint.js +5 -8
  38. package/rules/jest-dom/index.js +19 -55
  39. package/rules/jsdoc/index.d.ts +1 -1
  40. package/rules/jsdoc/index.js +158 -344
  41. package/rules/n/index.d.ts +1 -1
  42. package/rules/n/index.js +64 -98
  43. package/rules/prefer-arrow/index.d.ts +1 -2
  44. package/rules/prefer-arrow/index.js +14 -50
  45. package/rules/promise/index.d.ts +1 -2
  46. package/rules/promise/index.js +35 -73
  47. package/rules/rxjs/index.d.ts +1 -1
  48. package/rules/rxjs/index.js +60 -96
  49. package/rules/security/index.d.ts +1 -2
  50. package/rules/security/index.js +22 -58
  51. package/rules/simple-import-sort/index.js +12 -48
  52. package/rules/simple-import-sort/rules/imports.d.ts +11 -0
  53. package/rules/simple-import-sort/rules/imports.js +18 -32
  54. package/rules/stylistic/js/index.d.ts +9 -2
  55. package/rules/stylistic/js/index.js +198 -236
  56. package/rules/stylistic/jsx/index.d.ts +8 -2
  57. package/rules/stylistic/jsx/index.js +81 -117
  58. package/rules/stylistic/plus/index.d.ts +6 -2
  59. package/rules/stylistic/plus/index.js +14 -50
  60. package/rules/stylistic/ts/index.d.ts +8 -2
  61. package/rules/stylistic/ts/index.js +135 -169
  62. package/rules/testing-library/index.js +41 -77
  63. package/rules/typescript-eslint/extension-rules.js +113 -116
  64. package/rules/typescript-eslint/index.d.ts +2 -0
  65. package/rules/typescript-eslint/index.js +9 -45
  66. package/rules/typescript-eslint/rules/typescript-eslint-naming-convention.d.ts +5 -0
  67. package/rules/typescript-eslint/rules/typescript-eslint-naming-convention.js +24 -30
  68. package/rules/typescript-eslint/supported-rules.d.ts +2 -0
  69. package/rules/typescript-eslint/supported-rules.js +256 -319
  70. package/rules/unicorn/index.d.ts +7 -2
  71. package/rules/unicorn/index.js +178 -209
  72. package/rules/unicorn/rules/prevent-abbreviations.d.ts +8 -0
  73. package/rules/unicorn/rules/prevent-abbreviations.js +30 -8
  74. package/rules.js +4 -14
  75. package/rxjs.d.ts +5 -0
  76. package/rxjs.js +21 -57
  77. package/testing-library.js +8 -11
@@ -2,8 +2,8 @@ export declare const unicornConfig: {
2
2
  plugins: {
3
3
  unicorn: import("eslint").ESLint.Plugin & {
4
4
  configs: {
5
- recommended: import("eslint").Linter.Config;
6
- all: import("eslint").Linter.Config;
5
+ recommended: import("eslint").Linter.FlatConfig;
6
+ all: import("eslint").Linter.FlatConfig;
7
7
  "flat/all": import("eslint").Linter.FlatConfig;
8
8
  "flat/recommended": import("eslint").Linter.FlatConfig;
9
9
  };
@@ -12,6 +12,8 @@ export declare const unicornConfig: {
12
12
  rules: {
13
13
  'unicorn/better-regex': string;
14
14
  'unicorn/catch-error-name': string;
15
+ 'unicorn/consistent-assert': string;
16
+ 'unicorn/consistent-date-clone': string;
15
17
  'unicorn/consistent-destructuring': string;
16
18
  'unicorn/consistent-empty-array-spread': string;
17
19
  'unicorn/consistent-existence-index-check': string;
@@ -31,6 +33,7 @@ export declare const unicornConfig: {
31
33
  'unicorn/import-style': string;
32
34
  'unicorn/new-for-builtins': string;
33
35
  'unicorn/no-abusive-eslint-disable': string;
36
+ 'unicorn/no-accessor-recursion': string;
34
37
  'unicorn/no-anonymous-default-export': string;
35
38
  'unicorn/no-array-callback-reference': string;
36
39
  'unicorn/no-array-for-each': string;
@@ -47,6 +50,7 @@ export declare const unicornConfig: {
47
50
  'unicorn/no-for-loop': string;
48
51
  'unicorn/no-hex-escape': string;
49
52
  'unicorn/no-instanceof-array': string;
53
+ 'unicorn/no-instanceof-builtins': string;
50
54
  'unicorn/no-invalid-fetch-options': string;
51
55
  'unicorn/no-invalid-remove-event-listener': string;
52
56
  'unicorn/no-keyword-prefix': (string | {
@@ -57,6 +61,7 @@ export declare const unicornConfig: {
57
61
  'unicorn/no-length-as-slice-end': string;
58
62
  'unicorn/no-lonely-if': string;
59
63
  'unicorn/no-magic-array-flat-depth': string;
64
+ 'unicorn/no-named-default': string;
60
65
  'unicorn/no-negated-condition': string;
61
66
  'unicorn/no-negation-in-equality-check': string;
62
67
  'unicorn/no-nested-ternary': string;
@@ -1,209 +1,178 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.unicornConfig = void 0;
37
- const eslintPluginUnicorn = __importStar(require("eslint-plugin-unicorn"));
38
- const prevent_abbreviations_1 = require("./rules/prevent-abbreviations");
39
- exports.unicornConfig = {
40
- plugins: {
41
- unicorn: eslintPluginUnicorn,
42
- },
43
- rules: {
44
- 'unicorn/better-regex': 'warn',
45
- 'unicorn/catch-error-name': 'warn',
46
- 'unicorn/consistent-destructuring': 'warn',
47
- 'unicorn/consistent-empty-array-spread': 'warn',
48
- 'unicorn/consistent-existence-index-check': 'warn',
49
- 'unicorn/consistent-function-scoping': ['error', {
50
- checkArrowFunctions: true,
51
- }],
52
- 'unicorn/custom-error-definition': 'warn',
53
- 'unicorn/empty-brace-spaces': 'warn',
54
- 'unicorn/error-message': 'error',
55
- 'unicorn/escape-case': 'warn',
56
- 'unicorn/expiring-todo-comments': 'error',
57
- 'unicorn/explicit-length-check': 'warn',
58
- 'unicorn/filename-case': ['error', {
59
- case: 'kebabCase',
60
- }],
61
- 'unicorn/import-index': 'off',
62
- 'unicorn/import-style': 'off',
63
- 'unicorn/new-for-builtins': 'warn',
64
- 'unicorn/no-abusive-eslint-disable': 'error',
65
- 'unicorn/no-anonymous-default-export': 'error',
66
- 'unicorn/no-array-callback-reference': 'off',
67
- 'unicorn/no-array-for-each': 'off',
68
- 'unicorn/no-array-method-this-argument': 'warn',
69
- 'unicorn/no-array-push-push': ['warn', {
70
- ignore: ['readable', 'this', 'this.stream'],
71
- }],
72
- 'unicorn/no-array-reduce': 'off',
73
- 'unicorn/no-await-expression-member': 'error',
74
- 'unicorn/no-await-in-promise-methods': 'error',
75
- 'unicorn/no-console-spaces': 'warn',
76
- 'unicorn/no-document-cookie': 'error',
77
- 'unicorn/no-empty-file': 'error',
78
- 'unicorn/no-for-loop': 'warn',
79
- 'unicorn/no-hex-escape': 'warn',
80
- 'unicorn/no-instanceof-array': 'warn',
81
- 'unicorn/no-invalid-fetch-options': 'error',
82
- 'unicorn/no-invalid-remove-event-listener': 'error',
83
- 'unicorn/no-keyword-prefix': ['off', {
84
- disallowedPrefixes: ['new', 'class'],
85
- checkProperties: true,
86
- onlyCamelCase: false,
87
- }],
88
- 'unicorn/no-length-as-slice-end': 'warn',
89
- 'unicorn/no-lonely-if': 'warn',
90
- 'unicorn/no-magic-array-flat-depth': 'error',
91
- 'unicorn/no-negated-condition': 'warn',
92
- 'unicorn/no-negation-in-equality-check': 'error',
93
- 'unicorn/no-nested-ternary': 'off',
94
- 'unicorn/no-new-array': 'warn',
95
- 'unicorn/no-new-buffer': 'warn',
96
- 'unicorn/no-null': 'off',
97
- 'unicorn/no-object-as-default-parameter': 'error',
98
- 'unicorn/no-process-exit': 'error',
99
- 'unicorn/no-single-promise-in-promise-methods': 'warn',
100
- 'unicorn/no-static-only-class': 'error',
101
- 'unicorn/no-thenable': 'error',
102
- 'unicorn/no-this-assignment': 'error',
103
- 'unicorn/no-typeof-undefined': ['warn', {
104
- checkGlobalVariables: true,
105
- }],
106
- 'unicorn/no-unnecessary-await': 'warn',
107
- 'unicorn/no-unnecessary-polyfills': 'error',
108
- 'unicorn/no-unreadable-array-destructuring': 'error',
109
- 'unicorn/no-unreadable-iife': 'error',
110
- 'unicorn/no-unsafe-regex': 'off',
111
- 'unicorn/no-unused-properties': 'off',
112
- 'unicorn/no-useless-fallback-in-spread': 'warn',
113
- 'unicorn/no-useless-length-check': 'warn',
114
- 'unicorn/no-useless-promise-resolve-reject': 'warn',
115
- 'unicorn/no-useless-spread': 'warn',
116
- 'unicorn/no-useless-switch-case': 'error',
117
- 'unicorn/no-useless-undefined': 'off',
118
- 'unicorn/no-zero-fractions': 'off',
119
- 'unicorn/number-literal-case': 'warn',
120
- 'unicorn/numeric-separators-style': ['warn', {
121
- hexadecimal: {
122
- minimumDigits: 6,
123
- groupLength: 2,
124
- },
125
- binary: {
126
- minimumDigits: 0,
127
- groupLength: 4,
128
- },
129
- octal: {
130
- minimumDigits: 0,
131
- groupLength: 4,
132
- },
133
- number: {
134
- minimumDigits: 6,
135
- groupLength: 3,
136
- },
137
- }],
138
- 'unicorn/prefer-add-event-listener': 'warn',
139
- 'unicorn/prefer-array-find': ['warn', {
140
- checkFromLast: true,
141
- }],
142
- 'unicorn/prefer-array-flat': 'off',
143
- 'unicorn/prefer-array-flat-map': 'off',
144
- 'unicorn/prefer-array-index-of': 'warn',
145
- 'unicorn/prefer-array-some': 'error',
146
- 'unicorn/prefer-at': 'off',
147
- 'unicorn/prefer-blob-reading-methods': 'error',
148
- 'unicorn/prefer-code-point': 'error',
149
- 'unicorn/prefer-date-now': 'warn',
150
- 'unicorn/prefer-default-parameters': 'warn',
151
- 'unicorn/prefer-dom-node-append': 'warn',
152
- 'unicorn/prefer-dom-node-dataset': 'warn',
153
- 'unicorn/prefer-dom-node-remove': 'warn',
154
- 'unicorn/prefer-dom-node-text-content': 'warn',
155
- 'unicorn/prefer-event-target': 'error',
156
- 'unicorn/prefer-export-from': 'warn',
157
- 'unicorn/prefer-global-this': 'warn',
158
- 'unicorn/prefer-includes': 'warn',
159
- 'unicorn/prefer-json-parse-buffer': 'warn',
160
- 'unicorn/prefer-keyboard-event-key': 'warn',
161
- 'unicorn/prefer-logical-operator-over-ternary': 'error',
162
- 'unicorn/prefer-math-min-max': 'warn',
163
- 'unicorn/prefer-math-trunc': 'warn',
164
- 'unicorn/prefer-modern-dom-apis': 'warn',
165
- 'unicorn/prefer-modern-math-apis': 'warn',
166
- 'unicorn/prefer-module': 'off',
167
- 'unicorn/prefer-native-coercion-functions': 'warn',
168
- 'unicorn/prefer-negative-index': 'warn',
169
- 'unicorn/prefer-node-protocol': 'warn',
170
- 'unicorn/prefer-number-properties': ['warn', {
171
- checkInfinity: true,
172
- checkNaN: true,
173
- }],
174
- 'unicorn/prefer-object-from-entries': ['off', {
175
- functions: [],
176
- }],
177
- 'unicorn/prefer-optional-catch-binding': 'warn',
178
- 'unicorn/prefer-prototype-methods': 'warn',
179
- 'unicorn/prefer-query-selector': 'warn',
180
- 'unicorn/prefer-reflect-apply': 'warn',
181
- 'unicorn/prefer-regexp-test': 'off',
182
- 'unicorn/prefer-set-has': 'warn',
183
- 'unicorn/prefer-set-size': 'warn',
184
- 'unicorn/prefer-spread': 'off',
185
- 'unicorn/prefer-string-raw': 'off',
186
- 'unicorn/prefer-string-replace-all': 'off',
187
- 'unicorn/prefer-string-slice': 'warn',
188
- 'unicorn/prefer-string-starts-ends-with': 'warn',
189
- 'unicorn/prefer-string-trim-start-end': 'warn',
190
- 'unicorn/prefer-structured-clone': 'off',
191
- 'unicorn/prefer-switch': ['error', {
192
- minimumCases: 3,
193
- emptyDefaultCase: 'do-nothing-comment',
194
- }],
195
- 'unicorn/prefer-ternary': 'off',
196
- 'unicorn/prefer-top-level-await': 'off',
197
- 'unicorn/prefer-type-error': 'warn',
198
- 'unicorn/prevent-abbreviations': ['warn', (0, prevent_abbreviations_1.unicornPreventAbbreviations)()],
199
- 'unicorn/relative-url-style': ['warn', 'always'],
200
- 'unicorn/require-array-join-separator': 'warn',
201
- 'unicorn/require-number-to-fixed-digits-argument': 'warn',
202
- 'unicorn/require-post-message-target-origin': 'error',
203
- 'unicorn/string-content': 'off',
204
- 'unicorn/switch-case-braces': 'off',
205
- 'unicorn/template-indent': 'warn',
206
- 'unicorn/text-encoding-identifier-case': 'error',
207
- 'unicorn/throw-new-error': 'warn',
208
- },
209
- };
1
+ import eslintPluginUnicorn from 'eslint-plugin-unicorn';
2
+ import { unicornPreventAbbreviations } from "./rules/prevent-abbreviations.js";
3
+ export const unicornConfig = {
4
+ plugins: {
5
+ unicorn: eslintPluginUnicorn
6
+ },
7
+ rules: {
8
+ 'unicorn/better-regex': 'warn',
9
+ 'unicorn/catch-error-name': 'warn',
10
+ 'unicorn/consistent-assert': 'warn',
11
+ 'unicorn/consistent-date-clone': 'warn',
12
+ 'unicorn/consistent-destructuring': 'warn',
13
+ 'unicorn/consistent-empty-array-spread': 'warn',
14
+ 'unicorn/consistent-existence-index-check': 'warn',
15
+ 'unicorn/consistent-function-scoping': ['error', {
16
+ checkArrowFunctions: true
17
+ }],
18
+ 'unicorn/custom-error-definition': 'warn',
19
+ 'unicorn/empty-brace-spaces': 'warn',
20
+ 'unicorn/error-message': 'error',
21
+ 'unicorn/escape-case': 'warn',
22
+ 'unicorn/expiring-todo-comments': 'error',
23
+ 'unicorn/explicit-length-check': 'warn',
24
+ 'unicorn/filename-case': ['error', {
25
+ case: 'kebabCase'
26
+ }],
27
+ 'unicorn/import-index': 'off',
28
+ 'unicorn/import-style': 'off',
29
+ 'unicorn/new-for-builtins': 'warn',
30
+ 'unicorn/no-abusive-eslint-disable': 'error',
31
+ 'unicorn/no-accessor-recursion': 'error',
32
+ 'unicorn/no-anonymous-default-export': 'error',
33
+ 'unicorn/no-array-callback-reference': 'off',
34
+ 'unicorn/no-array-for-each': 'off',
35
+ 'unicorn/no-array-method-this-argument': 'warn',
36
+ 'unicorn/no-array-push-push': ['warn', {
37
+ ignore: ['readable', 'this', 'this.stream']
38
+ }],
39
+ 'unicorn/no-array-reduce': 'off',
40
+ 'unicorn/no-await-expression-member': 'error',
41
+ 'unicorn/no-await-in-promise-methods': 'error',
42
+ 'unicorn/no-console-spaces': 'warn',
43
+ 'unicorn/no-document-cookie': 'error',
44
+ 'unicorn/no-empty-file': 'error',
45
+ 'unicorn/no-for-loop': 'warn',
46
+ 'unicorn/no-hex-escape': 'warn',
47
+ 'unicorn/no-instanceof-array': 'off',
48
+ 'unicorn/no-instanceof-builtins': 'warn',
49
+ 'unicorn/no-invalid-fetch-options': 'error',
50
+ 'unicorn/no-invalid-remove-event-listener': 'error',
51
+ 'unicorn/no-keyword-prefix': ['off', {
52
+ disallowedPrefixes: ['new', 'class'],
53
+ checkProperties: true,
54
+ onlyCamelCase: false
55
+ }],
56
+ 'unicorn/no-length-as-slice-end': 'warn',
57
+ 'unicorn/no-lonely-if': 'warn',
58
+ 'unicorn/no-magic-array-flat-depth': 'error',
59
+ 'unicorn/no-named-default': 'warn',
60
+ 'unicorn/no-negated-condition': 'warn',
61
+ 'unicorn/no-negation-in-equality-check': 'error',
62
+ 'unicorn/no-nested-ternary': 'off',
63
+ 'unicorn/no-new-array': 'warn',
64
+ 'unicorn/no-new-buffer': 'warn',
65
+ 'unicorn/no-null': 'off',
66
+ 'unicorn/no-object-as-default-parameter': 'error',
67
+ 'unicorn/no-process-exit': 'error',
68
+ 'unicorn/no-single-promise-in-promise-methods': 'warn',
69
+ 'unicorn/no-static-only-class': 'error',
70
+ 'unicorn/no-thenable': 'error',
71
+ 'unicorn/no-this-assignment': 'error',
72
+ 'unicorn/no-typeof-undefined': ['warn', {
73
+ checkGlobalVariables: true
74
+ }],
75
+ 'unicorn/no-unnecessary-await': 'warn',
76
+ 'unicorn/no-unnecessary-polyfills': 'error',
77
+ 'unicorn/no-unreadable-array-destructuring': 'error',
78
+ 'unicorn/no-unreadable-iife': 'error',
79
+ 'unicorn/no-unsafe-regex': 'off',
80
+ 'unicorn/no-unused-properties': 'off',
81
+ 'unicorn/no-useless-fallback-in-spread': 'warn',
82
+ 'unicorn/no-useless-length-check': 'warn',
83
+ 'unicorn/no-useless-promise-resolve-reject': 'warn',
84
+ 'unicorn/no-useless-spread': 'warn',
85
+ 'unicorn/no-useless-switch-case': 'error',
86
+ 'unicorn/no-useless-undefined': 'off',
87
+ 'unicorn/no-zero-fractions': 'off',
88
+ 'unicorn/number-literal-case': 'warn',
89
+ 'unicorn/numeric-separators-style': ['warn', {
90
+ hexadecimal: {
91
+ minimumDigits: 6,
92
+ groupLength: 2
93
+ },
94
+ binary: {
95
+ minimumDigits: 0,
96
+ groupLength: 4
97
+ },
98
+ octal: {
99
+ minimumDigits: 0,
100
+ groupLength: 4
101
+ },
102
+ number: {
103
+ minimumDigits: 6,
104
+ groupLength: 3
105
+ }
106
+ }],
107
+ 'unicorn/prefer-add-event-listener': 'warn',
108
+ 'unicorn/prefer-array-find': ['warn', {
109
+ checkFromLast: true
110
+ }],
111
+ 'unicorn/prefer-array-flat': 'off',
112
+ 'unicorn/prefer-array-flat-map': 'off',
113
+ 'unicorn/prefer-array-index-of': 'warn',
114
+ 'unicorn/prefer-array-some': 'error',
115
+ 'unicorn/prefer-at': 'off',
116
+ 'unicorn/prefer-blob-reading-methods': 'error',
117
+ 'unicorn/prefer-code-point': 'error',
118
+ 'unicorn/prefer-date-now': 'warn',
119
+ 'unicorn/prefer-default-parameters': 'warn',
120
+ 'unicorn/prefer-dom-node-append': 'warn',
121
+ 'unicorn/prefer-dom-node-dataset': 'warn',
122
+ 'unicorn/prefer-dom-node-remove': 'warn',
123
+ 'unicorn/prefer-dom-node-text-content': 'warn',
124
+ 'unicorn/prefer-event-target': 'error',
125
+ 'unicorn/prefer-export-from': 'warn',
126
+ 'unicorn/prefer-global-this': 'warn',
127
+ 'unicorn/prefer-includes': 'warn',
128
+ 'unicorn/prefer-json-parse-buffer': 'warn',
129
+ 'unicorn/prefer-keyboard-event-key': 'warn',
130
+ 'unicorn/prefer-logical-operator-over-ternary': 'error',
131
+ 'unicorn/prefer-math-min-max': 'warn',
132
+ 'unicorn/prefer-math-trunc': 'warn',
133
+ 'unicorn/prefer-modern-dom-apis': 'warn',
134
+ 'unicorn/prefer-modern-math-apis': 'warn',
135
+ 'unicorn/prefer-module': 'off',
136
+ 'unicorn/prefer-native-coercion-functions': 'warn',
137
+ 'unicorn/prefer-negative-index': 'warn',
138
+ 'unicorn/prefer-node-protocol': 'warn',
139
+ 'unicorn/prefer-number-properties': ['warn', {
140
+ checkInfinity: true,
141
+ checkNaN: true
142
+ }],
143
+ 'unicorn/prefer-object-from-entries': ['off', {
144
+ functions: []
145
+ }],
146
+ 'unicorn/prefer-optional-catch-binding': 'warn',
147
+ 'unicorn/prefer-prototype-methods': 'warn',
148
+ 'unicorn/prefer-query-selector': 'warn',
149
+ 'unicorn/prefer-reflect-apply': 'warn',
150
+ 'unicorn/prefer-regexp-test': 'off',
151
+ 'unicorn/prefer-set-has': 'warn',
152
+ 'unicorn/prefer-set-size': 'warn',
153
+ 'unicorn/prefer-spread': 'off',
154
+ 'unicorn/prefer-string-raw': 'off',
155
+ 'unicorn/prefer-string-replace-all': 'off',
156
+ 'unicorn/prefer-string-slice': 'warn',
157
+ 'unicorn/prefer-string-starts-ends-with': 'warn',
158
+ 'unicorn/prefer-string-trim-start-end': 'warn',
159
+ 'unicorn/prefer-structured-clone': 'off',
160
+ 'unicorn/prefer-switch': ['error', {
161
+ minimumCases: 3,
162
+ emptyDefaultCase: 'do-nothing-comment'
163
+ }],
164
+ 'unicorn/prefer-ternary': 'off',
165
+ 'unicorn/prefer-top-level-await': 'off',
166
+ 'unicorn/prefer-type-error': 'warn',
167
+ 'unicorn/prevent-abbreviations': ['warn', unicornPreventAbbreviations()],
168
+ 'unicorn/relative-url-style': ['warn', 'always'],
169
+ 'unicorn/require-array-join-separator': 'warn',
170
+ 'unicorn/require-number-to-fixed-digits-argument': 'warn',
171
+ 'unicorn/require-post-message-target-origin': 'error',
172
+ 'unicorn/string-content': 'off',
173
+ 'unicorn/switch-case-braces': 'off',
174
+ 'unicorn/template-indent': 'warn',
175
+ 'unicorn/text-encoding-identifier-case': 'error',
176
+ 'unicorn/throw-new-error': 'warn'
177
+ }
178
+ };
@@ -12,4 +12,12 @@ export interface UnicornPreventAbbreviations {
12
12
  checkFilenames: boolean;
13
13
  ignore: RegExp[];
14
14
  }
15
+ /**
16
+ * Allows to extend unicorn/prevent-abbreviation rules replacements, instead of overriding them.
17
+ *
18
+ * @param replacements - List of additional replacements.
19
+ * @param options - Additional properties to override.
20
+ *
21
+ * @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/master/docs/rules/prevent-abbreviations.md
22
+ */
15
23
  export declare function unicornPreventAbbreviations(replacements?: UnicornPreventAbbreviationReplacements, options?: Partial<Pick<UnicornPreventAbbreviations, 'checkProperties'>>): UnicornPreventAbbreviations;
@@ -1,8 +1,30 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.unicornPreventAbbreviations = unicornPreventAbbreviations;
4
- function unicornPreventAbbreviations(replacements = {}, options = {}) {
5
- return Object.assign(Object.assign({ replacements: Object.assign({ arg: false, args: false, db: false, doc: false, docs: false, dev: false, env: false, i: false, j: false, lib: false, libs: false, param: false, params: false }, replacements), extendDefaultReplacements: true, allowList: {}, extendDefaultAllowList: true, checkDefaultAndNamespaceImports: 'internal', checkShorthandImports: 'internal', checkShorthandProperties: false, checkProperties: false, checkVariables: true, checkFilenames: true }, options), { ignore: [
6
- /e2e/u,
7
- ] });
8
- }
1
+ export function unicornPreventAbbreviations(replacements = {}, options = {}) {
2
+ return Object.assign(Object.assign({
3
+ replacements: Object.assign({
4
+ arg: false,
5
+ args: false,
6
+ db: false,
7
+ doc: false,
8
+ docs: false,
9
+ dev: false,
10
+ env: false,
11
+ i: false,
12
+ j: false,
13
+ lib: false,
14
+ libs: false,
15
+ param: false,
16
+ params: false
17
+ }, replacements),
18
+ extendDefaultReplacements: true,
19
+ allowList: {},
20
+ extendDefaultAllowList: true,
21
+ checkDefaultAndNamespaceImports: 'internal',
22
+ checkShorthandImports: 'internal',
23
+ checkShorthandProperties: false,
24
+ checkProperties: false,
25
+ checkVariables: true,
26
+ checkFilenames: true
27
+ }, options), {
28
+ ignore: [/e2e/u]
29
+ });
30
+ }
package/rules.js CHANGED
@@ -1,14 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.unicornPreventAbbreviations = exports.typescriptEslintNamingConvention = exports.simpleImportSortImports = exports.jsImportNoExtraneousDependencies = exports.jestImportNoExtraneousDependencies = exports.importNoExtraneousDependencies = exports.cypressImportNoExtraneousDependencies = void 0;
4
- var no_extraneous_dependencies_1 = require("./rules/import/rules/no-extraneous-dependencies");
5
- Object.defineProperty(exports, "cypressImportNoExtraneousDependencies", { enumerable: true, get: function () { return no_extraneous_dependencies_1.cypressImportNoExtraneousDependencies; } });
6
- Object.defineProperty(exports, "importNoExtraneousDependencies", { enumerable: true, get: function () { return no_extraneous_dependencies_1.importNoExtraneousDependencies; } });
7
- Object.defineProperty(exports, "jestImportNoExtraneousDependencies", { enumerable: true, get: function () { return no_extraneous_dependencies_1.jestImportNoExtraneousDependencies; } });
8
- Object.defineProperty(exports, "jsImportNoExtraneousDependencies", { enumerable: true, get: function () { return no_extraneous_dependencies_1.jsImportNoExtraneousDependencies; } });
9
- var imports_1 = require("./rules/simple-import-sort/rules/imports");
10
- Object.defineProperty(exports, "simpleImportSortImports", { enumerable: true, get: function () { return imports_1.simpleImportSortImports; } });
11
- var typescript_eslint_naming_convention_1 = require("./rules/typescript-eslint/rules/typescript-eslint-naming-convention");
12
- Object.defineProperty(exports, "typescriptEslintNamingConvention", { enumerable: true, get: function () { return typescript_eslint_naming_convention_1.typescriptEslintNamingConvention; } });
13
- var prevent_abbreviations_1 = require("./rules/unicorn/rules/prevent-abbreviations");
14
- Object.defineProperty(exports, "unicornPreventAbbreviations", { enumerable: true, get: function () { return prevent_abbreviations_1.unicornPreventAbbreviations; } });
1
+ export { cypressImportNoExtraneousDependencies, importNoExtraneousDependencies, jestImportNoExtraneousDependencies, jsImportNoExtraneousDependencies } from "./rules/import/rules/no-extraneous-dependencies.js";
2
+ export { simpleImportSortImports } from "./rules/simple-import-sort/rules/imports.js";
3
+ export { typescriptEslintNamingConvention } from "./rules/typescript-eslint/rules/typescript-eslint-naming-convention.js";
4
+ export { unicornPreventAbbreviations } from "./rules/unicorn/rules/prevent-abbreviations.js";
package/rxjs.d.ts CHANGED
@@ -1 +1,6 @@
1
+ /**
2
+ * Configuration for @smarttools/eslint-plugin-rxjs.
3
+ *
4
+ * @param files - A list of globs with the files to lint.
5
+ */
1
6
  export declare function rxjsConfig(files?: string[]): Record<string, unknown>;
package/rxjs.js CHANGED
@@ -1,58 +1,22 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.rxjsConfig = rxjsConfig;
37
- const tsEslint = __importStar(require("typescript-eslint"));
38
- const rxjs_1 = require("./rules/rxjs");
39
- function rxjsConfig(files = ['**/*.ts?(x)']) {
40
- return {
41
- files,
42
- languageOptions: {
43
- sourceType: 'module',
44
- ecmaVersion: 'latest',
45
- parser: tsEslint.parser,
46
- parserOptions: {
47
- ecmaFeatures: {
48
- globalReturn: false,
49
- impliedStrict: true,
50
- },
51
- projectService: true,
52
- warnOnUnsupportedTypeScriptVersion: true,
53
- },
1
+ import { parser } from 'typescript-eslint';
2
+ import { rxjsConfig as rxjsPluginConfig } from "./rules/rxjs/index.js";
3
+ export function rxjsConfig(files = ['**/*.ts?(x)']) {
4
+ return {
5
+ files,
6
+ languageOptions: {
7
+ sourceType: 'module',
8
+ ecmaVersion: 'latest',
9
+ parser,
10
+ parserOptions: {
11
+ ecmaFeatures: {
12
+ globalReturn: false,
13
+ impliedStrict: true
54
14
  },
55
- plugins: Object.assign({}, rxjs_1.rxjsConfig.plugins),
56
- rules: Object.assign({}, rxjs_1.rxjsConfig.rules),
57
- };
58
- }
15
+ projectService: true,
16
+ warnOnUnsupportedTypeScriptVersion: true
17
+ }
18
+ },
19
+ plugins: Object.assign({}, rxjsPluginConfig.plugins),
20
+ rules: Object.assign({}, rxjsPluginConfig.rules)
21
+ };
22
+ }