@adbayb/stack 0.0.0-next-d23a669 → 0.0.0-next-912a585

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.
@@ -1,7 +1,39 @@
1
1
  <br>
2
2
  <div align="center">
3
- <h1>@adbayb/stack/eslint</h1>
3
+ <h1>@adbayb/stack/typescript</h1>
4
4
  <strong>My opinionated linter standards</strong>
5
5
  </div>
6
6
  <br>
7
7
  <br>
8
+
9
+ ## ✨ Features
10
+
11
+ This package offers opinionated but extensible **[ESLint](https://eslint.org/)** configurations to align logical and stylistic rules across my projects.
12
+
13
+ It allows to:
14
+
15
+ - Make collaboration across my projects effective (including onboarding with a consistent look and writing patterns).
16
+ - Include a minimum viable and required set of rules to foster maintainable, testable, secure, and green code over time.
17
+ - Accelerate development by reusing common configuration and convention defaults.
18
+
19
+ <br />
20
+
21
+ ## 🚀 Quick Start
22
+
23
+ ### 1️⃣ Installation
24
+
25
+ At the root level of your project, run the following command:
26
+
27
+ ```bash
28
+ pnpm add @adbayb/stack --save-dev --workspace-root
29
+ ```
30
+
31
+ ### 2️⃣ Usage
32
+
33
+ Create a `eslint.config.js` file and include the following:
34
+
35
+ ```ts
36
+ export { default } from "@adbayb/stack/eslint";
37
+ ```
38
+
39
+ <br />
@@ -1,6 +1,7 @@
1
1
  import { config as uncategorizedConfig } from "./presets/uncategorized.js";
2
2
  import { config as typescriptConfig } from "./presets/typescript.js";
3
3
  import { config as testConfig } from "./presets/test.js";
4
+ import { config as stylisticConfig } from "./presets/stylistic.js";
4
5
  import { config as sonarConfig } from "./presets/sonar.js";
5
6
  import { config as reactConfig } from "./presets/react.js";
6
7
  import { config as overridableConfig } from "./presets/overridable.js";
@@ -17,10 +18,11 @@ export default createConfig(
17
18
  ...eslintConfig,
18
19
  ...typescriptConfig,
19
20
  ...importConfig,
20
- ...nodeConfig,
21
- ...sonarConfig,
22
21
  ...jsdocConfig,
22
+ ...nodeConfig,
23
23
  ...reactConfig,
24
+ ...sonarConfig,
25
+ ...stylisticConfig,
24
26
  ...testConfig,
25
27
  ...uncategorizedConfig,
26
28
  ...overridableConfig,
@@ -5,8 +5,10 @@ import {
5
5
 
6
6
  export const config = [
7
7
  {
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
8
+ /*
9
+ * Specific ESLint rules for javascript-only files (as they're already handled for TypeScript files by the transpiler):
10
+ * This rule list is taken from https://typescript-eslint.io/users/configs/#recommended
11
+ */
10
12
  files: JAVASCRIPT_EXTENSIONS,
11
13
  rules: {
12
14
  "constructor-super": "error", // ts(2335) & ts(2377)
@@ -84,54 +86,6 @@ export const config = [
84
86
  "no-var": "error",
85
87
  "no-with": "error",
86
88
  "object-shorthand": ["error", "always"],
87
- "padding-line-between-statements": [
88
- "error",
89
- {
90
- blankLine: "always",
91
- next: "*",
92
- prev: "*",
93
- },
94
- {
95
- blankLine: "never",
96
- next: ["const", "let", "var"],
97
- prev: ["const", "let", "var"],
98
- },
99
- {
100
- blankLine: "never",
101
- next: ["case", "default"],
102
- prev: ["case", "default"],
103
- },
104
- {
105
- blankLine: "always",
106
- next: ["const", "let", "var"],
107
- prev: ["multiline-const", "multiline-let", "multiline-var"],
108
- },
109
- {
110
- blankLine: "always",
111
- next: ["multiline-const", "multiline-let", "multiline-var"],
112
- prev: ["const", "let", "var"],
113
- },
114
- {
115
- blankLine: "any",
116
- next: ["expression"],
117
- prev: ["expression"],
118
- },
119
- {
120
- blankLine: "any",
121
- next: ["const", "let", "var"],
122
- prev: ["cjs-import"],
123
- },
124
- {
125
- blankLine: "any",
126
- next: ["cjs-import", "import"],
127
- prev: ["cjs-import", "import"],
128
- },
129
- {
130
- blankLine: "any",
131
- next: ["cjs-export", "export"],
132
- prev: ["cjs-export", "export"],
133
- },
134
- ],
135
89
  "prefer-arrow-callback": ["error", { allowNamedFunctions: true }],
136
90
  "prefer-const": "error",
137
91
  "prefer-rest-params": "error",
@@ -1,8 +1,69 @@
1
- import { JAVASCRIPT_LIKE_EXTENSIONS } from "../constants";
1
+ import stylistic from "@stylistic/eslint-plugin";
2
+
3
+ import { JAVASCRIPT_LIKE_EXTENSIONS } from "../constants.js";
2
4
 
3
5
  export const config = [
4
6
  {
5
7
  files: JAVASCRIPT_LIKE_EXTENSIONS,
6
- rules: {},
8
+ plugins: {
9
+ "@stylistic": stylistic,
10
+ },
11
+ rules: {
12
+ "@stylistic/lines-between-class-members": ["error", "always"],
13
+ "@stylistic/multiline-comment-style": ["error", "starred-block"],
14
+ "@stylistic/padding-line-between-statements": [
15
+ "error",
16
+ {
17
+ blankLine: "always",
18
+ next: "*",
19
+ prev: "*",
20
+ },
21
+ {
22
+ blankLine: "never",
23
+ next: ["const", "let", "var"],
24
+ prev: ["const", "let", "var"],
25
+ },
26
+ {
27
+ blankLine: "never",
28
+ next: ["case", "default"],
29
+ prev: ["case", "default"],
30
+ },
31
+ {
32
+ blankLine: "always",
33
+ next: ["const", "let", "var"],
34
+ prev: ["multiline-const", "multiline-let", "multiline-var"],
35
+ },
36
+ {
37
+ blankLine: "always",
38
+ next: ["multiline-const", "multiline-let", "multiline-var"],
39
+ prev: ["const", "let", "var"],
40
+ },
41
+ {
42
+ blankLine: "any",
43
+ next: ["expression"],
44
+ prev: ["expression"],
45
+ },
46
+ {
47
+ blankLine: "any",
48
+ next: ["const", "let", "var"],
49
+ prev: ["cjs-import"],
50
+ },
51
+ {
52
+ blankLine: "any",
53
+ next: ["cjs-import", "import"],
54
+ prev: ["cjs-import", "import"],
55
+ },
56
+ {
57
+ blankLine: "any",
58
+ next: ["cjs-export", "export"],
59
+ prev: ["cjs-export", "export"],
60
+ },
61
+ ],
62
+ "@stylistic/spaced-comment": [
63
+ "error",
64
+ "always",
65
+ { block: { balanced: true } },
66
+ ],
67
+ },
7
68
  },
8
69
  ];
@@ -10,7 +10,6 @@ export const config = [
10
10
  "sort-keys-custom-order": sortKeysCustomOrderPlugin,
11
11
  },
12
12
  rules: {
13
- //#region sort-keys-custom-order
14
13
  "sort-keys-custom-order/object-keys": [
15
14
  "error",
16
15
  {
@@ -23,7 +22,6 @@ export const config = [
23
22
  orderedKeys: ["id", "key", "name", "title", "label", "description"],
24
23
  },
25
24
  ],
26
- //#endregion
27
25
  },
28
26
  },
29
27
  ...new FlatCompat().extends("plugin:mdx/recommended").map((mdxConfig) => ({
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## ✨ Features
10
10
 
11
- This package offers an opinionated but extensible **[Prettier](https://prettier.io/)** configurations to align formatting rules and standards across my projects.
11
+ This package offers opinionated but extensible **[Prettier](https://prettier.io/)** configurations to align formatting rules and standards across my projects.
12
12
 
13
13
  It allows to:
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## ✨ Features
10
10
 
11
- This package offers an opinionated but extensible **[TSConfigs](https://www.typescriptlang.org/tsconfig/)** to align TypeScript configurations across my projects.
11
+ This package offers opinionated but extensible **[TypeScript](https://www.typescriptlang.org/tsconfig/)** configurations to align type-checking and processing standards across my projects.
12
12
 
13
13
  It allows to:
14
14
 
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-d23a669";
9
+ var version = "0.0.0-next-912a585";
10
10
 
11
11
  const VERSION = version;
12
12
 
@@ -66,10 +66,11 @@ const getNpmVersion = async ()=>{
66
66
  }
67
67
  };
68
68
  const getStackCommand = (command, isNodeRuntime = true)=>{
69
- // @note: `isNodeRuntime` allows executing node bin executables in a non node environment such as in git hooks context
70
- // Npx is used to make executable resolution independent from the build tool (npx is the built-in Node tool)
71
- // `--no` flag to prevent installation prompt and throw an error if the binary is not installed
72
- return [
69
+ /**
70
+ * `isNodeRuntime` allows executing node bin executables in a non node environment such as in git hooks context
71
+ * Npx is used to make executable resolution independent from the build tool (npx is the built-in Node tool)
72
+ * `--no` flag to prevent installation prompt and throw an error if the binary is not installed.
73
+ */ return [
73
74
  ...isNodeRuntime ? [] : [
74
75
  "npx --no"
75
76
  ],
@@ -598,9 +599,10 @@ const createCheckCommand = (program)=>{
598
599
  await checkTypes();
599
600
  },
600
601
  skip (context, argv) {
601
- return ifOnlyDefinedAndNotEqualTo("type")(context) || !hasDependency("typescript") || // For now, skip type-checking if some files are passed down
602
- // @see: https://github.com/microsoft/TypeScript/issues/27379
603
- argv.operands.length > 0;
602
+ return ifOnlyDefinedAndNotEqualTo("type")(context) || !hasDependency("typescript") || /**
603
+ * For now, skip type-checking if some files are passed down.
604
+ * @see https://github.com/microsoft/TypeScript/issues/27379
605
+ */ argv.operands.length > 0;
604
606
  }
605
607
  }).task({
606
608
  label: label("Checking commit"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adbayb/stack",
3
- "version": "0.0.0-next-d23a669",
3
+ "version": "0.0.0-next-912a585",
4
4
  "description": "My opinionated JavaScript-based toolchain",
5
5
  "publishConfig": {
6
6
  "access": "public"