@pumpn/eslint-config 11.2.0 → 12.0.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 (68) hide show
  1. package/.ls-lint.yml +6 -0
  2. package/.tool-versions +1 -0
  3. package/.vscode/settings.json +7 -0
  4. package/config.js +91 -62
  5. package/deno.json +40 -0
  6. package/deno.lock +3152 -0
  7. package/eslint.config.js +13 -0
  8. package/import-map.json +26 -0
  9. package/jsdoc.json +51 -0
  10. package/package.json +24 -17
  11. package/plugins.js +40 -0
  12. package/rules/_exports.js +21 -0
  13. package/rules/eslint-comments/_exports.js +2 -0
  14. package/rules/eslint-comments/best-practices.js +10 -0
  15. package/rules/eslint-comments/stylistic-issues.js +12 -0
  16. package/rules/eslint-comments.js +12 -0
  17. package/rules/github.js +27 -0
  18. package/rules/import/_exports.js +4 -0
  19. package/rules/import/helpful-warnings.js +18 -0
  20. package/rules/import/module-systems.js +9 -0
  21. package/rules/import/static-analysis.js +71 -0
  22. package/rules/import/style-guide.js +86 -0
  23. package/rules/import.js +12 -0
  24. package/rules/jsdoc.js +255 -54
  25. package/rules/jsx-a11y.js +139 -0
  26. package/rules/layout-and-formatting.js +4 -260
  27. package/rules/no-secrets.js +18 -0
  28. package/rules/no-unsanitized.js +6 -0
  29. package/rules/perfectionist.js +267 -0
  30. package/rules/possible-problems.js +66 -15
  31. package/rules/promise.js +25 -0
  32. package/rules/react.js +105 -2
  33. package/rules/redos.js +15 -0
  34. package/rules/regexp/_exports.js +3 -0
  35. package/rules/regexp/best-practices.js +43 -0
  36. package/rules/regexp/possible-errors.js +26 -0
  37. package/rules/regexp/stylistic-issues.js +62 -0
  38. package/rules/regexp.js +12 -0
  39. package/rules/security.js +18 -0
  40. package/rules/sonarjs/_exports.js +2 -0
  41. package/rules/sonarjs/bug-detection.js +14 -0
  42. package/rules/sonarjs/code-smell-detection.js +37 -0
  43. package/rules/sonarjs.js +12 -0
  44. package/rules/stylistic/_common/_exports.js +3 -0
  45. package/rules/stylistic/_common/min-items-for-array-newline.js +3 -0
  46. package/rules/stylistic/_exports.js +13 -0
  47. package/rules/stylistic/brackets.js +79 -0
  48. package/rules/stylistic/commas.js +13 -0
  49. package/rules/stylistic/comments.js +23 -0
  50. package/rules/stylistic/disallow.js +31 -0
  51. package/rules/stylistic/indent.js +12 -0
  52. package/rules/stylistic/jsx.js +35 -0
  53. package/rules/stylistic/linebreaks.js +74 -0
  54. package/rules/stylistic/misc.js +32 -0
  55. package/rules/stylistic/operators.js +26 -0
  56. package/rules/stylistic/quotes.js +7 -0
  57. package/rules/stylistic/semis.js +14 -0
  58. package/rules/stylistic/spacing.js +53 -0
  59. package/rules/stylistic/types.js +7 -0
  60. package/rules/stylistic.js +12 -0
  61. package/rules/suggestions.js +152 -135
  62. package/rules/tailwindcss.js +11 -0
  63. package/rules/unicorn.js +200 -0
  64. package/rules.js +11 -14
  65. package/.np-config.cjs +0 -1
  66. package/addons/deno.js +0 -15
  67. package/addons.js +0 -1
  68. package/rules/imports.js +0 -135
