@ddyscn/lint-config 0.0.1
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/LICENSE +28 -0
- package/README.md +53 -0
- package/index.js +58 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Nick Wang
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @ddyscn/lint-config
|
|
2
|
+
|
|
3
|
+
个人用的 ESLint flat config,覆盖 JavaScript 和 TypeScript 项目。
|
|
4
|
+
*Personal ESLint flat config for both JavaScript and TypeScript projects.*
|
|
5
|
+
|
|
6
|
+
## 安装 / Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install -D eslint @ddyscn/lint-config
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
需要 ESLint 9 或以上 / Requires ESLint 9+.
|
|
13
|
+
|
|
14
|
+
## 使用 / Usage
|
|
15
|
+
|
|
16
|
+
在项目根目录创建 `eslint.config.js`:
|
|
17
|
+
*Create `eslint.config.js` at the project root:*
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import config from '@ddyscn/lint-config'
|
|
21
|
+
|
|
22
|
+
export default config
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
或者扩展自定义规则 / Or extend with your own rules:
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
import config from '@ddyscn/lint-config'
|
|
29
|
+
|
|
30
|
+
export default [
|
|
31
|
+
...config,
|
|
32
|
+
{
|
|
33
|
+
rules: {
|
|
34
|
+
// your overrides
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 包含什么 / What's inside
|
|
41
|
+
|
|
42
|
+
- `@eslint/js` 推荐规则(适用于所有 JS/TS 文件)
|
|
43
|
+
- `typescript-eslint` 推荐规则(仅对 `*.ts` / `*.tsx` / `*.mts` / `*.cts`)
|
|
44
|
+
- 个人风格规则 / Personal style rules:
|
|
45
|
+
- 无分号 / No semicolons
|
|
46
|
+
- 单引号 / Single quotes
|
|
47
|
+
- 逗号悬挂仅多行 / Trailing commas only on multiline
|
|
48
|
+
- 数组/对象括号内空格 / Spaces inside array & object brackets
|
|
49
|
+
- import 按字母顺序分组 / Alphabetized, grouped imports
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
BSD-3-Clause
|
package/index.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import stylistic from '@stylistic/eslint-plugin'
|
|
3
|
+
import importX from 'eslint-plugin-import-x'
|
|
4
|
+
import globals from 'globals'
|
|
5
|
+
import tseslint from 'typescript-eslint'
|
|
6
|
+
|
|
7
|
+
const qualityRules = {
|
|
8
|
+
eqeqeq: ['error', 'always'],
|
|
9
|
+
'no-var': 'error',
|
|
10
|
+
'prefer-const': 'error',
|
|
11
|
+
'no-console': 'warn',
|
|
12
|
+
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const styleRules = {
|
|
16
|
+
'@stylistic/semi': ['error', 'never'],
|
|
17
|
+
'@stylistic/quotes': ['error', 'single'],
|
|
18
|
+
'@stylistic/comma-dangle': ['error', 'always-multiline'],
|
|
19
|
+
'@stylistic/indent': ['error', 2],
|
|
20
|
+
'@stylistic/eol-last': ['error', 'always'],
|
|
21
|
+
'@stylistic/array-bracket-spacing': ['error', 'never'],
|
|
22
|
+
'@stylistic/object-curly-spacing': ['error', 'never'],
|
|
23
|
+
'import-x/order': ['error', {
|
|
24
|
+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
25
|
+
alphabetize: {
|
|
26
|
+
order: 'asc',
|
|
27
|
+
caseInsensitive: true,
|
|
28
|
+
},
|
|
29
|
+
}],
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default tseslint.config(
|
|
33
|
+
js.configs.recommended,
|
|
34
|
+
{
|
|
35
|
+
languageOptions: {
|
|
36
|
+
globals: {
|
|
37
|
+
...globals.node,
|
|
38
|
+
...globals.browser,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
plugins: {
|
|
42
|
+
'@stylistic': stylistic,
|
|
43
|
+
'import-x': importX,
|
|
44
|
+
},
|
|
45
|
+
rules: {
|
|
46
|
+
...qualityRules,
|
|
47
|
+
...styleRules,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
files: ['**/*.{ts,tsx,mts,cts}'],
|
|
52
|
+
extends: [...tseslint.configs.recommended],
|
|
53
|
+
rules: {
|
|
54
|
+
'no-unused-vars': 'off',
|
|
55
|
+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
)
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ddyscn/lint-config",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Personal ESLint flat config for JavaScript and TypeScript projects.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"index.js",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/hcfw007/lint-config.git"
|
|
21
|
+
},
|
|
22
|
+
"author": "Nick Wang",
|
|
23
|
+
"license": "BSD-3-Clause",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/hcfw007/lint-config/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/hcfw007/lint-config#readme",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@eslint/js": "^10.0.1",
|
|
30
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
31
|
+
"eslint-plugin-import-x": "^4.16.2",
|
|
32
|
+
"globals": "^17.6.0",
|
|
33
|
+
"typescript-eslint": "^8.59.3"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"eslint": ">= 9"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
}
|
|
41
|
+
}
|