@peerigon/configs 4.3.0-beta.1 → 4.3.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/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ # [4.3.0](https://github.com/peerigon/configs/compare/v4.2.0...v4.3.0) (2025-03-24)
2
+
3
+ ### Bug Fixes
4
+
5
+ - **eslint:** Turn of unicorn/consistent-function-scoping ([6570db3](https://github.com/peerigon/configs/commit/6570db32a4037f0e00d99cfacc95a024f9892b95))
6
+
7
+ ### Features
8
+
9
+ - Compile JS code instead of just emitDeclarationOnly ([c7d29f7](https://github.com/peerigon/configs/commit/c7d29f700ee53aa6be5b16175b355f000fba778c))
10
+ - **typescript:** Change base target to es2024 ([58b217a](https://github.com/peerigon/configs/commit/58b217ab0e4d64b7b969f1dbda748886f11009c5))
11
+
12
+ # [4.3.0-beta.2](https://github.com/peerigon/configs/compare/v4.3.0-beta.1...v4.3.0-beta.2) (2025-03-23)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **eslint:** Turn of unicorn/consistent-function-scoping ([6570db3](https://github.com/peerigon/configs/commit/6570db32a4037f0e00d99cfacc95a024f9892b95))
17
+
18
+ ### Features
19
+
20
+ - **typescript:** Change base target to es2024 ([58b217a](https://github.com/peerigon/configs/commit/58b217ab0e4d64b7b969f1dbda748886f11009c5))
21
+
1
22
  # [4.3.0-beta.1](https://github.com/peerigon/configs/compare/v4.2.0...v4.3.0-beta.1) (2025-03-12)
2
23
 
3
24
  ### Features
@@ -4,17 +4,17 @@ const camelcase = {
4
4
  properties: "always",
5
5
  };
6
6
  export const ruleOptions = {
7
- ["camelcase"]: camelcase,
8
- ["max-lines"]: {
7
+ camelcase,
8
+ "max-lines": {
9
9
  max: 700,
10
10
  skipBlankLines: true,
11
11
  skipComments: true,
12
12
  },
13
- ["no-unused-expressions"]: {
13
+ "no-unused-expressions": {
14
14
  allowShortCircuit: true,
15
15
  allowTernary: true,
16
16
  },
17
- ["no-unused-vars"]: {
17
+ "no-unused-vars": {
18
18
  vars: "all",
19
19
  varsIgnorePattern: "^_",
20
20
  args: "after-used",
@@ -24,7 +24,7 @@ export const ruleOptions = {
24
24
  // This pattern is pretty common
25
25
  ignoreRestSiblings: true,
26
26
  },
27
- ["@typescript-eslint/naming-convention"]: (() => {
27
+ "@typescript-eslint/naming-convention": (() => {
28
28
  const options = {
29
29
  default: {
30
30
  selector: "default",
@@ -12,22 +12,20 @@ export const javascript = [
12
12
  // https://github.com/sindresorhus/eslint-plugin-unicorn/issues/896
13
13
  "unicorn/prevent-abbreviations": "off",
14
14
  "unicorn/filename-case": "off",
15
- // The default of import-style is highly subjective and not always the best choice.
16
- // E.g. bundlers are able to tree-shake named imports easier than default imports.
17
- "unicorn/import-style": "off",
18
15
  "unicorn/no-nested-ternary": "off",
19
16
  "unicorn/no-null": "off",
20
17
  "unicorn/no-useless-undefined": "off",
21
18
  "unicorn/prefer-query-selector": "off",
22
19
  // Also turn off the following rules because they're too opinionated
23
- "unicorn/require-array-join-separator": "off",
20
+ "unicorn/consistent-function-scoping": "off", // This rule forces to move arrow functions up the scope where it is often more readable to keep the function in the scope where it is used called.
21
+ "unicorn/import-style": "off", // The default of import-style is highly subjective and not always the best choice. E.g. bundlers are able to tree-shake named imports easier than default imports.
24
22
  "unicorn/no-array-for-each": "off",
25
23
  "unicorn/no-array-reduce": "off",
24
+ "unicorn/no-object-as-default-parameter": "off", // This rule also complains about the object when we already use destructuring. E.g. it would complain about the following pattern which is perfectly fine: { github = false, jsr = false } = { github: true, jsr: true }
25
+ "unicorn/no-single-promise-in-promise-methods": "off", // It makes sense to use Promise.all() with a single promise when we expect more to be added later. In that case we don't want to refactor the code, but just add the new promise.
26
26
  "unicorn/prefer-global-this": "off", // Too many false positives
27
27
  "unicorn/prefer-ternary": "off",
28
- // It makes sense to use Promise.all() with a single promise when we expect more to be added later.
29
- // In that case we don't want to refactor the code, but just add the new promise.
30
- "unicorn/no-single-promise-in-promise-methods": "off",
28
+ "unicorn/require-array-join-separator": "off",
31
29
  },
32
30
  },
33
31
  {
@@ -20,7 +20,7 @@ export const typescript =
20
20
  globPatterns.typescriptJsx,
21
21
  ],
22
22
  plugins: {
23
- ["prefer-arrow"]: preferArrow,
23
+ "prefer-arrow": preferArrow,
24
24
  },
25
25
  rules: {
26
26
  "@typescript-eslint/array-type": ["warn", { default: "generic" }],
@@ -1,5 +1,6 @@
1
1
  /**
2
- * Base config for Prettier.
2
+ * Provides the default configuration for Prettier with customized plugins and
3
+ * sorting rules.
3
4
  *
4
5
  * @type {import("prettier").Config}
5
6
  */
@@ -1,33 +1,8 @@
1
1
  /**
2
- * ## Installation
2
+ * ## Base config for Prettier.
3
3
  *
4
- * ```sh
5
- * npm install prettier @peerigon/configs --save-dev
6
- * ```
7
- *
8
- * Then create a `prettier.config.js` next to your `package.json`:
9
- *
10
- * ```js
11
- * export { default } from "@peerigon/configs/prettier";
12
- * ```
13
- *
14
- * Recommended configuration in your `package.json` (using
15
- * [`npm-run-all2`](https://www.npmjs.com/package/npm-run-all2)):
16
- *
17
- * ```json
18
- * {
19
- * "type": "module",
20
- * "scripts": {
21
- * "test": "run-p test:*",
22
- * "test:format": "prettier --check ."
23
- * }
24
- * }
25
- * ```
26
- *
27
- * ## Configuration
28
- *
29
- * Our config is entirely based on Prettier's default config. Besides that, it
30
- * also:
4
+ * Our base config is entirely based on Prettier's default config. Besides that,
5
+ * it also:
31
6
  *
32
7
  * - Auto-sorts `import` statements
33
8
  * - Formats JSDoc comments
@@ -35,17 +10,17 @@
35
10
  * - Formats and sorts CSS properties
36
11
  * - Sorts Tailwind CSS class names
37
12
  *
38
- * @module prettier
13
+ * @module prettierConfig
39
14
  */
40
15
  /**
41
16
  * @param {string} id
42
17
  * @returns {string}
43
18
  */
44
- const safeResolve = (id) => {
19
+ function safeResolve(id) {
45
20
  return "resolve" in import.meta
46
21
  ? import.meta.resolve(id).slice("file://".length)
47
22
  : id;
48
- };
23
+ }
49
24
  // Using safeResolve() here because the plugins might not be installed in the parent app/module
50
25
  // and we don't want to rely on the package manager to hoist the dependencies.
51
26
  const plugins = await Promise.all([
@@ -56,7 +31,8 @@ const plugins = await Promise.all([
56
31
  safeResolve("prettier-plugin-tailwindcss"),
57
32
  ]);
58
33
  /**
59
- * Base config for Prettier.
34
+ * Provides the default configuration for Prettier with customized plugins and
35
+ * sorting rules.
60
36
  *
61
37
  * @type {import("prettier").Config}
62
38
  */
@@ -72,4 +48,8 @@ export const config = {
72
48
  cssDeclarationSorterOrder: "smacss",
73
49
  cssDeclarationSorterKeepOverrides: false,
74
50
  };
51
+ /**
52
+ * @type {import("prettier").Config}
53
+ * @see {config}
54
+ */
75
55
  export default config;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @param {{ github: boolean; jsr: boolean }} options?
3
+ * @returns {import("semantic-release").Options}
4
+ */
1
5
  export function config({ github, jsr }?: {
2
6
  github: boolean;
3
7
  jsr: boolean;
@@ -3,7 +3,7 @@ import { config as baseConfig } from "./base.js";
3
3
  * @param {{ github: boolean; jsr: boolean }} options?
4
4
  * @returns {import("semantic-release").Options}
5
5
  */
6
- export const config = ({ github = false, jsr = false } = { github: true, jsr: true }) => {
6
+ export function config({ github = false, jsr = false } = { github: true, jsr: true }) {
7
7
  /** @type {import("semantic-release").PluginSpec[]} */
8
8
  const plugins = [];
9
9
  if (baseConfig.plugins) {
@@ -13,8 +13,12 @@ export const config = ({ github = false, jsr = false } = { github: true, jsr: tr
13
13
  plugins.push([
14
14
  "@semantic-release/exec",
15
15
  {
16
- verifyConditionsCmd: 'echo "registry=https://npm.pkg.github.com/\n//npm.pkg.github.com/:_authToken=${process.env.GITHUB_TOKEN}" > /tmp/github.npmrc && npm whoami --userconfig /tmp/github.npmrc',
17
- publishCmd: "npm publish --userconfig /tmp/github.npmrc --tag ${nextRelease.channel} --no-git-tag-version",
16
+ verifyConditionsCmd:
17
+ // eslint-disable-next-line no-template-curly-in-string
18
+ 'echo "registry=https://npm.pkg.github.com/\n//npm.pkg.github.com/:_authToken=${process.env.GITHUB_TOKEN}" > /tmp/github.npmrc && npm whoami --userconfig /tmp/github.npmrc',
19
+ publishCmd:
20
+ // eslint-disable-next-line no-template-curly-in-string
21
+ "npm publish --userconfig /tmp/github.npmrc --tag ${nextRelease.channel} --no-git-tag-version",
18
22
  successCmd: "rm /tmp/github.npmrc",
19
23
  failCmd: "rm /tmp/github.npmrc",
20
24
  },
@@ -27,5 +31,5 @@ export const config = ({ github = false, jsr = false } = { github: true, jsr: tr
27
31
  ...baseConfig,
28
32
  plugins,
29
33
  };
30
- };
34
+ }
31
35
  export default config();
@@ -4,10 +4,10 @@
4
4
  "compilerOptions": {
5
5
  // == Target and module settings ==
6
6
  // Deliberately not using ESNext/NodeNext here to avoid breaking changes just by updating TypeScript.
7
- "target": "es2022",
7
+ "target": "es2024",
8
8
  "module": "Preserve",
9
9
  "moduleDetection": "force",
10
- "lib": ["es2022"],
10
+ "lib": ["es2024"],
11
11
  // == Strictness settings ==
12
12
  "strict": true,
13
13
  "noImplicitOverride": true,
@@ -31,8 +31,10 @@
31
31
  // Using noEmit true here because you should have a separate build config anyway
32
32
  "noEmit": true,
33
33
  "noPropertyAccessFromIndexSignature": true,
34
- // Not setting skipLibCheck: true for now because it can hide type conflicts in dependencies
34
+ // Not setting skipLibCheck: true for now because it can hide type conflicts in dependencies.
35
35
  // You can override this in your app if you can't fix it with your package manager.
36
+ // If you want to learn more about the trade-offs,
37
+ // see https://www.testim.io/blog/typescript-skiplibcheck/
36
38
  "skipLibCheck": false,
37
39
  "verbatimModuleSyntax": true
38
40
  },
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "extends": "./base.json",
3
3
  "compilerOptions": {
4
+ "target": "es2022",
5
+ "lib": ["es2022"],
4
6
  "declaration": true,
5
7
  "noEmit": false,
6
8
  "outDir": "${configDir}/dist"
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "extends": "./base.json",
3
3
  "compilerOptions": {
4
+ "target": "es2022",
5
+ "lib": ["es2022"],
4
6
  "declaration": true,
5
7
  "declarationMap": true,
6
8
  "noEmit": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peerigon/configs",
3
- "version": "4.3.0-beta.1",
3
+ "version": "4.3.0",
4
4
  "description": "Configs for ESLint, Prettier, TypeScript & friends",
5
5
  "keywords": [
6
6
  "eslint",
@@ -54,8 +54,9 @@
54
54
  "test:styles:no-null": "cd eslint/styles/no-null.test; eslint --max-warnings 0 .",
55
55
  "test:styles:prefer-array-shorthand": "cd eslint/styles/prefer-array-shorthand.test; eslint --max-warnings 0 .",
56
56
  "test:styles:prefer-interface": "cd eslint/styles/prefer-interface.test; eslint --max-warnings 0 .",
57
+ "test:lint": "eslint --max-warnings 0 .",
57
58
  "test:types": "tsc --noEmit",
58
- "test:prettier": "prettier --check .",
59
+ "test:format": "prettier --check .",
59
60
  "build": "run-s build:*",
60
61
  "build:clear": "rimraf dist",
61
62
  "build:tsc": "tsc",