@ririd/eslint-config 0.1.0 → 0.1.2
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 +84 -0
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# eslint-config
|
|
2
|
+
Riri's ESLint config presets
|
|
3
|
+
|
|
4
|
+
## Feature
|
|
5
|
+
|
|
6
|
+
- Based [standard](https://github.com/standard/eslint-config-standard), single quotes, no semi
|
|
7
|
+
- Auto fix for formatting
|
|
8
|
+
- Designed to work with TypeScript, React out-of-box
|
|
9
|
+
- Lint also for json, yaml, markdown
|
|
10
|
+
- Sorted imports, dangling commas
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
### Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add -D eslint @ririd/eslint-config
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Config
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
// .eslintrc
|
|
24
|
+
{
|
|
25
|
+
"extends": "@ririd"
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Config VS Code auto fix
|
|
30
|
+
|
|
31
|
+
Install [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and create `.vscode/settings.json`
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"prettier.enable": false,
|
|
36
|
+
"editor.formatOnSave": false,
|
|
37
|
+
"editor.codeActionsOnSave": {
|
|
38
|
+
"source.fixAll.eslint": true
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### TypeScript Aware Rules
|
|
44
|
+
|
|
45
|
+
Type aware rules are enabled when a `tsconfig.eslint.json` is found in the project root, which will introduce some stricter rules into your project. If you want to enable it while have no `tsconfig.eslint.json` in the project root, you can change tsconfig name by modifying `ESLINT_TSCONFIG` env.
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
// .eslintrc.js
|
|
49
|
+
process.env.ESLINT_TSCONFIG = 'tsconfig.json'
|
|
50
|
+
|
|
51
|
+
module.exports = {
|
|
52
|
+
extends: '@ririd',
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Other config
|
|
57
|
+
|
|
58
|
+
### about `semi`
|
|
59
|
+
|
|
60
|
+
standard style default no semicolon, if you need a semicolon can define the rules as follows
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
module.exports = {
|
|
64
|
+
rules: {
|
|
65
|
+
'@typescript-eslint/member-delimiter-style': ['error', { multiline: { delimiter: 'semi', requireLast: ture } }],
|
|
66
|
+
'semi': 'off',
|
|
67
|
+
'@typescript-eslint/semi': ['error', 'always'],
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### about `brace-style`
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
module.exports = {
|
|
76
|
+
rules: {
|
|
77
|
+
'brace-style': ['error', '1tbs', { allowSingleLine: true }]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Thanks
|
|
83
|
+
|
|
84
|
+
This project is heavily based on [antfu](https://github.com/antfu/)'s template, with a certain degree of customization
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ririd/eslint-config",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Riri's ESLint config",
|
|
5
5
|
"author": "Daydreamer Riri <Daydreamerriri@outloot.com> (https://github.com/Daydreamer-riri/)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"jsonc-eslint-parser": "^2.1.0",
|
|
31
31
|
"local-pkg": "^0.4.3",
|
|
32
32
|
"yaml-eslint-parser": "^1.1.0",
|
|
33
|
-
"@ririd/eslint-config-
|
|
34
|
-
"@ririd/eslint-config-
|
|
35
|
-
"@ririd/eslint-config-react": "0.1.
|
|
33
|
+
"@ririd/eslint-config-js": "0.1.2",
|
|
34
|
+
"@ririd/eslint-config-ts": "0.1.2",
|
|
35
|
+
"@ririd/eslint-config-react": "0.1.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"eslint": "^8.34.0"
|