@adbayb/stack 0.0.0-next-730a06d → 0.0.0-next-1dfe647

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.
@@ -2,4 +2,9 @@ import { cwd } from "node:process";
2
2
 
3
3
  export const CWD = cwd();
4
4
 
5
- export const JAVASCRIPT_LIKE_FILES = ["**/*.{js,ts,jsx,tsx,cjs,cts,mjs,mts}"];
5
+ export const JAVASCRIPT_EXTENSIONS = ["**/*.{js,jsx,cjs,mjs}"];
6
+
7
+ export const JAVASCRIPT_LIKE_EXTENSIONS = [
8
+ ...JAVASCRIPT_EXTENSIONS,
9
+ "**/*.{ts,tsx,cts,mts}",
10
+ ];
@@ -11,12 +11,6 @@ import { config as eslintConfig } from "./presets/eslint.js";
11
11
  import { config as baseConfig } from "./presets/base.js";
12
12
  import { createConfig } from "./helpers.js";
13
13
 
14
- /**
15
- * TODO:
16
- * - Review TS rules: attempt to include all rules from https://typescript-eslint.io/users/configs/#strict-type-checked and https://typescript-eslint.io/users/configs/#stylistic-type-checked ?
17
- * - Review JSDoc rules.
18
- */
19
-
20
14
  export default createConfig(
21
15
  // The insertion order is important (last same config items overrides previous ones):
22
16
  ...baseConfig,
@@ -1,28 +1,50 @@
1
- import { JAVASCRIPT_LIKE_FILES } from "../constants.js";
1
+ import {
2
+ JAVASCRIPT_EXTENSIONS,
3
+ JAVASCRIPT_LIKE_EXTENSIONS,
4
+ } from "../constants.js";
2
5
 
3
6
  export const config = [
4
7
  {
5
- files: JAVASCRIPT_LIKE_FILES,
8
+ // Specific ESLint rules for javascript-only files (as they're already handled for TypeScript files by the transpiler):
9
+ // This rule list is taken from https://typescript-eslint.io/users/configs/#recommended
10
+ files: JAVASCRIPT_EXTENSIONS,
11
+ rules: {
12
+ "constructor-super": "error", // ts(2335) & ts(2377)
13
+ "getter-return": "error", // ts(2378)
14
+ "no-const-assign": "error", // ts(2588)
15
+ "no-dupe-args": "error", // ts(2300)
16
+ "no-dupe-class-members": "error", // ts(2393) & ts(2300)
17
+ "no-dupe-keys": "error", // ts(1117)
18
+ "no-func-assign": "error", // ts(2630)
19
+ "no-import-assign": "error", // ts(2632) & ts(2540)
20
+ "no-new-native-nonconstructor": "error", // ts(7009)
21
+ "no-obj-calls": "error", // ts(2349)
22
+ "no-redeclare": "error", // ts(2451)
23
+ "no-setter-return": "error", // ts(2408)
24
+ "no-this-before-super": "error", // ts(2376) & ts(17009)
25
+ "no-undef": "error", // ts(2304) & ts(2552)
26
+ "no-unreachable": "error", // ts(7027)
27
+ "no-unsafe-negation": "error", // ts(2365) & ts(2322) & ts(2358)
28
+ },
29
+ },
30
+ {
31
+ // ESLint rules for JavaScript + TypeScript files:
32
+ files: JAVASCRIPT_LIKE_EXTENSIONS,
6
33
  rules: {
7
- "constructor-super": "error",
8
34
  "eqeqeq": "error",
9
35
  "for-direction": "error",
10
- "getter-return": "error",
11
36
  "no-alert": "error",
12
37
  "no-async-promise-executor": "error",
13
38
  "no-case-declarations": "error",
14
39
  "no-class-assign": "error",
15
40
  "no-compare-neg-zero": "error",
16
41
  "no-cond-assign": "error",
17
- "no-const-assign": "error",
18
42
  "no-constant-binary-expression": "error",
19
43
  "no-constant-condition": "error",
20
44
  "no-control-regex": "error",
21
45
  "no-debugger": "error",
22
46
  "no-delete-var": "error",
23
- "no-dupe-args": "error",
24
47
  "no-dupe-else-if": "error",
25
- "no-dupe-keys": "error",
26
48
  "no-duplicate-case": "error",
27
49
  "no-empty": "error",
28
50
  "no-empty-character-class": "error",
@@ -31,19 +53,14 @@ export const config = [
31
53
  "no-ex-assign": "error",
32
54
  "no-extra-boolean-cast": "error",
33
55
  "no-fallthrough": "error",
34
- "no-func-assign": "error",
35
56
  "no-global-assign": "error",
36
- "no-import-assign": "error",
37
57
  "no-invalid-regexp": "error",
38
58
  "no-irregular-whitespace": "error",
39
59
  "no-loss-of-precision": "error",
40
60
  "no-misleading-character-class": "error",
41
- "no-new-native-nonconstructor": "error",
42
61
  "no-nonoctal-decimal-escape": "error",
43
- "no-obj-calls": "error",
44
62
  "no-octal": "error",
45
63
  "no-prototype-builtins": "error",
46
- "no-redeclare": "error",
47
64
  "no-regex-spaces": "error",
48
65
  "no-restricted-syntax": [
49
66
  "error",
@@ -54,15 +71,10 @@ export const config = [
54
71
  },
55
72
  ],
56
73
  "no-self-assign": "error",
57
- "no-setter-return": "error",
58
74
  "no-shadow-restricted-names": "error",
59
75
  "no-sparse-arrays": "error",
60
- "no-this-before-super": "error",
61
- "no-undef": "error",
62
76
  "no-unexpected-multiline": "error",
63
- "no-unreachable": "error",
64
77
  "no-unsafe-finally": "error",
65
- "no-unsafe-negation": "error",
66
78
  "no-unsafe-optional-chaining": "error",
67
79
  "no-unused-labels": "error",
68
80
  "no-unused-private-class-members": "error",
@@ -1,11 +1,11 @@
1
1
  import importPlugin from "eslint-plugin-import-x";
2
2
 
3
- import { JAVASCRIPT_LIKE_FILES } from "../constants.js";
3
+ import { JAVASCRIPT_LIKE_EXTENSIONS } from "../constants.js";
4
4
 
5
5
  export const config = [
6
6
  importPlugin.flatConfigs.typescript,
7
7
  {
8
- files: JAVASCRIPT_LIKE_FILES,
8
+ files: JAVASCRIPT_LIKE_EXTENSIONS,
9
9
  plugins: {
10
10
  "import-x": importPlugin,
11
11
  },
@@ -1,10 +1,10 @@
1
1
  import jsdocPlugin from "eslint-plugin-jsdoc";
2
2
 
3
- import { JAVASCRIPT_LIKE_FILES } from "../constants.js";
3
+ import { JAVASCRIPT_LIKE_EXTENSIONS } from "../constants.js";
4
4
 
5
5
  export const config = [
6
6
  {
7
- files: JAVASCRIPT_LIKE_FILES,
7
+ files: JAVASCRIPT_LIKE_EXTENSIONS,
8
8
  plugins: {
9
9
  jsdoc: jsdocPlugin,
10
10
  },
@@ -25,6 +25,7 @@ export const config = [
25
25
  "jsdoc/multiline-blocks": "error",
26
26
  "jsdoc/no-bad-blocks": "error",
27
27
  "jsdoc/no-blank-block-descriptions": "error",
28
+ "jsdoc/no-blank-blocks": "error",
28
29
  "jsdoc/no-defaults": "error",
29
30
  "jsdoc/no-multi-asterisks": "error",
30
31
  "jsdoc/no-types": "error",
@@ -3,11 +3,11 @@ import { join } from "node:path";
3
3
  import nodePlugin from "eslint-plugin-n";
4
4
 
5
5
  import { require } from "../helpers.js";
6
- import { CWD, JAVASCRIPT_LIKE_FILES } from "../constants.js";
6
+ import { CWD, JAVASCRIPT_LIKE_EXTENSIONS } from "../constants.js";
7
7
 
8
8
  export const config = [
9
9
  {
10
- files: JAVASCRIPT_LIKE_FILES,
10
+ files: JAVASCRIPT_LIKE_EXTENSIONS,
11
11
  plugins: {
12
12
  n: nodePlugin,
13
13
  },
@@ -1,10 +1,10 @@
1
1
  import sonarjsPlugin from "eslint-plugin-sonarjs";
2
2
 
3
- import { JAVASCRIPT_LIKE_FILES } from "../constants.js";
3
+ import { JAVASCRIPT_LIKE_EXTENSIONS } from "../constants.js";
4
4
 
5
5
  export const config = [
6
6
  {
7
- files: JAVASCRIPT_LIKE_FILES,
7
+ files: JAVASCRIPT_LIKE_EXTENSIONS,
8
8
  plugins: {
9
9
  sonarjs: sonarjsPlugin,
10
10
  },
@@ -175,8 +175,6 @@ export const config = [
175
175
  "sonarjs/prefer-object-spread": "error",
176
176
  "sonarjs/prefer-promise-shorthand": "error",
177
177
  "sonarjs/prefer-single-boolean-return": "error",
178
- "sonarjs/prefer-spread": "error",
179
- "sonarjs/prefer-string-starts-ends-with": "error",
180
178
  "sonarjs/prefer-type-guard": "error",
181
179
  "sonarjs/prefer-while": "error",
182
180
  "sonarjs/production-debug": "error",
@@ -1,10 +1,10 @@
1
1
  import tseslint from "typescript-eslint";
2
2
 
3
- import { CWD, JAVASCRIPT_LIKE_FILES } from "../constants.js";
3
+ import { CWD, JAVASCRIPT_LIKE_EXTENSIONS } from "../constants.js";
4
4
 
5
5
  export const config = [
6
6
  {
7
- files: JAVASCRIPT_LIKE_FILES,
7
+ files: JAVASCRIPT_LIKE_EXTENSIONS,
8
8
  languageOptions: {
9
9
  parser: tseslint.parser,
10
10
  parserOptions: {
@@ -33,6 +33,7 @@ export const config = [
33
33
  "ts-nocheck": "allow-with-description",
34
34
  },
35
35
  ],
36
+ "@typescript-eslint/ban-tslint-comment": "error",
36
37
  "@typescript-eslint/class-literal-property-style": ["error", "fields"],
37
38
  "@typescript-eslint/class-methods-use-this": "error",
38
39
  "@typescript-eslint/consistent-generic-constructors": [
@@ -69,6 +70,7 @@ export const config = [
69
70
  ],
70
71
  "@typescript-eslint/method-signature-style": ["error", "property"],
71
72
  "@typescript-eslint/no-array-constructor": "error",
73
+ "@typescript-eslint/no-array-delete": "error",
72
74
  "@typescript-eslint/no-base-to-string": "error",
73
75
  "@typescript-eslint/no-confusing-non-null-assertion": "error",
74
76
  "@typescript-eslint/no-confusing-void-expression": "error",
@@ -94,7 +96,6 @@ export const config = [
94
96
  "@typescript-eslint/no-invalid-this": "error",
95
97
  "@typescript-eslint/no-invalid-void-type": "error",
96
98
  "@typescript-eslint/no-loop-func": "error",
97
- "@typescript-eslint/no-loss-of-precision": "error",
98
99
  "@typescript-eslint/no-meaningless-void-operator": "error",
99
100
  "@typescript-eslint/no-misused-new": "error",
100
101
  "@typescript-eslint/no-misused-promises": "error",
@@ -103,12 +104,14 @@ export const config = [
103
104
  "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
104
105
  "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
105
106
  "@typescript-eslint/no-non-null-assertion": "error",
107
+ "@typescript-eslint/no-redundant-type-constituents": "error",
106
108
  "@typescript-eslint/no-require-imports": "error",
107
109
  "@typescript-eslint/no-shadow": "error",
108
110
  "@typescript-eslint/no-this-alias": "error",
109
111
  "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
110
112
  "@typescript-eslint/no-unnecessary-condition": "error",
111
113
  "@typescript-eslint/no-unnecessary-qualifier": "error",
114
+ "@typescript-eslint/no-unnecessary-template-expression": "error",
112
115
  "@typescript-eslint/no-unnecessary-type-arguments": "error",
113
116
  "@typescript-eslint/no-unnecessary-type-assertion": "error",
114
117
  "@typescript-eslint/no-unnecessary-type-constraint": "error",
@@ -137,21 +140,43 @@ export const config = [
137
140
  "@typescript-eslint/prefer-namespace-keyword": "error",
138
141
  "@typescript-eslint/prefer-nullish-coalescing": "error",
139
142
  "@typescript-eslint/prefer-optional-chain": "error",
143
+ "@typescript-eslint/prefer-promise-reject-errors": "error",
140
144
  "@typescript-eslint/prefer-readonly": "error",
145
+ "@typescript-eslint/prefer-reduce-type-parameter": "error",
141
146
  "@typescript-eslint/prefer-regexp-exec": "error",
142
147
  "@typescript-eslint/prefer-return-this-type": "error",
143
148
  "@typescript-eslint/prefer-string-starts-ends-with": "error",
144
149
  "@typescript-eslint/prefer-ts-expect-error": "error",
145
150
  "@typescript-eslint/promise-function-async": "error",
146
151
  "@typescript-eslint/require-await": "error",
147
- "@typescript-eslint/restrict-plus-operands": "error",
148
- "@typescript-eslint/restrict-template-expressions": "error",
152
+ "@typescript-eslint/restrict-plus-operands": [
153
+ "error",
154
+ {
155
+ allowAny: false,
156
+ allowBoolean: false,
157
+ allowNullish: false,
158
+ allowNumberAndString: false,
159
+ allowRegExp: false,
160
+ },
161
+ ],
162
+ "@typescript-eslint/restrict-template-expressions": [
163
+ "error",
164
+ {
165
+ allowAny: false,
166
+ allowBoolean: false,
167
+ allowNever: false,
168
+ allowNullish: false,
169
+ allowNumber: false,
170
+ allowRegExp: false,
171
+ },
172
+ ],
149
173
  "@typescript-eslint/return-await": "error",
150
174
  "@typescript-eslint/sort-type-constituents": "error",
151
175
  "@typescript-eslint/switch-exhaustiveness-check": "error",
152
176
  "@typescript-eslint/triple-slash-reference": "error",
153
177
  "@typescript-eslint/unbound-method": "error",
154
178
  "@typescript-eslint/unified-signatures": "error",
179
+ "@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
155
180
  },
156
181
  },
157
182
  ];
@@ -1,11 +1,11 @@
1
1
  import sortKeysCustomOrderPlugin from "eslint-plugin-sort-keys-custom-order";
2
2
  import { FlatCompat } from "@eslint/eslintrc";
3
3
 
4
- import { JAVASCRIPT_LIKE_FILES } from "../constants.js";
4
+ import { JAVASCRIPT_LIKE_EXTENSIONS } from "../constants.js";
5
5
 
6
6
  export const config = [
7
7
  {
8
- files: JAVASCRIPT_LIKE_FILES,
8
+ files: JAVASCRIPT_LIKE_EXTENSIONS,
9
9
  plugins: {
10
10
  "sort-keys-custom-order": sortKeysCustomOrderPlugin,
11
11
  },
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { existsSync, cpSync, readFileSync, renameSync, writeFileSync, readdirSyn
6
6
  import { writeFile, chmod, mkdir, symlink } from 'node:fs/promises';
7
7
  import { fdir } from 'fdir';
8
8
 
9
- var version = "0.0.0-next-730a06d";
9
+ var version = "0.0.0-next-1dfe647";
10
10
 
11
11
  const VERSION = version;
12
12
 
@@ -299,7 +299,7 @@ const createInstallCommand = (program)=>{
299
299
  }).task({
300
300
  label: label$4("Installing `git.commit-msg` hook"),
301
301
  async handler () {
302
- await installGitHook("commit-msg", `${getStackCommand("check --only commit", false)}`);
302
+ await installGitHook("commit-msg", getStackCommand("check --only commit", false));
303
303
  }
304
304
  });
305
305
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adbayb/stack",
3
- "version": "0.0.0-next-730a06d",
3
+ "version": "0.0.0-next-1dfe647",
4
4
  "description": "My opinionated JavaScript-based toolchain",
5
5
  "publishConfig": {
6
6
  "access": "public"