eslint-config-isaacscript 4.20.0 → 5.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.
@@ -1,233 +0,0 @@
1
- // This ESLint config only contains rules from `eslint-plugin-unicorn`:
2
- // https://github.com/sindresorhus/eslint-plugin-unicorn
3
-
4
- // Rules are separated into categories:
5
- // 1) Normal rules
6
- // 2) Deprecated rules
7
-
8
- /** @type {import("eslint").Linter.RulesRecord} */
9
- const NORMAL_RULES = {
10
- "unicorn/better-regex": "error",
11
- "unicorn/catch-error-name": "error",
12
-
13
- /** Disabled because it has too many false positives. */
14
- "unicorn/consistent-destructuring": "off",
15
-
16
- "unicorn/consistent-function-scoping": "error",
17
- "unicorn/custom-error-definition": "error",
18
- "unicorn/empty-brace-spaces": "off", // eslint-config-prettier
19
- "unicorn/error-message": "error",
20
- "unicorn/escape-case": "error",
21
- "unicorn/expiring-todo-comments": "error",
22
- "unicorn/explicit-length-check": "error",
23
-
24
- /** Disabled since projects may use different file naming conventions. */
25
- "unicorn/filename-case": "off",
26
-
27
- "unicorn/import-style": "error",
28
- "unicorn/new-for-builtins": "error",
29
-
30
- /** Superseded by the `eslint-comments/no-unlimited-disable` rule. */
31
- "unicorn/no-abusive-eslint-disable": "off",
32
-
33
- /** Disabled since it is not helpful when using TypeScript. */
34
- "unicorn/no-array-callback-reference": "off",
35
-
36
- "unicorn/no-array-for-each": "error",
37
- "unicorn/no-array-method-this-argument": "error",
38
- "unicorn/no-array-push-push": "error",
39
- "unicorn/no-array-reduce": "error",
40
- "unicorn/no-await-expression-member": "error",
41
- "unicorn/no-console-spaces": "error",
42
- "unicorn/no-document-cookie": "error",
43
- "unicorn/no-empty-file": "error",
44
- "unicorn/no-for-loop": "error",
45
- "unicorn/no-hex-escape": "error",
46
- "unicorn/no-instanceof-array": "error",
47
- "unicorn/no-invalid-remove-event-listener": "error",
48
-
49
- /** Disabled because it is common to prefix variables with "new". */
50
- "unicorn/no-keyword-prefix": "off",
51
-
52
- "unicorn/no-lonely-if": "error",
53
- "unicorn/no-negated-condition": "error",
54
- "unicorn/no-nested-ternary": "off", // eslint-config-prettier
55
- "unicorn/no-new-array": "error",
56
- "unicorn/no-new-buffer": "error",
57
- "unicorn/no-null": "error",
58
- "unicorn/no-object-as-default-parameter": "error",
59
-
60
- /**
61
- * Disabled because using `process.exit` is common to exit command-line applications without
62
- * verbose output.
63
- */
64
- "unicorn/no-process-exit": "off",
65
-
66
- "unicorn/no-static-only-class": "error",
67
- "unicorn/no-thenable": "error",
68
-
69
- /** Superseded by the `@typescript-eslint/no-this-alias` rule. */
70
- "unicorn/no-this-assignment": "off",
71
-
72
- "unicorn/no-typeof-undefined": "error",
73
- "unicorn/no-unnecessary-await": "error",
74
- "unicorn/no-unnecessary-polyfills": "error",
75
- "unicorn/no-unreadable-array-destructuring": "error",
76
- "unicorn/no-unreadable-iife": "error",
77
- "unicorn/no-unused-properties": "error",
78
- "unicorn/no-useless-fallback-in-spread": "error",
79
- "unicorn/no-useless-length-check": "error",
80
- "unicorn/no-useless-promise-resolve-reject": "error",
81
- "unicorn/no-useless-spread": "error",
82
- "unicorn/no-useless-switch-case": "error",
83
-
84
- /** Disabled since it does not work properly with TypeScript. */
85
- "unicorn/no-useless-undefined": "off",
86
-
87
- "unicorn/no-zero-fractions": "error",
88
- "unicorn/number-literal-case": "off", // eslint-config-prettier
89
- "unicorn/numeric-separators-style": "error",
90
- "unicorn/prefer-add-event-listener": "error",
91
- "unicorn/prefer-array-find": "error",
92
- "unicorn/prefer-array-flat": "error",
93
- "unicorn/prefer-array-flat-map": "error",
94
- "unicorn/prefer-array-index-of": "error",
95
- "unicorn/prefer-array-some": "error",
96
- "unicorn/prefer-at": "error",
97
- "unicorn/prefer-blob-reading-methods": "error",
98
- "unicorn/prefer-code-point": "error",
99
- "unicorn/prefer-date-now": "error",
100
- "unicorn/prefer-default-parameters": "error",
101
- "unicorn/prefer-dom-node-append": "error",
102
- "unicorn/prefer-dom-node-dataset": "error",
103
- "unicorn/prefer-dom-node-remove": "error",
104
- "unicorn/prefer-dom-node-text-content": "error",
105
- "unicorn/prefer-event-target": "error",
106
- "unicorn/prefer-export-from": "error",
107
- "unicorn/prefer-includes": "error",
108
-
109
- /** Disabled because the rule is not compatible with TypeScript. */
110
- "unicorn/prefer-json-parse-buffer": "off",
111
-
112
- "unicorn/prefer-keyboard-event-key": "error",
113
- "unicorn/prefer-logical-operator-over-ternary": "error",
114
- "unicorn/prefer-math-trunc": "error",
115
- "unicorn/prefer-modern-dom-apis": "error",
116
- "unicorn/prefer-modern-math-apis": "error",
117
- "unicorn/prefer-module": "error",
118
- "unicorn/prefer-native-coercion-functions": "error",
119
- "unicorn/prefer-negative-index": "error",
120
- "unicorn/prefer-node-protocol": "error",
121
- "unicorn/prefer-number-properties": "error",
122
- "unicorn/prefer-object-from-entries": "error",
123
- "unicorn/prefer-optional-catch-binding": "error",
124
- "unicorn/prefer-prototype-methods": "error",
125
- "unicorn/prefer-query-selector": "error",
126
- "unicorn/prefer-reflect-apply": "error",
127
- "unicorn/prefer-regexp-test": "error",
128
- "unicorn/prefer-set-has": "error",
129
- "unicorn/prefer-set-size": "error",
130
- "unicorn/prefer-spread": "error",
131
- "unicorn/prefer-string-replace-all": "error",
132
- "unicorn/prefer-string-slice": "error",
133
- "unicorn/prefer-string-starts-ends-with": "error",
134
- "unicorn/prefer-string-trim-start-end": "error",
135
- "unicorn/prefer-switch": "error",
136
- "unicorn/prefer-ternary": "error",
137
- "unicorn/prefer-top-level-await": "error",
138
- "unicorn/prefer-type-error": "error",
139
-
140
- /** Disabled since it is common to use the variable name of "i". */
141
- "unicorn/prevent-abbreviations": "off",
142
-
143
- "unicorn/relative-url-style": "error",
144
- "unicorn/require-array-join-separator": "error",
145
- "unicorn/require-number-to-fixed-digits-argument": "error",
146
-
147
- /** Disabled since it is not recommended by the plugin authors. */
148
- "unicorn/require-post-message-target-origin": "off",
149
-
150
- /** Disabled since string content enforcement is too project-specific. */
151
- "unicorn/string-content": "off",
152
-
153
- "unicorn/switch-case-braces": "error",
154
- "unicorn/template-indent": "error",
155
- "unicorn/text-encoding-identifier-case": "error",
156
- "unicorn/throw-new-error": "error",
157
- };
158
-
159
- /** @type {import("eslint").Linter.RulesRecord} */
160
- const DEPRECATED_RULES = {
161
- /** Disabled because this rule is deprecated. */
162
- "unicorn/import-index": "off",
163
-
164
- /** Disabled because this rule is deprecated. */
165
- "unicorn/no-array-instanceof": "off",
166
-
167
- /** Disabled because this rule is deprecated. */
168
- "unicorn/no-fn-reference-in-iterator": "off",
169
-
170
- /** Disabled because this rule is deprecated. */
171
- "unicorn/no-reduce": "off",
172
-
173
- /** Disabled because this rule is deprecated. */
174
- "unicorn/no-unsafe-regex": "off",
175
-
176
- /** Disabled because this rule is deprecated. */
177
- "unicorn/prefer-dataset": "off",
178
-
179
- /** Disabled because this rule is deprecated. */
180
- "unicorn/prefer-event-key": "off",
181
-
182
- /** Disabled because this rule is deprecated. */
183
- "unicorn/prefer-exponentiation-operator": "off",
184
-
185
- /** Disabled because this rule is deprecated. */
186
- "unicorn/prefer-flat-map": "off",
187
-
188
- /** Disabled because this rule is deprecated. */
189
- "unicorn/prefer-node-append": "off",
190
-
191
- /** Disabled because this rule is deprecated. */
192
- "unicorn/prefer-node-remove": "off",
193
-
194
- /** Disabled because this rule is deprecated. */
195
- "unicorn/prefer-object-has-own": "off",
196
-
197
- /** Disabled because this rule is deprecated. */
198
- "unicorn/prefer-replace-all": "off",
199
-
200
- /** Disabled because this rule is deprecated. */
201
- "unicorn/prefer-starts-ends-with": "off",
202
-
203
- /** Disabled because this rule is deprecated. */
204
- "unicorn/prefer-text-content": "off",
205
-
206
- /** Disabled because this rule is deprecated. */
207
- "unicorn/prefer-trim-start-end": "off",
208
-
209
- /** Disabled because this rule is deprecated. */
210
- "unicorn/regex-shorthand": "off",
211
- };
212
-
213
- /** @type {import("eslint").Linter.Config} */
214
- const config = {
215
- plugins: ["unicorn"],
216
-
217
- rules: {
218
- ...NORMAL_RULES,
219
- ...DEPRECATED_RULES,
220
- },
221
-
222
- overrides: [
223
- // Disable some TypeScript-specific rules in JavaScript files.
224
- {
225
- files: ["*.js", "*.cjs", "*.mjs", "*.jsx"],
226
- rules: {
227
- "unicorn/prefer-module": "off",
228
- },
229
- },
230
- ],
231
- };
232
-
233
- module.exports = config;
package/mod.js DELETED
@@ -1,229 +0,0 @@
1
- /**
2
- * This config is meant to be used as a base for IsaacScript mods (or TypeScriptToLua projects).
3
- *
4
- * @type {import("eslint").Linter.Config}
5
- */
6
- const config = {
7
- extends: [
8
- /**
9
- * The IsaacScript mod config extends the base configuration:
10
- * https://github.com/IsaacScript/isaacscript/blob/main/packages/eslint-config-isaacscript/base.js
11
- * (Normal TypeScript projects would just use the base configuration directly.)
12
- */
13
- "./base",
14
- ],
15
-
16
- rules: {
17
- /**
18
- * Defined at: base-typescript-eslint.js
19
- *
20
- * It is conventional in IsaacScript mods to put the "v" object outside of the class, which
21
- * makes it likely that some methods will not use any internal class variables.
22
- */
23
- "@typescript-eslint/class-methods-use-this": "off",
24
-
25
- /**
26
- * Defined at: base-typescript-eslint.js
27
- *
28
- * We expand the original definition to ensure that all enums match the Isaac convention of
29
- * using UPPER_CASE.
30
- */
31
- "@typescript-eslint/naming-convention": [
32
- "error",
33
- // Allow camelCase variables (23.2), PascalCase variables (23.8), and UPPER_CASE variables
34
- // (23.10).
35
- {
36
- selector: "variable",
37
- format: ["camelCase", "PascalCase", "UPPER_CASE"],
38
- leadingUnderscore: "allow",
39
-
40
- // Polyfilling "__dirname" in ESM files is a common pattern.
41
- filter: {
42
- regex: "^__dirname$",
43
- match: false,
44
- },
45
- },
46
- // Allow camelCase functions (23.2), and PascalCase functions (23.8).
47
- {
48
- selector: "function",
49
- format: ["camelCase", "PascalCase"],
50
- leadingUnderscore: "allow",
51
- },
52
- // Airbnb recommends PascalCase for classes (23.3), and although Airbnb does not make
53
- // TypeScript recommendations, we are assuming this rule would similarly apply to anything
54
- // "type like", including interfaces, type aliases, and enums.
55
- {
56
- selector: "typeLike",
57
- format: ["PascalCase"],
58
- leadingUnderscore: "allow",
59
- },
60
- // The vanilla Isaac enums all use UPPER_CASE:
61
- // https://wofsauge.github.io/IsaacDocs/rep/enums/CollectibleType.html
62
- {
63
- selector: "enumMember",
64
- format: ["UPPER_CASE"],
65
- },
66
- ],
67
-
68
- /**
69
- * Defined at: base-typescript-eslint.js
70
- *
71
- * The `Vector` object has a `tostring` meta-method, so it can be properly printed without
72
- * explicitly specifying the X and Y values.
73
- */
74
- "@typescript-eslint/no-base-to-string": [
75
- "error",
76
- {
77
- ignoredTypeNames: ["Vector"],
78
- },
79
- ],
80
-
81
- /**
82
- * Defined at: base-typescript-eslint.js
83
- *
84
- * TSTL has special behavior with respect to `this: void`, so we need to configure this rule to
85
- * allow the `this` parameter.
86
- */
87
- "@typescript-eslint/no-invalid-void-type": [
88
- "error",
89
- {
90
- allowAsThisParameter: true,
91
- },
92
- ],
93
-
94
- /**
95
- * Defined at: base-typescript-eslint.js
96
- *
97
- * This rule throws false positives with Isaac API functions. It can be worked around by
98
- * supplying lists of globals to ESLint, but this is ugly. See:
99
- * https://github.com/typescript-eslint/typescript-eslint/issues/2780
100
- */
101
- "@typescript-eslint/no-loop-func": "off",
102
-
103
- /**
104
- * Defined at: base-typescript-eslint.js
105
- *
106
- * Enums that are used with the API must be numbers since that is what the API expects. We also
107
- * prefer that unofficial enums are also number enums for consistency.
108
- */
109
- "@typescript-eslint/prefer-enum-initializers": "off",
110
-
111
- /**
112
- * Defined at: base-typescript-eslint.js
113
- *
114
- * It is common to initialize enums with the `Isaac.GetEntityVariantByName` method.
115
- */
116
- "@typescript-eslint/prefer-literal-enum-member": "off",
117
-
118
- /**
119
- * Defined at: base-typescript-eslint.js
120
- *
121
- * The `Number.sort` method transpiles to use `table.sort`, which does not have the
122
- * coercion-based bugs of the JavaScript implementation. Thus, this lint rule is unnecessary.
123
- */
124
- "@typescript-eslint/require-array-sort-compare": "off",
125
-
126
- /**
127
- * Defined in "isaacscript/recommended".
128
- *
129
- * Enums that are used with the API use upper case letters. We also prefer that unofficial enums
130
- * are also use upper case letters for consistency.
131
- */
132
- "isaacscript/consistent-enum-values": "off",
133
-
134
- /**
135
- * Not defined in the parent configs.
136
- *
137
- * Since Isaac enums use the `SHOUTING_SNAKE_CASE` convention, this rule ensures correctness.
138
- */
139
- "isaacscript/enum-member-number-separation": "error",
140
-
141
- /**
142
- * Defined in "isaacscript/recommended".
143
- *
144
- * Enums that are used with the API must be numbers since that is what the API expects. We also
145
- * prefer that unofficial enums are also number enums for consistency.
146
- */
147
- "isaacscript/no-number-enums": "off",
148
-
149
- /**
150
- * Not defined in the parent configs.
151
- *
152
- * Prevents misuse of the custom `DefaultMap` class in the standard library.
153
- */
154
- "isaacscript/no-invalid-default-map": "error",
155
-
156
- /**
157
- * Not defined in the parent configs.
158
- *
159
- * The `throw` keyword should never be used in Isaac mods.
160
- */
161
- "isaacscript/no-throw": "error",
162
-
163
- /**
164
- * Not defined in the parent configs.
165
- *
166
- * We must explicitly enable this rule, since it should only apply to IsaacScript mods.
167
- */
168
- "isaacscript/require-v-registration": "error",
169
-
170
- /**
171
- * Defined at: base-n.js
172
- *
173
- * IsaacScript mods to not use ESM, so we must turn this rule off.
174
- */
175
- "n/file-extension-in-import": "off",
176
-
177
- /**
178
- * Defined at: base-unicorn.js
179
- *
180
- * `null` values are conventionally used with the `isaacscript-common` save data manager (even
181
- * though they are transpiled to `nil`).
182
- */
183
- "unicorn/no-null": "off",
184
-
185
- /**
186
- * Defined at: base-unicorn.js
187
- *
188
- * IsaacScript mods use Lua bitwise operators, which are safe.
189
- */
190
- "unicorn/prefer-math-trunc": "off",
191
-
192
- /**
193
- * Defined at: base-eslint.js
194
- *
195
- * Isaac API methods use capital letters, so we must make the options for the rule less strict.
196
- */
197
- "new-cap": [
198
- "error",
199
- {
200
- newIsCap: true,
201
- capIsNew: false,
202
- properties: true,
203
- },
204
- ],
205
-
206
- /**
207
- * Defined at: base-eslint.js
208
- *
209
- * Isaac enums use bitwise operators (e.g. "EntityFlag").
210
- */
211
- "no-bitwise": "off",
212
-
213
- /**
214
- * Defined at: base-eslint.js
215
- *
216
- * The Isaac API callback functions expect you to modify the provided object.
217
- */
218
- "no-param-reassign": "off",
219
-
220
- /**
221
- * Defined at: base-eslint.js
222
- *
223
- * "print" is used with Lua mods.
224
- */
225
- "no-restricted-globals": "off",
226
- },
227
- };
228
-
229
- module.exports = config;