@kirklin/eslint-config 0.4.1 → 0.5.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.
Files changed (3) hide show
  1. package/README.md +150 -115
  2. package/README.zh-cn.md +138 -117
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -1,115 +1,150 @@
1
- # @kirklin/eslint-config
2
- [![CI][ci-image]][ci-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript_code style][code-style-image]][code-style-url]
3
-
4
- [ci-image]: https://github.com/kirklin/eslint-config/actions/workflows/release.yml/badge.svg?branch=master
5
- [ci-url]: https://github.com/kirklin/eslint-config/actions/workflows/release.yml
6
- [npm-image]: https://img.shields.io/npm/v/@kirklin/eslint-config.svg
7
- [npm-url]: https://npmjs.org/package/@kirklin/eslint-config
8
- [downloads-image]: https://img.shields.io/npm/dm/@kirklin/eslint-config.svg
9
- [downloads-url]: https://npmjs.org/package/@kirklin/eslint-config
10
- [code-style-image]: https://img.shields.io/badge/code__style-%40kirklin%2Feslint--config-brightgreen
11
- [code-style-url]: https://github.com/kirklin/eslint-config/
12
-
13
- <div align='left'>
14
- <b>English</b> | <a href="README.zh-cn.md">简体中文</a>
15
- <br>
16
- </div>
17
-
18
- ## Features
19
-
20
- - "double quotes", must semi;
21
- - Auto fix for formatting (aimed to be used standalone without Prettier)
22
- - TypeScript, Vue out-of-box
23
- - Lint also for JSON、YAML、Markdown
24
- - Sorted imports, dangling commas for cleaner commit diff
25
- - Reasonable defaults, best practices, only one-line of config
26
-
27
- ## Usage
28
-
29
- Shareable configs are designed to work with the `extends` feature of `.eslintrc` files.
30
- You can learn more about
31
- [Shareable Configs](http://eslint.org/docs/developer-guide/shareable-configs) on the
32
- official ESLint website.
33
-
34
- #### run the following command:
35
-
36
- ### Install
37
-
38
- ```bash
39
- pnpm add -D eslint @kirklin/eslint-config
40
- ```
41
- ### add this to your `.eslintrc` file:
42
-
43
- ```json
44
- {
45
- "extends": "@kirklin"
46
- }
47
- ```
48
-
49
- > You don't need `.eslintignore` normally as it has been provided by the preset.
50
-
51
- ### Add script for package.json
52
-
53
- For example:
54
-
55
- ```json
56
- {
57
- "scripts": {
58
- "lint": "eslint .",
59
- "lint:fix": "eslint . --fix"
60
- }
61
- }
62
- ```
63
-
64
- ### Config VS Code auto fix
65
-
66
- Create `.vscode/settings.json`
67
-
68
- ```json
69
- {
70
- "prettier.enable": false,
71
- "editor.formatOnSave": false,
72
- "editor.codeActionsOnSave": {
73
- "source.fixAll.eslint": true
74
- }
75
- }
76
- ```
77
- ### Customization rules
78
- add you like rules to your `.eslintrc` file:
79
- ```json
80
- {
81
- "extends": [
82
- "@kirklin"
83
- ],
84
- "rules": {
85
- "vue/component-tags-order": ["error", {
86
- "order": ["template", "script", "style"]
87
- }]
88
- }
89
- }
90
- ```
91
- ### TypeScript Aware Rules
92
-
93
- Type aware rules are enabled when a `tsconfig.eslint.json` is found in the project root. Refer to [this file](https://github.com/kirklin/eslint-config/blob/master/packages/typescript/index.js#L17).
94
-
95
- ## Badge
96
-
97
- Use this in one of your projects? Include one of these badges in your readme to
98
- let people know that your code is using the standard style.
99
-
100
-
101
- [![kirklin-code-style-image](https://img.shields.io/badge/code__style-%40kirklin%2Feslint--config-brightgreen)](https://github.com/kirklin/eslint-config/)
102
-
103
- ```markdown
104
- [![kirklin-code-style-image](https://img.shields.io/badge/code__style-%40kirklin%2Feslint--config-brightgreen)](https://github.com/kirklin/eslint-config/)
105
- ```
106
-
107
- [code-style-image]: https://img.shields.io/badge/code__style-%40kirklin%2Feslint--config-brightgreen
108
- [code-style-url]: https://github.com/kirklin/eslint-config/
109
-
110
- ## Thanks
111
- This project is based on [@antfu/eslint-config](https://github.com/antfu/eslint-config)
112
-
113
- ## License
114
-
115
- [MIT](./LICENSE) License &copy; 2019-PRESENT [Kirk Lin](https://github.com/kirklin)
1
+ # @kirklin/eslint-config
2
+
3
+ [![CI][ci-image]][ci-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript_code style][code-style-image]][code-style-url]
4
+
5
+ [ci-image]: https://github.com/kirklin/eslint-config/actions/workflows/release.yml/badge.svg?branch=master
6
+ [ci-url]: https://github.com/kirklin/eslint-config/actions/workflows/release.yml
7
+ [npm-image]: https://img.shields.io/npm/v/@kirklin/eslint-config.svg
8
+ [npm-url]: https://npmjs.org/package/@kirklin/eslint-config
9
+ [downloads-image]: https://img.shields.io/npm/dm/@kirklin/eslint-config.svg
10
+ [downloads-url]: https://npmjs.org/package/@kirklin/eslint-config
11
+ [code-style-image]: https://img.shields.io/badge/code__style-%40kirklin%2Feslint--config-brightgreen
12
+ [code-style-url]: https://github.com/kirklin/eslint-config/
13
+
14
+ <div align='left'>
15
+ <b>English</b> | <a href="README.zh-cn.md">简体中文</a>
16
+ <br>
17
+ </div>
18
+
19
+ ## Features
20
+
21
+ - "double quotes", must semi;
22
+ - Auto fix for formatting (aimed to be used standalone without Prettier)
23
+ - TypeScript, Vue out-of-box
24
+ - Lint also for JSON、YAML、Markdown
25
+ - Sorted imports, dangling commas for cleaner commit diff
26
+ - Reasonable defaults, best practices, only one-line of config
27
+
28
+ ## Usage
29
+
30
+ Shareable configs are designed to work with the `extends` feature of `.eslintrc` files.
31
+ You can learn more about
32
+ [Shareable Configs](http://eslint.org/docs/developer-guide/shareable-configs) on the
33
+ official ESLint website.
34
+
35
+ #### run the following command:
36
+
37
+ ### Install
38
+
39
+ ```bash
40
+ pnpm add -D eslint @kirklin/eslint-config
41
+ ```
42
+
43
+ ### add this to your `.eslintrc` file:
44
+
45
+ ```json
46
+ {
47
+ "extends": "@kirklin"
48
+ }
49
+ ```
50
+
51
+ > You don't need `.eslintignore` normally as it has been provided by the preset.
52
+
53
+ ### Add script for package.json
54
+
55
+ For example:
56
+
57
+ ```json
58
+ {
59
+ "scripts": {
60
+ "lint": "eslint .",
61
+ "lint:fix": "eslint . --fix"
62
+ }
63
+ }
64
+ ```
65
+
66
+ ### Config VS Code auto fix
67
+
68
+ Create `.vscode/settings.json`
69
+
70
+ ```json
71
+ {
72
+ "prettier.enable": false,
73
+ "editor.formatOnSave": false,
74
+ "editor.codeActionsOnSave": {
75
+ "source.fixAll.eslint": true,
76
+ "source.organizeImports": false
77
+ },
78
+ // The following section is optional.
79
+ // It is recommended to place it in the project's .vscode/settings.json file
80
+ // to avoid conflicts when working with different eslint configurations
81
+ // that may not support all formats.
82
+ "eslint.validate": [
83
+ "javascript",
84
+ "javascriptreact",
85
+ "typescript",
86
+ "typescriptreact",
87
+ "vue",
88
+ "html",
89
+ "markdown",
90
+ "json",
91
+ "jsonc",
92
+ "yaml"
93
+ ]
94
+ }
95
+ ```
96
+
97
+ ### Customization rules
98
+
99
+ add you like rules to your `.eslintrc` file:
100
+
101
+ ```json
102
+ {
103
+ "extends": ["@kirklin"],
104
+ "rules": {
105
+ "vue/component-tags-order": [
106
+ "error",
107
+ {
108
+ "order": ["template", "script", "style"]
109
+ }
110
+ ]
111
+ }
112
+ }
113
+ ```
114
+
115
+ ### TypeScript Aware Rules
116
+
117
+ Type aware rules are enabled when a `tsconfig.eslint.json` is found in the project root. 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.
118
+
119
+ ```js
120
+ // .eslintrc.js
121
+ const process = require("node:process");
122
+
123
+ process.env.ESLINT_TSCONFIG = "tsconfig.json";
124
+
125
+ module.exports = {
126
+ extends: "@kirklin",
127
+ };
128
+ ```
129
+
130
+ ## Badge
131
+
132
+ Use this in one of your projects? Include one of these badges in your readme to
133
+ let people know that your code is using the standard style.
134
+
135
+ [![kirklin-code-style-image](https://img.shields.io/badge/code__style-%40kirklin%2Feslint--config-brightgreen)](https://github.com/kirklin/eslint-config/)
136
+
137
+ ```markdown
138
+ [![kirklin-code-style-image](https://img.shields.io/badge/code__style-%40kirklin%2Feslint--config-brightgreen)](https://github.com/kirklin/eslint-config/)
139
+ ```
140
+
141
+ [code-style-image]: https://img.shields.io/badge/code__style-%40kirklin%2Feslint--config-brightgreen
142
+ [code-style-url]: https://github.com/kirklin/eslint-config/
143
+
144
+ ## Thanks
145
+
146
+ This project is based on [@antfu/eslint-config](https://github.com/antfu/eslint-config)
147
+
148
+ ## License
149
+
150
+ [MIT](./LICENSE) License &copy; 2019-PRESENT [Kirk Lin](https://github.com/kirklin)
package/README.zh-cn.md CHANGED
@@ -1,117 +1,138 @@
1
- # @kirklin/eslint-config
2
- [![CI][ci-image]][ci-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript_code style][code-style-image]][code-style-url]
3
-
4
- [ci-image]: https://github.com/kirklin/eslint-config/actions/workflows/release.yml/badge.svg?branch=master
5
- [ci-url]: https://github.com/kirklin/eslint-config/actions/workflows/release.yml
6
- [npm-image]: https://img.shields.io/npm/v/@kirklin/eslint-config.svg
7
- [npm-url]: https://npmjs.org/package/@kirklin/eslint-config
8
- [downloads-image]: https://img.shields.io/npm/dm/@kirklin/eslint-config.svg
9
- [downloads-url]: https://npmjs.org/package/@kirklin/eslint-config
10
- [code-style-image]: https://img.shields.io/badge/code__style-%40kirklin-brightgreen.svg
11
- [code-style-url]: https://github.com/kirklin/eslint-config/
12
-
13
- <div align='left'>
14
- <a href="README.md">English</a> | <b>简体中文</b>
15
- <br>
16
- </div>
17
-
18
- ## 特性
19
-
20
- - "双引号",必须加分号;
21
- - 格式化的自动修复(旨在独立使用,不需要Prettier)。
22
- - TypeScript,Vue开箱即用
23
- - JSON、YAML、Markdown也支持格式化
24
- - 导入自动排序,需要尾随逗号,更干净的提交差异
25
- - 合理的默认值,最佳实践,只有一行的配置
26
-
27
- ## 如何使用
28
-
29
- 可共享的配置被设计在`.eslintrc`文件的`extends`。
30
- 你可以了解更多关于
31
- [Shareable Configs](http://eslint.org/docs/developer-guide/shareable-configs) 在
32
- 官方ESLint网站上
33
-
34
- ### 运行以下命令开始使用:
35
-
36
- ### 安装
37
-
38
- ```bash
39
- pnpm add -D eslint @kirklin/eslint-config
40
- ```
41
-
42
- ### 在你的`.eslintrc`文件中加入这个。
43
-
44
- ```json
45
- {
46
- "extends": "@kirklin"
47
- }
48
- ```
49
-
50
- > 你通常不需要`.eslintignore`,因为它已经由预设提供了。
51
-
52
- ### 为package.json添加脚本配置
53
-
54
- 例如:
55
-
56
- ```json
57
- {
58
- "scripts": {
59
- "lint": "eslint .",
60
- "lint:fix": "eslint . --fix"
61
- }
62
- }
63
- ```
64
-
65
- ### 在Vscode中 配置自动修复
66
-
67
- 创建 `.vscode/settings.json`
68
-
69
- ```json
70
- {
71
- "prettier.enable": false,
72
- "editor.formatOnSave": false,
73
- "editor.codeActionsOnSave": {
74
- "source.fixAll.eslint": true
75
- }
76
- }
77
- ```
78
-
79
- ### 自定义规则
80
-
81
- 在你的`.eslintrc`文件中添加你喜欢的规则。
82
-
83
- ```json
84
- {
85
- "extends": [
86
- "@kirklin"
87
- ],
88
- "rules": {
89
- "vue/component-tags-order": ["error", {
90
- "order": ["template", "script", "style"]
91
- }]
92
- }
93
- }
94
- ```
95
- ### TypeScript Aware Rules
96
-
97
- 当在项目根目录中找到`tsconfig.eslint.json`时,将启用Type Aware Rules, [参阅此处](https://github.com/kirklin/eslint-config/blob/master/packages/typescript/index.js#L17).
98
-
99
- ## 徽章
100
- 在你的README中包括一个这样的徽章,以便让人们知道你的代码使用的是哪种ESLint样式。
101
-
102
- [![kirklin-code-style-image](https://img.shields.io/badge/code__style-%40kirklin%2Feslint--config-brightgreen)](https://github.com/kirklin/eslint-config/)
103
-
104
- ```markdown
105
- [![kirklin-code-style-image](https://img.shields.io/badge/code__style-%40kirklin%2Feslint--config-brightgreen)](https://github.com/kirklin/eslint-config/)
106
- ```
107
-
108
- [code-style-image]: https://img.shields.io/badge/code__style-%40kirklin%2Feslint--config-brightgreen
109
- [code-style-url]: https://github.com/kirklin/eslint-config/
110
-
111
- ## 致谢
112
- 本项目基于 [@antfu/eslint-config](https://github.com/antfu/eslint-config)
113
-
114
-
115
- ## 开源协议
116
-
117
- [MIT](./LICENSE) License &copy; 2019-PRESENT [Kirk Lin](https://github.com/kirklin)
1
+ # @kirklin/eslint-config
2
+
3
+ [![CI][ci-image]][ci-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript_code style][code-style-image]][code-style-url]
4
+
5
+ [ci-image]: https://github.com/kirklin/eslint-config/actions/workflows/release.yml/badge.svg?branch=master
6
+ [ci-url]: https://github.com/kirklin/eslint-config/actions/workflows/release.yml
7
+ [npm-image]: https://img.shields.io/npm/v/@kirklin/eslint-config.svg
8
+ [npm-url]: https://npmjs.org/package/@kirklin/eslint-config
9
+ [downloads-image]: https://img.shields.io/npm/dm/@kirklin/eslint-config.svg
10
+ [downloads-url]: https://npmjs.org/package/@kirklin/eslint-config
11
+ [code-style-image]: https://img.shields.io/badge/code__style-%40kirklin-brightgreen.svg
12
+ [code-style-url]: https://github.com/kirklin/eslint-config/
13
+
14
+ <div align='left'>
15
+ <a href="README.md">English</a> | <b>简体中文</b>
16
+ <br>
17
+ </div>
18
+
19
+ ## 特性
20
+
21
+ - "双引号",必须加分号;
22
+ - 格式化的自动修复(旨在独立使用,不需要 Prettier)。
23
+ - TypeScript,Vue 开箱即用
24
+ - 对 JSON、YAML、Markdown 也支持格式化
25
+ - 导入自动排序,需要尾随逗号,更干净的提交差异
26
+ - 合理的默认值,最佳实践,只有一行的配置
27
+
28
+ ## 如何使用
29
+
30
+ 可共享的配置被设计在`.eslintrc`文件的`extends`。
31
+ 你可以了解更多关于
32
+ [Shareable Configs](http://eslint.org/docs/developer-guide/shareable-configs) 在
33
+ 官方 ESLint 网站上
34
+
35
+ ### 运行以下命令开始使用:
36
+
37
+ ### 安装
38
+
39
+ ```bash
40
+ pnpm add -D eslint @kirklin/eslint-config
41
+ ```
42
+
43
+ ### 在你的`.eslintrc`文件中加入这个。
44
+
45
+ ```json
46
+ {
47
+ "extends": "@kirklin"
48
+ }
49
+ ```
50
+
51
+ > 你通常不需要`.eslintignore`,因为它已经由预设提供了。
52
+
53
+ ### 为 package.json 添加脚本配置
54
+
55
+ 例如:
56
+
57
+ ```json
58
+ {
59
+ "scripts": {
60
+ "lint": "eslint .",
61
+ "lint:fix": "eslint . --fix"
62
+ }
63
+ }
64
+ ```
65
+
66
+ ### 在 Vscode 中 配置自动修复
67
+
68
+ 创建 `.vscode/settings.json`
69
+
70
+ ```json
71
+ {
72
+ "prettier.enable": false,
73
+ "editor.formatOnSave": false,
74
+ "editor.codeActionsOnSave": {
75
+ "source.fixAll.eslint": true,
76
+ "source.organizeImports": false
77
+ },
78
+ // 以下内容为可选项。
79
+ // 建议将其放置在项目的 .vscode/settings.json 文件中,
80
+ // 以避免在使用不同的 eslint 配置时出现冲突,
81
+ // 这些配置可能不支持所有格式。
82
+ "eslint.validate": [
83
+ "javascript",
84
+ "javascriptreact",
85
+ "typescript",
86
+ "typescriptreact",
87
+ "vue",
88
+ "html",
89
+ "markdown",
90
+ "json",
91
+ "jsonc",
92
+ "yaml"
93
+ ]
94
+ }
95
+ ```
96
+
97
+ ### 自定义规则
98
+
99
+ 在你的`.eslintrc`文件中添加你喜欢的规则。
100
+
101
+ ```json
102
+ {
103
+ "extends": ["@kirklin"],
104
+ "rules": {
105
+ "vue/component-tags-order": [
106
+ "error",
107
+ {
108
+ "order": ["template", "script", "style"]
109
+ }
110
+ ]
111
+ }
112
+ }
113
+ ```
114
+
115
+ ### TypeScript Aware Rules
116
+
117
+ 当在项目根目录中找到`tsconfig.eslint.json`时,将启用 Type Aware Rules, [参阅此处](https://github.com/kirklin/eslint-config/blob/master/packages/typescript/index.js#L17).
118
+
119
+ ## 徽章
120
+
121
+ 在你的 README 中包括一个这样的徽章,以便让人们知道你的代码使用的是哪种 ESLint 样式。
122
+
123
+ [![kirklin-code-style-image](https://img.shields.io/badge/code__style-%40kirklin%2Feslint--config-brightgreen)](https://github.com/kirklin/eslint-config/)
124
+
125
+ ```markdown
126
+ [![kirklin-code-style-image](https://img.shields.io/badge/code__style-%40kirklin%2Feslint--config-brightgreen)](https://github.com/kirklin/eslint-config/)
127
+ ```
128
+
129
+ [code-style-image]: https://img.shields.io/badge/code__style-%40kirklin%2Feslint--config-brightgreen
130
+ [code-style-url]: https://github.com/kirklin/eslint-config/
131
+
132
+ ## 致谢
133
+
134
+ 本项目基于 [@antfu/eslint-config](https://github.com/antfu/eslint-config)
135
+
136
+ ## 开源协议
137
+
138
+ [MIT](./LICENSE) License &copy; 2019-PRESENT [Kirk Lin](https://github.com/kirklin)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kirklin/eslint-config",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Kirk Lin's ESLint config",
5
5
  "author": "Kirk Lin <linkirk@163.com> (https://github.com/kirklin)",
6
6
  "license": "MIT",
@@ -16,22 +16,22 @@
16
16
  "eslint": ">=7.4.0"
17
17
  },
18
18
  "dependencies": {
19
- "@typescript-eslint/eslint-plugin": "^5.60.1",
20
- "@typescript-eslint/parser": "^5.60.1",
19
+ "@typescript-eslint/eslint-plugin": "^6.1.0",
20
+ "@typescript-eslint/parser": "^6.1.0",
21
21
  "eslint-plugin-eslint-comments": "^3.2.0",
22
22
  "eslint-plugin-html": "^7.1.0",
23
23
  "eslint-plugin-import": "^2.27.5",
24
24
  "eslint-plugin-jsonc": "^2.9.0",
25
25
  "eslint-plugin-n": "^16.0.1",
26
26
  "eslint-plugin-promise": "^6.1.1",
27
- "eslint-plugin-unicorn": "^47.0.0",
27
+ "eslint-plugin-unicorn": "^48.0.0",
28
28
  "eslint-plugin-vue": "^9.15.1",
29
29
  "eslint-plugin-yml": "^1.8.0",
30
30
  "jsonc-eslint-parser": "^2.3.0",
31
31
  "yaml-eslint-parser": "^1.2.2",
32
- "@kirklin/eslint-config-vue": "0.4.1"
32
+ "@kirklin/eslint-config-vue": "0.5.0"
33
33
  },
34
34
  "devDependencies": {
35
- "eslint": "^8.44.0"
35
+ "eslint": "^8.45.0"
36
36
  }
37
37
  }