@kirill.konshin/eslint-config-next-custom 0.2.2 → 0.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/.editorconfig +17 -0
- package/README.md +88 -2
- package/package.json +13 -11
- package/prettier.js +13 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
indent_style = space
|
|
5
|
+
end_of_line = lf
|
|
6
|
+
charset = utf-8
|
|
7
|
+
trim_trailing_whitespace = true
|
|
8
|
+
insert_final_newline = false
|
|
9
|
+
|
|
10
|
+
[*.{mjs,js,jsx,ts,tsx,htm,html,md,mdx}]
|
|
11
|
+
indent_size = 4
|
|
12
|
+
|
|
13
|
+
[*.{css,sass,scss,yml,json}]
|
|
14
|
+
indent_size = 2
|
|
15
|
+
|
|
16
|
+
[Makefile]
|
|
17
|
+
indent_style = tab
|
package/README.md
CHANGED
|
@@ -1,2 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# ESLint + Prettier + Lint Staged + Husky
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
$ yarn add -D eslint @eslint-compat prettier @kirill.konshin/eslint-config-next-custom husky lint-staged
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
`eslint.config.mjs`:
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { dirname, resolve } from 'node:path';
|
|
13
|
+
import { fileURLToPath } from 'node:url';
|
|
14
|
+
|
|
15
|
+
import { includeIgnoreFile } from '@eslint/compat';
|
|
16
|
+
import customConfig from '@kirill.konshin/eslint-config-next-custom';
|
|
17
|
+
|
|
18
|
+
const gitignorePath = resolve(dirname(fileURLToPath(import.meta.url)), '.prettierignore'); // <----- !!!
|
|
19
|
+
|
|
20
|
+
const config = [
|
|
21
|
+
...customConfig,
|
|
22
|
+
{
|
|
23
|
+
name: 'Custom rules',
|
|
24
|
+
rules: {
|
|
25
|
+
// overrides
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
includeIgnoreFile(gitignorePath),
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export default config;
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`.prettierrc.mjs`:
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
import config from '@kirill.konshin/eslint-config-next-custom/prettier';
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
...config,
|
|
41
|
+
// overrides
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`package.json`:
|
|
47
|
+
|
|
48
|
+
```json5
|
|
49
|
+
{
|
|
50
|
+
"scripts": {
|
|
51
|
+
"eslint": "DEBUG=eslint:eslint eslint --cache --cache-location node_modules/.cache/eslint --fix",
|
|
52
|
+
"prettier": "prettier --write",
|
|
53
|
+
"lint:all": "yarn eslint . && yarn prettier ."
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Lint Staged
|
|
59
|
+
|
|
60
|
+
```json5
|
|
61
|
+
{
|
|
62
|
+
"*.{js,jsx,ts,tsx,cjs,mjs}": "yarn eslint",
|
|
63
|
+
"*.{js,jsx,ts,tsx,cjs,mjs,css,scss,sass,less,md,mdx,yml,json,html}": "yarn prettier"
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Husky
|
|
68
|
+
|
|
69
|
+
```json5
|
|
70
|
+
{
|
|
71
|
+
"scripts": {
|
|
72
|
+
"prepare": "husky install"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`.husky/pre-commit`:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
#!/bin/zsh
|
|
81
|
+
source ~/.zshrc # for VSCode terminal
|
|
82
|
+
yarn lint:staged
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Issues
|
|
86
|
+
|
|
87
|
+
- [x] https://github.com/microsoft/rushstack/issues/4635 Failed to patch ESLint because the calling module was not recognized
|
|
88
|
+
- [x] https://github.com/microsoft/rushstack/issues/4965 Failed to patch ESLint because the calling module was not recognized
|
package/package.json
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kirill.konshin/eslint-config-next-custom",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"module": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@eslint/compat": "^1.2.
|
|
8
|
+
"@eslint/compat": "^1.2.4",
|
|
9
9
|
"@eslint/eslintrc": "^3.2.0",
|
|
10
|
-
"@eslint/js": "^9.
|
|
11
|
-
"@next/eslint-plugin-next": "^15.
|
|
12
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
13
|
-
"@typescript-eslint/parser": "^8.
|
|
14
|
-
"eslint-config-next": "^15.
|
|
10
|
+
"@eslint/js": "^9.17.0",
|
|
11
|
+
"@next/eslint-plugin-next": "^15.1.3",
|
|
12
|
+
"@typescript-eslint/eslint-plugin": "^8.19.0",
|
|
13
|
+
"@typescript-eslint/parser": "^8.19.0",
|
|
14
|
+
"eslint-config-next": "^15.1.3",
|
|
15
15
|
"eslint-config-prettier": "^9.1.0",
|
|
16
|
-
"eslint-plugin-react-hooks": "^5.
|
|
17
|
-
"globals": "^15.
|
|
18
|
-
|
|
16
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
17
|
+
"globals": "^15.14.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"typescript": "^5.7.2"
|
|
19
21
|
},
|
|
20
22
|
"peerDependencies": {
|
|
21
23
|
"next": "^15"
|
|
@@ -23,7 +25,7 @@
|
|
|
23
25
|
"publishConfig": {
|
|
24
26
|
"access": "public"
|
|
25
27
|
},
|
|
26
|
-
"author": "Kirill Konshin <kirill
|
|
28
|
+
"author": "Kirill Konshin <kirill@konshin.org> (https://konshin.org)",
|
|
27
29
|
"license": "MIT",
|
|
28
30
|
"description": "",
|
|
29
31
|
"packageManager": "yarn@4.5.1"
|