@timobechtel/style 1.13.0 → 1.14.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/README.md CHANGED
@@ -46,31 +46,73 @@ curl -O https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/temp
46
46
 
47
47
  ### Typescript
48
48
 
49
- ```bash
50
- curl -O https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/tsconfig/core/tsconfig.json
51
- ```
49
+ #### Existing tsconfig
52
50
 
53
- Or manually copy to `tsconfig.json`:
51
+ For existing projects or templates, I recomment leaving the config as-is and adding this preset to the extends array.
54
52
 
55
53
  ```json
56
- {
57
- "extends": "@timobechtel/style/tsconfig/core"
54
+ {
55
+ "extends": ["@timobechtel/style/tsconfig/core"]
58
56
  }
59
57
  ```
60
58
 
59
+ #### New tsconfig
60
+
61
+ ```bash
62
+ curl -O https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/tsconfig/core/tsconfig.json
63
+ ```
64
+
65
+ #### Expo
66
+
67
+ With expo make sure to add `"moduleResolution": "bundler"` to the `compilerOptions`, otherwise certain routing types might break.
68
+
69
+ <details>
70
+ <summary>Example</summary>
71
+
72
+ Copy to `tsconfig.json`:
73
+
74
+ ```json
75
+ {
76
+ "extends": ["expo/tsconfig.base", "@timobechtel/style/tsconfig/core"],
77
+ "compilerOptions": {
78
+ "moduleResolution": "bundler", // <-- this is important
79
+ "strict": true,
80
+ "paths": {
81
+ "@/*": [
82
+ "./*"
83
+ ]
84
+ }
85
+ },
86
+ "include": [
87
+ "**/*.ts",
88
+ "**/*.tsx",
89
+ ".expo/types/**/*.ts",
90
+ "expo-env.d.ts"
91
+ ]
92
+ }
93
+ ```
94
+
95
+ </details>
96
+
97
+
61
98
  #### Or with React
62
99
 
63
100
  ```bash
64
101
  curl -O https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/tsconfig/react/tsconfig.json
65
102
  ```
66
103
 
67
- Or manually copy to `tsconfig.json`:
104
+ <details>
105
+ <summary>Or manually</summary>
106
+
107
+ Copy to `tsconfig.json`:
68
108
 
69
- ```json
70
- {
71
- "extends": "@timobechtel/style/tsconfig/react"
72
- }
73
- ```
109
+ ```json
110
+ {
111
+ "extends": "@timobechtel/style/tsconfig/react"
112
+ }
113
+ ```
114
+
115
+ </details>
74
116
 
75
117
  ### Eslint
76
118
 
@@ -78,6 +120,24 @@ Or manually copy to `tsconfig.json`:
78
120
  curl -O https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/eslint/core/.eslintrc.cjs
79
121
  ```
80
122
 
123
+ #### Fix Parsing errors for config files
124
+
125
+ You may get a `Parsing error: <FILE> was not found by the project service.` for config files like .eslintrc.cjs when not included in the tsconfig.
126
+
127
+ To fix, either add to tsconfig or add them to the eslint config:
128
+
129
+ ```diff
130
+ //...
131
+ parserOptions: {
132
+ + projectService: {
133
+ + allowDefaultProject: ['.eslintrc.cjs'],
134
+ + },
135
+ //...
136
+ },
137
+ //...
138
+ ```
139
+
140
+
81
141
  <details>
82
142
  <summary>Or manually</summary>
83
143
 
@@ -112,12 +172,14 @@ curl -O https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/temp
112
172
  curl -O https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/eslint/react/.eslintrc.cjs
113
173
  ```
114
174
 
115
- Or manually:
116
-
117
- Also add `require.resolve('@timobechtel/style/eslint/react.cjs')` to the `extends` array.
175
+ <details>
176
+ <summary>Or manually</summary>
177
+
178
+ Also add `require.resolve('@timobechtel/style/eslint/react.cjs')` to the `extends` array.
118
179
 
119
- Example config:
120
- <https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/eslint/react/.eslintrc.cjs>
180
+ Example config:
181
+ <https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/eslint/react/.eslintrc.cjs>
182
+ </details>
121
183
 
122
184
  #### VSCode
123
185
 
@@ -129,7 +191,7 @@ Add the following to your VSCode config, e.g. `.vscode/settings.json`
129
191
  {
130
192
  "editor.codeActionsOnSave": {
131
193
  // use eslint import/order instead
132
- "source.organizeImports": "never"
194
+ "source.sortImports": "never"
133
195
  }
134
196
  }
135
197
  ```
package/eslint/core.cjs CHANGED
@@ -7,6 +7,7 @@ module.exports = defineConfig({
7
7
  'plugin:import/recommended',
8
8
  'prettier',
9
9
  'plugin:no-template-curly-in-string-fix/recommended',
10
+ 'plugin:@timobechtel/rules/all',
10
11
  require.resolve('./rules/base.cjs'),
11
12
  require.resolve('./rules/import.cjs'),
12
13
  require.resolve('./rules/unicorn.cjs'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timobechtel/style",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "bin",
@@ -24,6 +24,7 @@
24
24
  "dependencies": {
25
25
  "@semantic-release/changelog": "^6.0.3",
26
26
  "@semantic-release/git": "^10.0.1",
27
+ "@timobechtel/eslint-plugin-rules": "^1.0.0",
27
28
  "@typescript-eslint/eslint-plugin": "^8.19.1",
28
29
  "@typescript-eslint/parser": "^8.19.1",
29
30
  "eslint-config-prettier": "^9.1.0",