@astrelion/eslint-config-astrel 1.3.0 → 1.4.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/README.md +51 -1
- package/index.js +2 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# eslint-config-astrel
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://gitlab.com/ASTRELION/eslint-config-astrel/-/commits/main)
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
Custom, general-purpose [ESLint](https://eslint.org) rules by ASTRELION.
|
|
4
7
|
|
|
5
8
|
## Rule Overview
|
|
6
9
|
|
|
@@ -20,3 +23,50 @@ Custom, general-purpose eslint rules by ASTRELION.
|
|
|
20
23
|
- Warn against `any` types
|
|
21
24
|
- Require explicit return types
|
|
22
25
|
- No unused variables, unless prefixed with `_`
|
|
26
|
+
- Switch cases must be exhaustive
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
Add `@astrelion/eslint-config-astrel` to your dev dependencies. For example,
|
|
31
|
+
with `bun install -D @astrelion/eslint-config-astrel`.
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@astrelion/eslint-config-astrel": "^X.X.X",
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
In your ESLint [configuration
|
|
42
|
+
file](https://eslint.org/docs/latest/use/configure/configuration-files), import
|
|
43
|
+
the package and spread the config into your configuration. For example:
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
import pluginJs from "@eslint/js";
|
|
47
|
+
import tseslint from "typescript-eslint";
|
|
48
|
+
import astrel from "@astrelion/eslint-config-astrel"; // import here
|
|
49
|
+
|
|
50
|
+
/** @type { import("eslint").Linter.Config[] } */
|
|
51
|
+
export default [
|
|
52
|
+
{ files: ["**/*.{js,mjs,cjs,ts}"] },
|
|
53
|
+
pluginJs.configs.recommended,
|
|
54
|
+
...tseslint.configs.recommendedTypeChecked,
|
|
55
|
+
...astrel, // added to local config here
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Done!
|
|
61
|
+
|
|
62
|
+
### VSCode Autoformat
|
|
63
|
+
|
|
64
|
+
Add the following to your [`settings.json`](https://code.visualstudio.com/docs/getstarted/settings#_settings-json-file):
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"editor.codeActionsOnSave": {
|
|
69
|
+
"source.fixAll.eslint": "always"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
package/index.js
CHANGED
|
@@ -21,10 +21,12 @@ const config = ts.config(
|
|
|
21
21
|
argsIgnorePattern: "^_",
|
|
22
22
|
},
|
|
23
23
|
],
|
|
24
|
+
"@typescript-eslint/switch-exhaustiveness-check": ["error", { "considerDefaultExhaustiveForUnions": true }],
|
|
24
25
|
|
|
25
26
|
// https://eslint.style/rules
|
|
26
27
|
"@stylistic/brace-style": ["warn", "allman", { "allowSingleLine": true }],
|
|
27
28
|
"@stylistic/comma-dangle": ["warn", "always-multiline"],
|
|
29
|
+
"@stylistic/comma-spacing": ["warn"],
|
|
28
30
|
"@stylistic/indent": ["warn", 4],
|
|
29
31
|
"@stylistic/no-extra-semi": ["error"],
|
|
30
32
|
"@stylistic/no-tabs": ["warn"],
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "ASTRELION"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.4.0",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"eslint",
|
|
10
10
|
"eslintconfig"
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"semantic-release": "^24.2.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"eslint": "
|
|
27
|
+
"eslint": "^9.17.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@stylistic/eslint-plugin": "^2.12.1",
|
|
31
31
|
"@stylistic/eslint-plugin-ts": "^2.12.1",
|
|
32
|
-
"typescript-eslint": "^8.18.
|
|
32
|
+
"typescript-eslint": "^8.18.2"
|
|
33
33
|
}
|
|
34
34
|
}
|