@xsynaptic/eslint-config 1.0.3 → 2.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.
- package/package.json +9 -10
- package/readme.md +1 -1
- package/src/get-config.ts +4 -46
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsynaptic/eslint-config",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "A common ESLint config factory for TypeScript
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "A common ESLint config factory for TypeScript projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "./src/get-config.ts",
|
|
@@ -10,16 +10,15 @@
|
|
|
10
10
|
"check-types": "tsc --noEmit --extendedDiagnostics"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@eslint/js": "^9.
|
|
14
|
-
"eslint": "^9.
|
|
15
|
-
"eslint-plugin-
|
|
16
|
-
"eslint-plugin-import": "^2.31.0",
|
|
13
|
+
"@eslint/js": "^9.30.1",
|
|
14
|
+
"eslint": "^9.30.1",
|
|
15
|
+
"eslint-plugin-import": "^2.32.0",
|
|
17
16
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
18
|
-
"eslint-plugin-perfectionist": "^4.
|
|
17
|
+
"eslint-plugin-perfectionist": "^4.15.0",
|
|
19
18
|
"eslint-plugin-unicorn": "^59.0.1",
|
|
20
|
-
"globals": "^16.
|
|
21
|
-
"prettier": "^3.
|
|
22
|
-
"typescript-eslint": "^8.
|
|
19
|
+
"globals": "^16.3.0",
|
|
20
|
+
"prettier": "^3.6.2",
|
|
21
|
+
"typescript-eslint": "^8.35.1"
|
|
23
22
|
},
|
|
24
23
|
"devDependencies": {
|
|
25
24
|
"jiti": "^2.4.2",
|
package/readme.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
# ESLint Config
|
|
2
2
|
|
|
3
|
-
This is a shared ESLint config for use with several TypeScript projects
|
|
3
|
+
This is a shared ESLint config for use with several TypeScript projects. It is not intended for public consumption.
|
package/src/get-config.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ConfigArray } from "typescript-eslint";
|
|
2
2
|
|
|
3
3
|
import eslint from "@eslint/js";
|
|
4
|
-
import astroPlugin from "eslint-plugin-astro";
|
|
5
4
|
import perfectionist from "eslint-plugin-perfectionist";
|
|
6
5
|
import unicornPlugin from "eslint-plugin-unicorn";
|
|
7
6
|
import globals from "globals";
|
|
@@ -11,11 +10,10 @@ export function getConfig(
|
|
|
11
10
|
customConfig?: ConfigArray,
|
|
12
11
|
options?: {
|
|
13
12
|
customGlobals?: Record<string, "readonly" | "writeable">;
|
|
14
|
-
|
|
13
|
+
parserOptions?: NonNullable<ConfigArray[number]["languageOptions"]>["parserOptions"];
|
|
15
14
|
},
|
|
16
15
|
) {
|
|
17
16
|
const customGlobals = options?.customGlobals ?? {};
|
|
18
|
-
const withAstro = options?.withAstro ?? false;
|
|
19
17
|
|
|
20
18
|
const baseConfig = [
|
|
21
19
|
eslint.configs.recommended,
|
|
@@ -29,10 +27,9 @@ export function getConfig(
|
|
|
29
27
|
...customGlobals,
|
|
30
28
|
},
|
|
31
29
|
parser: tseslint.parser,
|
|
32
|
-
parserOptions: {
|
|
33
|
-
// projectService: true, // Astro ecosystem tools can't use this yet; 2024Q4
|
|
30
|
+
parserOptions: options?.parserOptions ?? {
|
|
34
31
|
projectService: true,
|
|
35
|
-
|
|
32
|
+
project: ["./tsconfig.json"],
|
|
36
33
|
},
|
|
37
34
|
},
|
|
38
35
|
plugins: {
|
|
@@ -89,44 +86,5 @@ export function getConfig(
|
|
|
89
86
|
},
|
|
90
87
|
] satisfies ConfigArray;
|
|
91
88
|
|
|
92
|
-
|
|
93
|
-
* Astro support; with some help from...
|
|
94
|
-
* @reference - https://github.com/Princesseuh/erika.florist/blob/main/eslint.config.js
|
|
95
|
-
*/
|
|
96
|
-
const astroConfig = [
|
|
97
|
-
...astroPlugin.configs["flat/recommended"],
|
|
98
|
-
...astroPlugin.configs["jsx-a11y-strict"],
|
|
99
|
-
|
|
100
|
-
// Remove some safety rules around `any` for various reasons
|
|
101
|
-
// Astro.props isn't typed correctly in some contexts, so a bunch of things ends up being `any`
|
|
102
|
-
{
|
|
103
|
-
files: ["**/*.astro"],
|
|
104
|
-
rules: {
|
|
105
|
-
"@typescript-eslint/no-unsafe-argument": "off",
|
|
106
|
-
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
107
|
-
"@typescript-eslint/no-unsafe-call": "off",
|
|
108
|
-
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
109
|
-
"@typescript-eslint/no-unsafe-return": "off",
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
// Disable typed rules for scripts inside Astro files
|
|
114
|
-
// https://github.com/ota-meshi/eslint-plugin-astro/issues/240
|
|
115
|
-
{
|
|
116
|
-
files: ["**/*.astro/*.ts"],
|
|
117
|
-
languageOptions: {
|
|
118
|
-
parserOptions: {
|
|
119
|
-
// eslint-disable-next-line unicorn/no-null
|
|
120
|
-
project: null,
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
...tseslint.configs.disableTypeChecked,
|
|
124
|
-
},
|
|
125
|
-
] satisfies ConfigArray;
|
|
126
|
-
|
|
127
|
-
return tseslint.config([
|
|
128
|
-
...baseConfig,
|
|
129
|
-
...(withAstro ? astroConfig : []),
|
|
130
|
-
...(customConfig ?? []),
|
|
131
|
-
]);
|
|
89
|
+
return tseslint.config([...baseConfig, ...(customConfig ?? [])]);
|
|
132
90
|
}
|