@timobechtel/style 1.12.0 → 1.13.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 +61 -49
- package/eslint/core.cjs +2 -0
- package/package.json +16 -16
package/README.md
CHANGED
|
@@ -4,16 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
Highly opinionated configuration files for typescript projects. Inspired by [@vercel/style-guide](https://github.com/vercel/style-guide)
|
|
6
6
|
|
|
7
|
+
> [!WARNING]
|
|
8
|
+
> Make sure to first commit your code before running the following commands. To allow you to easily revert the changes.
|
|
9
|
+
|
|
7
10
|
## Usage
|
|
8
11
|
|
|
9
12
|
```bash
|
|
10
|
-
npm i -D @timobechtel/style prettier "eslint@^8.57.
|
|
13
|
+
npm i -D @timobechtel/style prettier "eslint@^8.57.1" typescript
|
|
11
14
|
```
|
|
12
15
|
|
|
13
16
|
### Prettier
|
|
14
17
|
|
|
15
18
|
```bash
|
|
16
|
-
|
|
19
|
+
curl -O https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/.prettierrc
|
|
17
20
|
```
|
|
18
21
|
|
|
19
22
|
<details>
|
|
@@ -21,11 +24,18 @@ echo '"@timobechtel/style/prettier/index.mjs"' > .prettierrc
|
|
|
21
24
|
|
|
22
25
|
Need to extend the config, e.g. adding plugins?
|
|
23
26
|
|
|
27
|
+
```bash
|
|
28
|
+
curl -O https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/.prettierrc.mjs
|
|
29
|
+
```
|
|
30
|
+
|
|
24
31
|
Create a .prettierrc.mjs file and import the config, like this:
|
|
25
32
|
|
|
26
33
|
```js
|
|
27
34
|
import config from '@timobechtel/style/prettier/index.mjs';
|
|
28
|
-
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @type {import("prettier").Config}
|
|
38
|
+
*/
|
|
29
39
|
export default {
|
|
30
40
|
...config,
|
|
31
41
|
// your config
|
|
@@ -34,78 +44,80 @@ echo '"@timobechtel/style/prettier/index.mjs"' > .prettierrc
|
|
|
34
44
|
|
|
35
45
|
</details>
|
|
36
46
|
|
|
37
|
-
|
|
38
|
-
|
|
39
47
|
### Typescript
|
|
40
48
|
|
|
41
49
|
```bash
|
|
42
|
-
|
|
50
|
+
curl -O https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/tsconfig/core/tsconfig.json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Or manually copy to `tsconfig.json`:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"extends": "@timobechtel/style/tsconfig/core"
|
|
58
|
+
}
|
|
43
59
|
```
|
|
44
60
|
|
|
45
61
|
#### Or with React
|
|
46
62
|
|
|
47
63
|
```bash
|
|
48
|
-
|
|
64
|
+
curl -O https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/tsconfig/react/tsconfig.json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Or manually copy to `tsconfig.json`:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"extends": "@timobechtel/style/tsconfig/react"
|
|
72
|
+
}
|
|
49
73
|
```
|
|
50
74
|
|
|
51
75
|
### Eslint
|
|
52
76
|
|
|
53
77
|
```bash
|
|
54
|
-
|
|
78
|
+
curl -O https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/eslint/core/.eslintrc.cjs
|
|
55
79
|
```
|
|
56
80
|
|
|
57
|
-
|
|
81
|
+
<details>
|
|
82
|
+
<summary>Or manually</summary>
|
|
83
|
+
|
|
84
|
+
Copy the following to a `.eslintrc.cjs`:
|
|
58
85
|
|
|
59
|
-
```js
|
|
60
|
-
const { resolve } = require('node:path');
|
|
86
|
+
```js
|
|
87
|
+
const { resolve } = require('node:path');
|
|
61
88
|
|
|
62
|
-
const project = resolve(process.cwd(), 'tsconfig.json');
|
|
89
|
+
const project = resolve(process.cwd(), 'tsconfig.json');
|
|
63
90
|
|
|
64
|
-
module.exports = {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
91
|
+
module.exports = {
|
|
92
|
+
root: true,
|
|
93
|
+
extends: [require.resolve('@timobechtel/style/eslint/core.cjs')],
|
|
94
|
+
parserOptions: {
|
|
95
|
+
tsconfigRootDir: process.cwd(),
|
|
96
|
+
},
|
|
97
|
+
settings: {
|
|
98
|
+
'import/resolver': {
|
|
99
|
+
typescript: {
|
|
100
|
+
project,
|
|
101
|
+
},
|
|
74
102
|
},
|
|
75
103
|
},
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
104
|
+
};
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
</details>
|
|
79
108
|
|
|
80
109
|
#### React
|
|
81
110
|
|
|
111
|
+
```bash
|
|
112
|
+
curl -O https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/eslint/react/.eslintrc.cjs
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Or manually:
|
|
116
|
+
|
|
82
117
|
Also add `require.resolve('@timobechtel/style/eslint/react.cjs')` to the `extends` array.
|
|
83
118
|
|
|
84
119
|
Example config:
|
|
85
|
-
|
|
86
|
-
```js
|
|
87
|
-
const { resolve } = require('node:path');
|
|
88
|
-
|
|
89
|
-
const project = resolve(process.cwd(), 'tsconfig.json');
|
|
90
|
-
|
|
91
|
-
module.exports = {
|
|
92
|
-
root: true,
|
|
93
|
-
extends: [
|
|
94
|
-
require.resolve('@timobechtel/style/eslint/core.cjs'),
|
|
95
|
-
require.resolve('@timobechtel/style/eslint/react.cjs'),
|
|
96
|
-
],
|
|
97
|
-
parserOptions: {
|
|
98
|
-
project,
|
|
99
|
-
},
|
|
100
|
-
settings: {
|
|
101
|
-
'import/resolver': {
|
|
102
|
-
typescript: {
|
|
103
|
-
project,
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
```
|
|
120
|
+
<https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/eslint/react/.eslintrc.cjs>
|
|
109
121
|
|
|
110
122
|
#### VSCode
|
|
111
123
|
|
package/eslint/core.cjs
CHANGED
|
@@ -11,6 +11,7 @@ module.exports = defineConfig({
|
|
|
11
11
|
require.resolve('./rules/import.cjs'),
|
|
12
12
|
require.resolve('./rules/unicorn.cjs'),
|
|
13
13
|
],
|
|
14
|
+
parser: '@typescript-eslint/parser',
|
|
14
15
|
plugins: [],
|
|
15
16
|
env: {
|
|
16
17
|
es2021: true,
|
|
@@ -30,6 +31,7 @@ module.exports = defineConfig({
|
|
|
30
31
|
parserOptions: {
|
|
31
32
|
ecmaVersion: 2021,
|
|
32
33
|
sourceType: 'module',
|
|
34
|
+
projectService: true,
|
|
33
35
|
},
|
|
34
36
|
overrides: [
|
|
35
37
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timobechtel/style",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"bin",
|
|
@@ -10,29 +10,29 @@
|
|
|
10
10
|
"tsconfig"
|
|
11
11
|
],
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"eslint": "^8.57.
|
|
14
|
-
"prettier": "^3.
|
|
15
|
-
"semantic-release": "^24.
|
|
16
|
-
"typescript": "^5.
|
|
13
|
+
"eslint": "^8.57.1",
|
|
14
|
+
"prettier": "^3.4.2",
|
|
15
|
+
"semantic-release": "^24.2.1",
|
|
16
|
+
"typescript": "^5.7.2"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"eslint": "^8.57.
|
|
20
|
-
"prettier": "^3.
|
|
21
|
-
"semantic-release": "^24.
|
|
22
|
-
"typescript": "^5.
|
|
19
|
+
"eslint": "^8.57.1",
|
|
20
|
+
"prettier": "^3.4.2",
|
|
21
|
+
"semantic-release": "^24.2.1",
|
|
22
|
+
"typescript": "^5.7.2"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@semantic-release/changelog": "^6.0.3",
|
|
26
26
|
"@semantic-release/git": "^10.0.1",
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
28
|
-
"@typescript-eslint/parser": "^
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^8.19.1",
|
|
28
|
+
"@typescript-eslint/parser": "^8.19.1",
|
|
29
29
|
"eslint-config-prettier": "^9.1.0",
|
|
30
30
|
"eslint-define-config": "^2.1.0",
|
|
31
|
-
"eslint-import-resolver-typescript": "^3.
|
|
32
|
-
"eslint-plugin-import": "^2.
|
|
31
|
+
"eslint-import-resolver-typescript": "^3.7.0",
|
|
32
|
+
"eslint-plugin-import": "^2.31.0",
|
|
33
33
|
"eslint-plugin-no-template-curly-in-string-fix": "^1.0.4",
|
|
34
|
-
"eslint-plugin-react": "^7.
|
|
35
|
-
"eslint-plugin-react-hooks": "^
|
|
36
|
-
"eslint-plugin-unicorn": "^
|
|
34
|
+
"eslint-plugin-react": "^7.37.3",
|
|
35
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
36
|
+
"eslint-plugin-unicorn": "^56.0.1"
|
|
37
37
|
}
|
|
38
38
|
}
|