@@ -0,0 +1,200 @@
1
+ const hexadecimalGroupLength = 2;
2
+ const binaryGroupLength = 4;
3
+ const octalGroupLength = 4;
4
+ const numberGroupLength = 3;
5
+
6
+ const patterns = {
7
+ "'": "’",
8
+ "(?<=[!?])\\.": "",
9
+ "(?<=[!?])”\\.(?=(?:(?:\\s+[\\p{Letter}\\p{Number}])|$))": "”",
10
+ "(?<=[\\p{Letter}\\p{Number}] )-+(?= [\\p{Letter}\\p{Number}])": "—",
11
+ "(?<=\\p{Punctuation})\\p{Zs}{2,}(?=[\\p{Letter}\\p{Number}])": " ",
12
+ "(?<=“[^“]*?\\s)['‘]([^'‘]+?)['’](?=\\s[^“]*?”)": "‘$1’",
13
+ "([\"'])((?:\\\\.|[^\\\\])*?)\\1": "“$2”",
14
+ "<=": "≤",
15
+ "<==": "⇐",
16
+ "<===": "⟸",
17
+ "<==>": "⟺",
18
+ "<=>": "⇔",
19
+ "<-": "←",
20
+ "<->": "↔",
21
+ "<--": "⟵",
22
+ "<-->": "⟷",
23
+ "===>": "⟹",
24
+ "==>": "⇒",
25
+ ">=": "≥",
26
+ "\\.\\.(?=(?:(?:\\s+[\\p{Letter}\\p{Number}])|$))": ".",
27
+ "\\.\\.\\.": "…",
28
+ "\\.”\\.(?=(?:(?:\\s+[\\p{Letter}\\p{Number}])|$))": ".”",
29
+ "->": "→",
30
+ "-->": "⟶"
31
+ };
32
+
33
+ const unicornRules = {
34
+ "unicorn/better-regex": "error",
35
+ "unicorn/catch-error-name": "error",
36
+ "unicorn/consistent-destructuring": "error",
37
+ "unicorn/consistent-function-scoping": "error",
38
+ "unicorn/custom-error-definition": "error",
39
+ "unicorn/empty-brace-spaces": "error",
40
+ "unicorn/error-message": "error",
41
+ "unicorn/escape-case": "error",
42
+ "unicorn/expiring-todo-comments": [
43
+ "error",
44
+ {
45
+ allowWarningComments: false
46
+ }
47
+ ],
48
+ "unicorn/explicit-length-check": "error",
49
+ "unicorn/filename-case": ["error", { case: "kebabCase" }],
50
+ "unicorn/import-style": "error",
51
+ "unicorn/new-for-builtins": "error",
52
+ "unicorn/no-abusive-eslint-disable": "error",
53
+ // TODO [eslint-plugin-unicorn@>51.0.1]: uncomment below when eslint-plugin-unicorn releases
54
+ // "unicorn/no-anonymous-default-export": "error",
55
+ "unicorn/no-array-callback-reference": "error",
56
+ "unicorn/no-array-for-each": "error",
57
+ "unicorn/no-array-method-this-argument": "error",
58
+ "unicorn/no-array-push-push": "error",
59
+ "unicorn/no-array-reduce": "off",
60
+ "unicorn/no-await-expression-member": "error",
61
+ "unicorn/no-console-spaces": "error",
62
+ "unicorn/no-document-cookie": "error",
63
+ "unicorn/no-empty-file": "error",
64
+ "unicorn/no-for-loop": "error",
65
+ "unicorn/no-hex-escape": "error",
66
+ "unicorn/no-instanceof-array": "error",
67
+ "unicorn/no-invalid-remove-event-listener": "error",
68
+ "unicorn/no-keyword-prefix": ["error", { disallowedPrefixes: ["new"] }],
69
+ "unicorn/no-lonely-if": "error",
70
+ "unicorn/no-negated-condition": "error",
71
+ "unicorn/no-nested-ternary": "error",
72
+ "unicorn/no-new-array": "error",
73
+ "unicorn/no-new-buffer": "error",
74
+ "unicorn/no-null": "off",
75
+ "unicorn/no-object-as-default-parameter": "error",
76
+ "unicorn/no-process-exit": "error",
77
+ "unicorn/no-static-only-class": "error",
78
+ "unicorn/no-thenable": "error",
79
+ "unicorn/no-this-assignment": "error",
80
+ "unicorn/no-typeof-undefined": "error",
81
+ "unicorn/no-unnecessary-await": "error",
82
+ "unicorn/no-unnecessary-polyfills": "error",
83
+ "unicorn/no-unreadable-array-destructuring": "error",
84
+ "unicorn/no-unreadable-iife": "error",
85
+ "unicorn/no-unused-properties": "error",
86
+ "unicorn/no-useless-fallback-in-spread": "error",
87
+ "unicorn/no-useless-length-check": "error",
88
+ "unicorn/no-useless-promise-resolve-reject": "error",
89
+ "unicorn/no-useless-spread": "error",
90
+ "unicorn/no-useless-switch-case": "error",
91
+ "unicorn/no-useless-undefined": "error",
92
+ "unicorn/no-zero-fractions": "error",
93
+ "unicorn/number-literal-case": "error",
94
+ "unicorn/numeric-separators-style": [
95
+ "error",
96
+ {
97
+ binary: {
98
+ minimumDigits: 0,
99
+ groupLength: binaryGroupLength
100
+ },
101
+ hexadecimal: {
102
+ minimumDigits: 0,
103
+ groupLength: hexadecimalGroupLength
104
+ },
105
+ number: {
106
+ minimumDigits: 0,
107
+ groupLength: numberGroupLength
108
+ },
109
+ octal: {
110
+ minimumDigits: 0,
111
+ groupLength: octalGroupLength
112
+ },
113
+ onlyIfContainsSeparator: false
114
+ }
115
+ ],
116
+ "unicorn/prefer-add-event-listener": "error",
117
+ "unicorn/prefer-array-find": "error",
118
+ "unicorn/prefer-array-flat": "error",
119
+ "unicorn/prefer-array-flat-map": "error",
120
+ "unicorn/prefer-array-index-of": "error",
121
+ "unicorn/prefer-array-some": "error",
122
+ "unicorn/prefer-at": "error",
123
+ "unicorn/prefer-blob-reading-methods": "error",
124
+ "unicorn/prefer-code-point": "error",
125
+ "unicorn/prefer-date-now": "error",
126
+ "unicorn/prefer-default-parameters": "error",
127
+ "unicorn/prefer-dom-node-append": "error",
128
+ "unicorn/prefer-dom-node-dataset": "error",
129
+ "unicorn/prefer-dom-node-remove": "error",
130
+ "unicorn/prefer-dom-node-text-content": "error",
131
+ "unicorn/prefer-event-target": "error",
132
+ "unicorn/prefer-export-from": "error",
133
+ "unicorn/prefer-includes": "error",
134
+ "unicorn/prefer-json-parse-buffer": "off",
135
+ "unicorn/prefer-keyboard-event-key": "error",
136
+ "unicorn/prefer-logical-operator-over-ternary": "error",
137
+ "unicorn/prefer-math-trunc": "error",
138
+ "unicorn/prefer-modern-dom-apis": "error",
139
+ "unicorn/prefer-modern-math-apis": "error",
140
+ "unicorn/prefer-module": "error",
141
+ "unicorn/prefer-native-coercion-functions": "error",
142
+ "unicorn/prefer-negative-index": "error",
143
+ "unicorn/prefer-node-protocol": "error",
144
+ "unicorn/prefer-number-properties": [
145
+ "error",
146
+ {
147
+ checkInfinity: false
148
+ }
149
+ ],
150
+ "unicorn/prefer-object-from-entries": "error",
151
+ "unicorn/prefer-optional-catch-binding": "error",
152
+ "unicorn/prefer-prototype-methods": "error",
153
+ "unicorn/prefer-query-selector": "error",
154
+ "unicorn/prefer-reflect-apply": "error",
155
+ "unicorn/prefer-regexp-test": "error",
156
+ "unicorn/prefer-set-has": "error",
157
+ "unicorn/prefer-set-size": "error",
158
+ "unicorn/prefer-spread": "error",
159
+ "unicorn/prefer-string-replace-all": "error",
160
+ "unicorn/prefer-string-slice": "error",
161
+ "unicorn/prefer-string-starts-ends-with": "error",
162
+ "unicorn/prefer-string-trim-start-end": "error",
163
+ "unicorn/prefer-switch": "error",
164
+ "unicorn/prefer-ternary": ["error", "only-single-line"],
165
+ "unicorn/prefer-top-level-await": "error",
166
+ "unicorn/prefer-type-error": "error",
167
+ "unicorn/prevent-abbreviations": "error",
168
+ "unicorn/relative-url-style": "error",
169
+ "unicorn/require-array-join-separator": "error",
170
+ "unicorn/require-number-to-fixed-digits-argument": "error",
171
+ "unicorn/require-post-message-target-origin": "off",
172
+ "unicorn/string-content": [
173
+ "off",
174
+ {
175
+ patterns
176
+ }
177
+ ],
178
+ "unicorn/switch-case-braces": ["error", "avoid"],
179
+ "unicorn/template-indent": [
180
+ "error",
181
+ {
182
+ comments: ["HTML", "indent"],
183
+ functions: ["dedent", "stripIndent"],
184
+ indent: "\t",
185
+ selectors: ["TemplateLiteral"],
186
+ tags: [
187
+ "outdent",
188
+ "dedent",
189
+ "gql",
190
+ "sql",
191
+ "html",
192
+ "styled"
193
+ ]
194
+ }
195
+ ],
196
+ "unicorn/text-encoding-identifier-case": "error",
197
+ "unicorn/throw-new-error": "error"
198
+ };
199
+
200
+ export default unicornRules;
package/rules.js CHANGED
@@ -1,15 +1,12 @@
1
- import imports from "./rules/imports.js";
2
- import jsdoc from "./rules/jsdoc.js";
3
- import layoutAndFormatting from "./rules/layout-and-formatting.js";
4
- import possibleProblems from "./rules/possible-problems.js";
5
- import react from "./rules/react.js";
6
- import suggestions from "./rules/suggestions.js";
1
+ import * as ruleSets from "./rules/_exports.js";
7
2
 
