@astrelion/eslint-config-astrel 1.3.0 → 1.3.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.
Files changed (3) hide show
  1. package/README.md +51 -1
  2. package/index.js +1 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # eslint-config-astrel
2
2
 
3
- Custom, general-purpose eslint rules by ASTRELION.
3
+ [![pipeline status](https://gitlab.com/ASTRELION/eslint-config-astrel/badges/main/pipeline.svg)](https://gitlab.com/ASTRELION/eslint-config-astrel/-/commits/main)
4
+ ![NPM Downloads](https://img.shields.io/npm/d18m/%40astrelion%2Feslint-config-astrel?label=NPM%20Downloads)
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,6 +21,7 @@ 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 }],
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": {
5
5
  "name": "ASTRELION"
6
6
  },
7
- "version": "1.3.0",
7
+ "version": "1.3.1",
8
8
  "keywords": [
9
9
  "eslint",
10
10
  "eslintconfig"