@timobechtel/style 1.11.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 +78 -46
- package/eslint/core.cjs +3 -0
- package/package.json +17 -16
package/README.md
CHANGED
|
@@ -4,88 +4,120 @@
|
|
|
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
|
|
|
22
|
+
<details>
|
|
23
|
+
<summary>Extend / customize config</summary>
|
|
24
|
+
|
|
25
|
+
Need to extend the config, e.g. adding plugins?
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
curl -O https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/.prettierrc.mjs
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Create a .prettierrc.mjs file and import the config, like this:
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
import config from '@timobechtel/style/prettier/index.mjs';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @type {import("prettier").Config}
|
|
38
|
+
*/
|
|
39
|
+
export default {
|
|
40
|
+
...config,
|
|
41
|
+
// your config
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
</details>
|
|
46
|
+
|
|
19
47
|
### Typescript
|
|
20
48
|
|
|
21
49
|
```bash
|
|
22
|
-
|
|
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
|
+
}
|
|
23
59
|
```
|
|
24
60
|
|
|
25
61
|
#### Or with React
|
|
26
62
|
|
|
27
63
|
```bash
|
|
28
|
-
|
|
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
|
+
}
|
|
29
73
|
```
|
|
30
74
|
|
|
31
75
|
### Eslint
|
|
32
76
|
|
|
33
77
|
```bash
|
|
34
|
-
|
|
78
|
+
curl -O https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/eslint/core/.eslintrc.cjs
|
|
35
79
|
```
|
|
36
80
|
|
|
37
|
-
|
|
81
|
+
<details>
|
|
82
|
+
<summary>Or manually</summary>
|
|
38
83
|
|
|
39
|
-
|
|
40
|
-
const { resolve } = require('node:path');
|
|
84
|
+
Copy the following to a `.eslintrc.cjs`:
|
|
41
85
|
|
|
42
|
-
|
|
86
|
+
```js
|
|
87
|
+
const { resolve } = require('node:path');
|
|
43
88
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
89
|
+
const project = resolve(process.cwd(), 'tsconfig.json');
|
|
90
|
+
|
|
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
|
+
},
|
|
54
102
|
},
|
|
55
103
|
},
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
104
|
+
};
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
</details>
|
|
59
108
|
|
|
60
109
|
#### React
|
|
61
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
|
+
|
|
62
117
|
Also add `require.resolve('@timobechtel/style/eslint/react.cjs')` to the `extends` array.
|
|
63
118
|
|
|
64
119
|
Example config:
|
|
65
|
-
|
|
66
|
-
```js
|
|
67
|
-
const { resolve } = require('node:path');
|
|
68
|
-
|
|
69
|
-
const project = resolve(process.cwd(), 'tsconfig.json');
|
|
70
|
-
|
|
71
|
-
module.exports = {
|
|
72
|
-
root: true,
|
|
73
|
-
extends: [
|
|
74
|
-
require.resolve('@timobechtel/style/eslint/core.cjs'),
|
|
75
|
-
require.resolve('@timobechtel/style/eslint/react.cjs'),
|
|
76
|
-
],
|
|
77
|
-
parserOptions: {
|
|
78
|
-
project,
|
|
79
|
-
},
|
|
80
|
-
settings: {
|
|
81
|
-
'import/resolver': {
|
|
82
|
-
typescript: {
|
|
83
|
-
project,
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
```
|
|
120
|
+
<https://raw.githubusercontent.com/TimoBechtel/style/refs/heads/main/templates/eslint/react/.eslintrc.cjs>
|
|
89
121
|
|
|
90
122
|
#### VSCode
|
|
91
123
|
|
package/eslint/core.cjs
CHANGED
|
@@ -6,10 +6,12 @@ module.exports = defineConfig({
|
|
|
6
6
|
'eslint:recommended',
|
|
7
7
|
'plugin:import/recommended',
|
|
8
8
|
'prettier',
|
|
9
|
+
'plugin:no-template-curly-in-string-fix/recommended',
|
|
9
10
|
require.resolve('./rules/base.cjs'),
|
|
10
11
|
require.resolve('./rules/import.cjs'),
|
|
11
12
|
require.resolve('./rules/unicorn.cjs'),
|
|
12
13
|
],
|
|
14
|
+
parser: '@typescript-eslint/parser',
|
|
13
15
|
plugins: [],
|
|
14
16
|
env: {
|
|
15
17
|
es2021: true,
|
|
@@ -29,6 +31,7 @@ module.exports = defineConfig({
|
|
|
29
31
|
parserOptions: {
|
|
30
32
|
ecmaVersion: 2021,
|
|
31
33
|
sourceType: 'module',
|
|
34
|
+
projectService: true,
|
|
32
35
|
},
|
|
33
36
|
overrides: [
|
|
34
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,28 +10,29 @@
|
|
|
10
10
|
"tsconfig"
|
|
11
11
|
],
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"eslint": "^8.57.
|
|
14
|
-
"prettier": "^3.2
|
|
15
|
-
"semantic-release": "^
|
|
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.2
|
|
21
|
-
"semantic-release": "^
|
|
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.
|
|
33
|
-
"eslint-plugin-
|
|
34
|
-
"eslint-plugin-react
|
|
35
|
-
"eslint-plugin-
|
|
31
|
+
"eslint-import-resolver-typescript": "^3.7.0",
|
|
32
|
+
"eslint-plugin-import": "^2.31.0",
|
|
33
|
+
"eslint-plugin-no-template-curly-in-string-fix": "^1.0.4",
|
|
34
|
+
"eslint-plugin-react": "^7.37.3",
|
|
35
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
36
|
+
"eslint-plugin-unicorn": "^56.0.1"
|
|
36
37
|
}
|
|
37
38
|
}
|