8
- export default {
9
- ...layoutAndFormatting,
10
- ...possibleProblems,
11
- ...suggestions,
12
- ...jsdoc,
13
- ...imports,
14
- ...react
15
- };
3
+ const rules = Object.values(ruleSets)
4
+ .reduce(
5
+ (allRules, ruleSet) => ({
6
+ ...allRules,
7
+ ...ruleSet
8
+ }),
9
+ {}
10
+ );
11
+
12
+ export default rules;
package/.np-config.cjs DELETED
@@ -1 +0,0 @@
1
- module.exports = require("@pumpn/np-config");
package/addons/deno.js DELETED
@@ -1,15 +0,0 @@
1
- export default {
2
- languageOptions: {
3
- globals: {
4
- Deno: "readonly"
5
- }
6
- },
7
- settings: {
8
- "import/resolver": {
9
- "@jsenv/importmap-eslint-resolver": {
10
- projectDirectoryUrl: process.cwd(),
11
- importMapFileRelativeUrl: "./import-map.json"
12
- }
13
- }
14
- }
15
- };
package/addons.js DELETED
@@ -1 +0,0 @@
1
- export { default as deno } from "./addons/deno.js";
package/rules/imports.js DELETED
@@ -1,135 +0,0 @@
1
- const maxDependencies = 10;
2
-
3
- export default {
4
- "import/default": ["error"],
5
- "import/dynamic-import-chunkname": [
6
- "off",
7
- {
8
- importFunctions: [],
9
- webpackChunknameFormat: "[0-9a-zA-Z-_/.]+"
10
- }
11
- ],
12
- "import/export": ["error"],
13
- "import/exports-last": ["error"],
14
- "import/extensions": ["error", "ignorePackages"],
15
- "import/first": ["error"],
16
- "import/group-exports": ["off"],
17
- "import/max-dependencies": [
18
- "error",
19
- {
20
- max: maxDependencies
21
- }
22
- ],
23
- "import/named": ["error"],
24
- "import/namespace": ["error"],
25
- "import/newline-after-import": ["error"],
26
- "import/no-absolute-path": ["error"],
27
- "import/no-amd": ["error"],
28
- "import/no-anonymous-default-export": [
29
- "off",
30
- {
31
- allowAnonymousClass: false,
32
- allowAnonymousFunction: false,
33
- allowArray: false,
34
- allowArrowFunction: false,
35
- allowLiteral: false,
36
- allowObject: false
37
- }
38
- ],
39
- "import/no-commonjs": ["error"],
40
- "import/no-cycle": [
41
- "error",
42
- {
43
- maxDepth: Infinity
44
- }
45
- ],
46
- "import/no-default-export": ["off"],
47
- "import/no-deprecated": ["error"],
48
- "import/no-duplicates": ["error"],
49
- "import/no-dynamic-require": ["error"],
50
- "import/no-extraneous-dependencies": [
51
- "error",
52
- {
53
- devDependencies: [
54
- "test/**",
55
- "tests/**",
56
- "spec/**",
57
- "**/__tests__/**",
58
- "**/__mocks__/**",
59
- "test.{js,jsx}",
60
- "test-*.{js,jsx}",
61
- "**/*{.,_}{test,spec}.{js,jsx}",
62
- "**/jest.config.js",
63
- "**/jest.setup.js",
64
- "**/vue.config.js",
65
- "**/webpack.config.js",
66
- "**/webpack.config.*.js",
67
- "**/rollup.config.js",
68
- "**/rollup.config.*.js",
69
- "**/gulpfile.js",
70
- "**/gulpfile.*.js",
71
- "**/Gruntfile{,.js}",
72
- "**/protractor.conf.js",
73
- "**/protractor.conf.*.js",
74
- "**/karma.conf.js",
75
- "**/eslint.config.js",
76
- "**/.np-config.cjs"
77
- ],
78
- optionalDependencies: false
79
- }
80
- ],
81
- "import/no-internal-modules": [
82
- "off",
83
- {
84
- allow: []
85
- }
86
- ],
87
- "import/no-mutable-exports": ["error"],
88
- "import/no-named-as-default": ["error"],
89
- "import/no-named-as-default-member": ["error"],
90
- "import/no-named-default": ["error"],
91
- "import/no-named-export": ["off"],
92
- "import/no-namespace": ["error"],
93
- "import/no-nodejs-modules": ["off"],
94
- "import/no-relative-parent-imports": ["off"],
95
- "import/no-restricted-paths": ["off"],
96
- "import/no-self-import": ["error"],
97
- "import/no-unassigned-import": ["error"],
98
- "import/no-unresolved": [
99
- "error",
100
- {
101
- caseSensitive: true,
102
- commonjs: true
103
- }
104
- ],
105
- "import/no-unused-modules": [
106
- "off",
107
- {
108
- ignoreExports: ["./main.js"],
109
- missingExports: true,
110
- unusedExports: false
111
- }
112
- ],
113
- "import/no-useless-path-segments": [
114
- "error",
115
- {
116
- commonjs: true
117
- }
118
- ],
119
- "import/no-webpack-loader-syntax": ["error"],
120
- "import/order": [
121
- "error",
122
- {
123
- groups: [
124
- "builtin",
125
- "external",
126
- "parent",
127
- "sibling",
128
- "index"
129
- ],
130
- "newlines-between": "always"
131
- }
132
- ],
133
- "import/prefer-default-export": ["off"],
134
- "import/unambiguous": "off"
135
- };