eslint-config-isaacscript 5.0.2 → 6.0.1
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/package.json +8 -8
- package/src/mod.js +61 -15
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-isaacscript",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "A sharable ESLint config for
|
|
3
|
+
"version": "6.0.1",
|
|
4
|
+
"description": "A sharable ESLint config for IsaacScript projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
7
7
|
"config",
|
|
@@ -24,19 +24,19 @@
|
|
|
24
24
|
"type": "module",
|
|
25
25
|
"main": "./src/index.js",
|
|
26
26
|
"files": [
|
|
27
|
-
"LICENSE",
|
|
28
|
-
"package.json",
|
|
29
|
-
"README.md",
|
|
30
27
|
"src"
|
|
31
28
|
],
|
|
32
29
|
"scripts": {
|
|
33
30
|
"lint": "tsx ./scripts/lint.ts"
|
|
34
31
|
},
|
|
35
32
|
"dependencies": {
|
|
36
|
-
"eslint-plugin-isaacscript": "
|
|
37
|
-
"typescript-eslint": "
|
|
33
|
+
"eslint-plugin-isaacscript": "4.0.0",
|
|
34
|
+
"typescript-eslint": "8.43.0"
|
|
38
35
|
},
|
|
39
36
|
"devDependencies": {
|
|
40
|
-
"complete-node": "
|
|
37
|
+
"complete-node": "12.0.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"eslint": ">= 9.0.0"
|
|
41
41
|
}
|
|
42
42
|
}
|
package/src/mod.js
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
import ESLintPluginIsaacScript from "eslint-plugin-isaacscript";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
// Hot-patch "eslint-plugin-isaacscript" to convert errors to warnings.
|
|
5
|
-
for (const config of ESLintPluginIsaacScript.configs.recommended) {
|
|
6
|
-
if (config.rules !== undefined) {
|
|
7
|
-
for (const [key, value] of Object.entries(config.rules)) {
|
|
8
|
-
if (value === "error") {
|
|
9
|
-
config.rules[key] = "warn";
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
2
|
+
import { defineConfig } from "eslint/config";
|
|
14
3
|
|
|
15
4
|
/**
|
|
16
5
|
* This ESLint config is meant to be used as a base for IsaacScript mods (or TypeScriptToLua
|
|
17
6
|
* projects).
|
|
18
7
|
*/
|
|
19
|
-
export const isaacScriptModConfigBase =
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
export const isaacScriptModConfigBase = defineConfig(
|
|
9
|
+
{
|
|
10
|
+
plugins: {
|
|
11
|
+
// TODO: The `defineConfig` helper function is bugged.
|
|
12
|
+
// @ts-expect-error https://github.com/typescript-eslint/typescript-eslint/issues/11543
|
|
13
|
+
isaacscript: ESLintPluginIsaacScript,
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
rules: {
|
|
17
|
+
"isaacscript/enum-member-number-separation": "warn",
|
|
18
|
+
"isaacscript/no-invalid-default-map": "warn",
|
|
19
|
+
"isaacscript/no-throw": "warn",
|
|
20
|
+
"isaacscript/require-v-registration": "warn",
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
// Rules that require type information will throw an error on ".json" files. (This is needed
|
|
24
|
+
// when using `eslint-plugin-package-json`. Even though this config does not currently use the
|
|
25
|
+
// plugin, we include it here defensively.)
|
|
26
|
+
ignores: ["*.json", "*.jsonc"],
|
|
27
|
+
},
|
|
22
28
|
|
|
23
29
|
{
|
|
24
30
|
rules: {
|
|
@@ -199,5 +205,45 @@ export const isaacScriptModConfigBase = tseslint.config(
|
|
|
199
205
|
*/
|
|
200
206
|
"no-restricted-globals": "off",
|
|
201
207
|
},
|
|
208
|
+
|
|
209
|
+
// Rules that require type information will throw an error on ".json" files. (This is needed
|
|
210
|
+
// when using `eslint-plugin-package-json`. Even though this config does not currently use the
|
|
211
|
+
// plugin, we include it here defensively.)
|
|
212
|
+
ignores: ["*.json", "*.jsonc"],
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
{
|
|
216
|
+
files: [
|
|
217
|
+
"eslint.config.js",
|
|
218
|
+
"eslint.config.cjs",
|
|
219
|
+
"eslint.config.mjs",
|
|
220
|
+
"eslint.config.ts",
|
|
221
|
+
"eslint.config.cts",
|
|
222
|
+
"eslint.config.mts",
|
|
223
|
+
],
|
|
224
|
+
rules: {
|
|
225
|
+
// TypeScript projects that use "complete-lint" have a false positive when importing
|
|
226
|
+
// "defineConfig" from "eslint/config", because "eslint" is a transitive dependency in
|
|
227
|
+
// "complete-lint". Similarly, importing "completeConfigBase" from "eslint-config-complete"
|
|
228
|
+
// fails, because "eslint-config-complete" is a transitive dependency in "complete-lint". (We
|
|
229
|
+
// extend the logic from "eslint-config-complete" and add a new value for
|
|
230
|
+
// "eslint-config-isaacscript.")
|
|
231
|
+
"import-x/no-extraneous-dependencies": [
|
|
232
|
+
"warn",
|
|
233
|
+
{
|
|
234
|
+
devDependencies: ["**/eslint.config.{js,cjs,mjs,ts,cts,mts}"],
|
|
235
|
+
optionalDependencies: false,
|
|
236
|
+
whitelist: [
|
|
237
|
+
"eslint",
|
|
238
|
+
"eslint-config-complete",
|
|
239
|
+
"eslint-config-isaacscript",
|
|
240
|
+
],
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
|
|
244
|
+
// ESLint configuration files in monorepos often intentionally import from the "packages"
|
|
245
|
+
// subdirectory, because the config files are JavaScript so they cannot use tsconfig-paths.
|
|
246
|
+
"import-x/no-relative-packages": "off",
|
|
247
|
+
},
|
|
202
248
|
},
|
|
203
249
|
);
|