@peerigon/configs 1.0.0-beta.18 → 1.0.0-beta.19

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,10 @@
1
+ # [1.0.0-beta.19](https://github.com/peerigon/configs/compare/v1.0.0-beta.18...v1.0.0-beta.19) (2025-01-27)
2
+
3
+ ### Features
4
+
5
+ - Enable .ts imports ([781a4a9](https://github.com/peerigon/configs/commit/781a4a97e15df6b218959c76c62a2e0893b3c026))
6
+ - Update dependencies ([839e69c](https://github.com/peerigon/configs/commit/839e69cdfef60349772479b7f5a7105c81be9d93))
7
+
1
8
  # [1.0.0-beta.18](https://github.com/peerigon/configs/compare/v1.0.0-beta.17...v1.0.0-beta.18) (2025-01-26)
2
9
 
3
10
  ### Features
package/README.md CHANGED
@@ -24,11 +24,22 @@ Also checkout the instructions for each respective config:
24
24
 
25
25
  ## Philosophy
26
26
 
27
- Our rules aim to prevent as many bugs and security vulnerabilities as possible and make refactoring easier. At the same time, they should stay out of the way as much as possible.
27
+ Linting, formatting and type-checking rules are always a balance between:
28
+
29
+ - ease of reading
30
+ - ease of refactoring
31
+ - ease of writing.
32
+
33
+ We think that:
34
+
35
+ - code is read more often than refactored
36
+ - and refactored more often than written from scratch.
37
+
38
+ Our configs have been designed with these assumptions in mind.
28
39
 
29
40
  ### Formatting
30
41
 
31
- Formatting should follow the community standard. Our config is entirely based on Prettier's default config. Besides that, it also:
42
+ Formatting should follow the community standard. Our config is therefore based on Prettier's default config. Besides that it also:
32
43
 
33
44
  - auto-sorts `import` statements
34
45
  - formats JSDoc comments
@@ -36,6 +47,8 @@ Formatting should follow the community standard. Our config is entirely based on
36
47
  - formats and sorts CSS properties
37
48
  - sorts Tailwind CSS class names
38
49
 
50
+ This makes git diffs smaller and reviewing them more focussed.
51
+
39
52
  ### Linting
40
53
 
41
54
  Linting should mostly catch bugs in the control flow and prevent security issues. Furthermore, it should enforce a modern, idiomatic and consistent code style that is easy to read and to refactor.
package/eslint/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ## Installation
4
4
 
5
5
  ```sh
6
- npm install @peerigon/configs
6
+ npm install eslint @peerigon/configs --save-dev
7
7
  ```
8
8
 
9
9
  Then create a `eslint.config.js` next to your `package.json`:
@@ -46,7 +46,7 @@ Presets bundle all relevant rules into one `import`. They can be imported as `@p
46
46
  - `typescript-react`: Rules for React projects written in TypeScript
47
47
  - `typescript-node`: Rules for TypeScript apps that are supposed to run in Node.js
48
48
  - `typescript`: Rules for all other TypeScript projects
49
- - `javascript-browser`: Rules for JavaScript apps running in a browser (e.g. in combination with JSDoc type annotations)
49
+ - `javascript-browser`: Rules for JavaScript apps running in a browser (e.g. in combination with [JSDoc type annotations](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html))
50
50
  - `javascript-node`: Rules for JavaScript apps running in Node.js
51
51
  - `javascript`: Rules for all other JavaScript projects
52
52
 
@@ -73,20 +73,25 @@ export const NULL = null;
73
73
 
74
74
  ### `prefer-interface`
75
75
 
76
- [Prefer TypeScript's `interface` over `type`](https://typescript-eslint.io/rules/consistent-type-definitions/).
76
+ Prefer TypeScript's `interface` over `type`:
77
77
 
78
- ```js
79
- "extends": [
80
- "peerigon",
81
- "peerigon/typescript",
82
- "peerigon/styles/prefer-interface"
83
- ],
78
+ ```ts
79
+ interface SomeObject {
80
+ someProp: boolean;
81
+ }
82
+ ```
83
+
84
+ instead of
85
+
86
+ ```ts
87
+ type SomeObject = {
88
+ someProp: boolean;
89
+ };
84
90
  ```
85
91
 
86
92
  ### `prefer-array-shorthand`
87
93
 
88
- Enforces TypeScript arrays to use the shorthand array-style instead of the generic style.
89
- It enforces this:
94
+ Enforces TypeScript arrays to use the shorthand array-style instead of the generic style:
90
95
 
91
96
  ```ts
92
97
  const foo: string[] = [];
@@ -1,4 +1,5 @@
1
1
  import { useEffect, useRef, useState } from "react";
2
+ import { Other } from "./Other.tsx";
2
3
 
3
4
  export const App = (_props: { name: string; count: number }) => {
4
5
  for (let index = 0; index < 10; index++) {
@@ -28,6 +29,7 @@ export const App = (_props: { name: string; count: number }) => {
28
29
  {"Hello world"}
29
30
  {/* eslint-disable-next-line @eslint-react/no-leaked-conditional-rendering */}
30
31
  <>{_props.count && <view />}</>
32
+ <Other />
31
33
  </>
32
34
  );
33
35
  };
@@ -1,4 +1,4 @@
1
- import { getMessage } from "./message.js";
1
+ import { getMessage } from "./message.ts";
2
2
  // Check if import attributes are detected and formatted correctly
3
3
  import test from "./test.json" with { type: "json" };
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peerigon/configs",
3
- "version": "1.0.0-beta.18",
3
+ "version": "1.0.0-beta.19",
4
4
  "description": "Configs for ESLint, Prettier, TypeScript & friends",
5
5
  "keywords": [
6
6
  "eslint",
@@ -122,48 +122,60 @@
122
122
  "*.{js,jsx,ts,tsx,css,md,yml,yaml}": "prettier --write"
123
123
  },
124
124
  "dependencies": {
125
- "@eslint-react/eslint-plugin": "^1.16.1",
126
- "@eslint/compat": "^1.2.3",
127
- "@eslint/js": "9.14.0",
128
- "@ianvs/prettier-plugin-sort-imports": "^4.4.0",
125
+ "@eslint-react/eslint-plugin": "^1.24.1",
126
+ "@eslint/compat": "^1.2.5",
127
+ "@eslint/js": "^9.19.0",
128
+ "@ianvs/prettier-plugin-sort-imports": "^4.4.1",
129
129
  "@types/eslint-config-prettier": "^6.11.3",
130
- "@types/eslint-plugin-jsx-a11y": "^6.9.0",
130
+ "@types/eslint-plugin-jsx-a11y": "^6.10.0",
131
131
  "@types/eslint__js": "^8.42.3",
132
- "eslint-config-prettier": "^9.1.0",
132
+ "eslint-config-prettier": "^10.0.1",
133
133
  "eslint-plugin-jsx-a11y": "^6.10.2",
134
134
  "eslint-plugin-prefer-arrow": "^1.2.3",
135
- "eslint-plugin-react": "^7.37.2",
135
+ "eslint-plugin-react": "^7.37.4",
136
136
  "eslint-plugin-react-compiler": "^19.0.0-beta-a7bf2bd-20241110",
137
- "eslint-plugin-react-hooks": "^5.0.0",
138
- "eslint-plugin-react-refresh": "^0.4.14",
139
- "eslint-plugin-unicorn": "^56.0.0",
140
- "globals": "^15.12.0",
137
+ "eslint-plugin-react-hooks": "^5.1.0",
138
+ "eslint-plugin-react-refresh": "^0.4.18",
139
+ "eslint-plugin-unicorn": "^56.0.1",
140
+ "globals": "^15.14.0",
141
141
  "prettier-plugin-css-order": "^2.1.2",
142
- "prettier-plugin-jsdoc": "^1.3.0",
143
- "prettier-plugin-packagejson": "^2.5.3",
144
- "prettier-plugin-tailwindcss": "^0.6.8",
145
- "typescript-eslint": "^8.14.0"
142
+ "prettier-plugin-jsdoc": "^1.3.2",
143
+ "prettier-plugin-packagejson": "^2.5.8",
144
+ "prettier-plugin-tailwindcss": "^0.6.11",
145
+ "typescript-eslint": "^8.21.0"
146
146
  },
147
147
  "devDependencies": {
148
148
  "@semantic-release/changelog": "^6.0.3",
149
149
  "@semantic-release/exec": "^6.0.3",
150
150
  "@semantic-release/git": "^10.0.1",
151
- "@types/node": "^22.9.0",
152
- "@types/react": "^18.3.12",
153
- "eslint": "9.14.0",
154
- "husky": "^9.1.6",
155
- "lint-staged": "^15.2.10",
151
+ "@types/node": "^22.10.10",
152
+ "@types/react": "^19.0.8",
153
+ "eslint": "^9.19.0",
154
+ "husky": "^9.1.7",
155
+ "lint-staged": "^15.4.3",
156
156
  "npm-run-all": "^4.1.5",
157
- "pin-github-action": "^1.9.1",
158
- "prettier": "^3.3.3",
159
- "react": "^18.3.1",
160
- "semantic-release": "^24.2.0",
161
- "typescript": "^5.6.3"
157
+ "pin-github-action": "^2.0.2",
158
+ "prettier": "^3.4.2",
159
+ "react": "^19.0.0",
160
+ "semantic-release": "^24.2.1",
161
+ "typescript": "^5.7.3"
162
162
  },
163
163
  "peerDependencies": {
164
- "eslint": "^9.0.0",
165
- "prettier": "^3.3.3",
166
- "typescript": "^5.6.3"
164
+ "eslint": "^9.19.0",
165
+ "prettier": "^3.4.2",
166
+ "semantic-release": "^24.2.1",
167
+ "typescript": "^5.7.3"
168
+ },
169
+ "peerDependenciesMeta": {
170
+ "eslint": {
171
+ "optional": true
172
+ },
173
+ "prettier": {
174
+ "optional": true
175
+ },
176
+ "typescript": {
177
+ "optional": true
178
+ }
167
179
  },
168
180
  "publishConfig": {
169
181
  "access": "public",
@@ -3,7 +3,7 @@
3
3
  ## Installation
4
4
 
5
5
  ```sh
6
- npm install @peerigon/configs
6
+ npm install prettier @peerigon/configs --save-dev
7
7
  ```
8
8
 
9
9
  Then create a `prettier.config.js` next to your `package.json`:
@@ -3,7 +3,7 @@
3
3
  ## Installation
4
4
 
5
5
  ```sh
6
- npm install @peerigon/configs
6
+ npm install semantic-release @peerigon/configs --save-dev
7
7
  ```
8
8
 
9
9
  Then create a `.releaserc.json` next to your `package.json`:
@@ -23,12 +23,15 @@ Recommended configuration in your `package.json`:
23
23
  "release": "semantic-release"
24
24
  },
25
25
  "publishConfig": {
26
- "access": "public", // only if the package is supposed to be public
26
+ "//": "only if the package is supposed to be public"
27
+ "access": "public",
27
28
  "provenance": true
28
29
  }
29
30
  }
30
31
  ```
31
32
 
33
+ `"provenance": true` will generate [provenance statements](https://docs.npmjs.com/generating-provenance-statements) in case your Github actions has the correct permissions (see below).
34
+
32
35
  Recommended Github action:
33
36
 
34
37
  ```yaml
@@ -61,7 +64,8 @@ jobs:
61
64
  # ...
62
65
  - name: 🚀 Release
63
66
  env:
64
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67
+ # GITHUB_TOKEN is only necessary if you want to publish to Github
68
+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65
69
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
66
70
  run: |
67
71
  npm run release
@@ -1 +1 @@
1
- {"version":3,"file":"other.d.ts","sourceRoot":"","sources":["../../../../eslint/presets/javascript.test/other.js"],"names":[],"mappings":"AAAA,kBAAmB;AACnB,kBAAmB"}
1
+ {"version":3,"file":"other.d.ts","sourceRoot":"","sources":["../../../../eslint/presets/javascript.test/other.js"],"names":[],"mappings":"AAAA,gBAAiB,CAAC,CAAC;AACnB,gBAAiB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../eslint/styles/no-default-export.test/main.ts"],"names":[],"mappings":";AACA,wBAAiC"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../eslint/styles/no-default-export.test/main.ts"],"names":[],"mappings":"wBACe,iBAAiB;AAAhC,wBAAiC"}
@@ -3,7 +3,7 @@
3
3
  ## Installation
4
4
 
5
5
  ```sh
6
- npm install @peerigon/configs
6
+ npm install typescript @peerigon/configs --save-dev
7
7
  ```
8
8
 
9
9
  Then create a `tsconfig.json` just for type-checking next to your `package.json`:
@@ -55,4 +55,4 @@ We export the following `tsconfig.json` presets. They can be used by extending `
55
55
 
56
56
  - `typescript`: Recommended base config for all modern TypeScript projects
57
57
  - `typescript/lib`: Config for building TS libraries
58
- - `typescript/js-lib`: Config for building JS libraries with [TS JSDoc annotations](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html).
58
+ - `typescript/js-lib`: Config for building JS libraries with [JSDoc type annotations](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html).
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "allowImportingTsExtensions": true,
3
4
  "checkJs": true,
5
+ // TODO: Enable erasableSyntaxOnly when TS 5.8 is released
6
+ // https://www.totaltypescript.com/erasable-syntax-only
7
+ // "erasableSyntaxOnly": true,
4
8
  "esModuleInterop": true,
5
- // We decided to turn off `exactOptionalPropertyTypes` because it's too strict
6
9
  // by complaining about too much unproblematic code. We may revisit this decision later.
10
+ // We decided to turn off `exactOptionalPropertyTypes` because it's too strict
7
11
  "exactOptionalPropertyTypes": false,
8
12
  "forceConsistentCasingInFileNames": true,
9
13
  "isolatedModules": true,
@@ -15,13 +19,11 @@
15
19
  "noPropertyAccessFromIndexSignature": true,
16
20
  "noUncheckedIndexedAccess": true,
17
21
  "resolveJsonModule": true,
22
+ "rewriteRelativeImportExtensions": true,
18
23
  "skipLibCheck": true,
19
24
  "strict": true,
20
- "target": "ESNext"
21
- // TODO: Turn on the following settings once TS 5.7 is released, see also https://nodejs.org/docs/latest/api/typescript.html#typescript-features
22
- // "allowImportingTsExtensions": true,
23
- // "rewriteRelativeImportExtensions": true,
24
- // "verbatimModuleSyntax": true
25
+ "target": "ESNext",
26
+ "verbatimModuleSyntax": true
25
27
  },
26
28
  "$schema": "https://json.schemastore.org/tsconfig"
27
29
  }